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.
-
I edited the question to improve the English - I hope I didn't lose the meaning – Preet Sangha Jun 02 '12 at 23:22
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.

- 1
- 1

- 64,563
- 18
- 145
- 216
-
Thanks for answer. I will be a little more question. Now where i can find .csproj and .sln files templates. – Polymorphism Jun 02 '12 at 23:58
-
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.

- 911
- 3
- 14
- 38
Try the following batch code, which requires the dotnet
command to be available.
This generates your .cs
program, .csproj
file, bin
folder and obj
folder.
cd Projects
set /p user_in=Enter the new folder name:
dotnet new console -o "%user_in%"
cd "%user_in%"
dotnet restore

- 555
- 5
- 15