Reputation: 2673
Can anybody provide some code block to add an existing C# file to a project.
I have 2 projects in my solution. One project generates C# class files which will be use by second project. I have to incluse these generated files in the second project and build the project. It should be done through programatically. I know that to include these files I have to edit the C#project file (which is an XML) and make an entry that file. But I thought of using existing code if anybody has it.
Thanks
Upvotes: 2
Views: 2220
Reputation: 33252
You can ahve a look at the MsBuild.Engine namespace. It allows you to manipulate a csproj in a consistent way so you can oper the target project and add the reference programmatically.
Upvotes: 1