Write visual studio project from code

By : Peter
Source: Stackoverflow.com
Question!

Is there any way to write a Visual Studio Project file easy or do i have to look at the xml format and write it by hand? Is there any lib for this in .net framework(3.5)?

Im using vb.net but c# would also work..

By : Peter


Answers

We do it from a couple of in-house tools. The project files for Visual Studio are stored as XML, so you can just use whatever XML classes you prefer. Make sure you pay attention to GUIDs as they are used to tie everything together between the various files in Visual Studio.



Visual Studio since version 2005 uses the MSBuild format to store C# and VB project files.

You could read this primer http://www.informit.com/guides/content.aspx?g=dotnet&seqNum=472 or search the Web for further examples.

For programmatic access you could use the classes in the Microsoft.Build.BuildEngine namespace. Probably the Project class is of most interest to you.



There is no support for this in the framework. The Visual Studio project file format is specific to Visual Studio. There may be support in the MSBuild libraries but you would need to include them as a reference and interact with it that way. What are you trying to do that requires you to create a VS project file?

The link provided here should give you what you need.



This video can help you solving your question :)
By: admin