How to create csproj command line?

2020-04-12 16:52发布

问题:

Is there any way to create a CS and WPF solution of Visual Studio templates from command line?

I wrote a C# and WPF code generator, and I want that my output be a C# solution.

回答1:

To create a Project from command line, simply create and save a Project and use a commandline to copy the folder.

Or using Visual Studio DTE2: http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/72d6608b-2e9a-4bc4-b294-b75db17bcad2/

Or to create a Project Template Using the Projectgen.exe Command-Line Tool http://msdn.microsoft.com/en-us/library/cc175876(v=vs.90).aspx



回答2:

Hmmm, what would be the use of it?

I think you can take a look at the /Command switch for devenv:

devenv.exe /Command np

where "np" stands for "new project".

Here is a list of the available commands: Predefined commands, try to play with it...

But I think it would be much simpler to zip an empty solution and just copy it in your script file instead of asking VS to do it over and over again...