1

Resolved

Error in DteProcessor.FindProjectItemCollection - incorrect ProjectItems instance returned for files in subfolders

description

When generating an output file with setting Template.Output.File to some subdirectory, the DteProcessor.FindProjectItemCollection returns a ProjectItems instance pointing to the root directory of the project, not to the target subfolder. Then UpdateOutputFiles methods acts like the target file has been moved within the project structure. ( "if (outputItem.Collection != collection)" condition is then valid)
I solved this issue by commenting out the condition in the FindProjectItemCollection method, that checks, whether the project is a database project. Then the loop on the end of the method is executed for any project kind and the correct ProjectItems collection is returned.

file attachments

comments

OlegSych wrote Apr 14, 2010 at 1:03 PM

Please describe the problem in the terms of user/developer actions and expected/actual results.

josef_macek wrote Apr 14, 2010 at 2:33 PM

Hi,

please, run the transformation in attachment, file test.txt in subfolder Generated should be generated. Then run the trasformation again. Because of the error described above the file will be moved to test.txt.bak, then deleted, then again created. In our case this behavior results in severe problems with source control.

Suggested solution is in my initial post, but maybe I do not see all the circumstances...

wrote Apr 14, 2010 at 2:33 PM

OlegSych wrote Apr 14, 2010 at 5:14 PM

I still can't duplicate it. Can you be more specific about versions of Visual Studio, T4 Toolbox and the type of project you are using?

josef_macek wrote Apr 28, 2010 at 8:58 AM

hi Oleg, sorry for delay.
In attachment I send small solution where you should be able to reproduce the described bhavior. When running the transformation on the Demo.tt file, the output file \Generated\test.txt should not be touched, because it is not changed by the transformation. But it is moved to .bak, and then back. I've proved this behavior succesfully by Process Monitor.

wrote Apr 28, 2010 at 8:58 AM

OlegSych wrote May 1, 2010 at 8:52 PM

Thanks Josef. I can see it.

wrote May 1, 2010 at 8:56 PM

wrote Jun 25, 2010 at 9:00 PM

Resolved with changeset 51593.

wrote Jun 25, 2010 at 9:05 PM

wrote Feb 22, 2013 at 12:05 AM

wrote May 16, 2013 at 11:28 AM

wrote May 16, 2013 at 11:28 AM

wrote Jun 14, 2013 at 7:30 AM