-4

I am looking for approach add existing C# Project (.csproj) into solution (.sln) programmatically on C#. Will be good if posible escape use “illegal” way like parsing and edit xml document.

At the end of work, result should be like adding existing C# Project via Visual Studio.

enter image description here

  • It is legal to edit a file on your local computer. – PepitoSh Jun 13 '18 at 08:04
  • I found the duplicate in under a minute, less time than it took to write this... – Jeremy Thompson Jun 13 '18 at 08:13
  • As a starting point check out the [Microsoft .Net APIs](https://learn.microsoft.com/en-us/dotnet/api/index?view=visualstudiosdk-2017) - there are lots of APIs for accessing Visual Studio & several for projects in particular languages. – PaulF Jun 13 '18 at 08:13

1 Answers1

2

This highly depends on the VS version you target.

This is like the latest link on How to: Programmatically Create Projects. It contains a big well-commented code sample that you can copy-paste and modify to meet your needs.

Also see these links:

v.karbovnichy
  • 3,183
  • 2
  • 36
  • 47