0

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.

1
  • I edited the question to improve the English - I hope I didn't lose the meaning Commented Jun 2, 2012 at 23:22

3 Answers 3

2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for answer. I will be a little more question. Now where i can find .csproj and .sln files templates.
create a project in visual studio. Use those as templates.
0

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.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.