I am developing a development C# Generator and I need to make a class, but I don't understand how I can make the .csproj files.
3 Answers
These are just text files.
cs proj is an msbuild file. And cs file is just a nomale code file.
The best thing to do is to use a sample .csproj and .cs file and use search and replace to put the correct values into it. This will get you started.
When you understand the theory you can move on to a better templating engine such as RAZOR or T4. And then onto the better techniques of generating assemblies at run time.
2 Comments
Create an empty solution and save it in a location. Then add a project to that solution and save the solution to a different place. Open these two solutions with a text editor and compare the files, so you can see how does the solution file change if you add a project to a solution. In the same way, if you want to add a project to that solution programatically just read the solution file using textreader edit the solution file text and write it back to the same solution file.
Hope it helps.