开发者

How to add generated code files in VS 2010 as dependent files?

开发者 https://www.devze.com 2023-02-28 07:46 出处:网络
I am automating my project using T4 templates. For this, I have to write some repeated code using T4 template and some hand written cod开发者_如何学JAVAe which should not be overwritten by the T4 temp

I am automating my project using T4 templates. For this, I have to write some repeated code using T4 template and some hand written cod开发者_如何学JAVAe which should not be overwritten by the T4 template. I would like to add the generated code file as the dependent file of the handwritten file. I am following convention of class1.cs for handwritten file and class1.generated.cs for generated file. How can I add this generated file in the project as dependent file of class1.cs?


To do this programmatically you'll have to modify the .csproj file directly. Refer to this question for details: In Visual Studio (2008) is there a way to have a custom dependent file on another custom file?

If you want to do this via the IDE then use the VSCommonds Add-in for Visual Studio 2010.

0

精彩评论

暂无评论...
验证码 换一张
取 消