I'm working on a PowerShell script to dynamically create and add a Visual Studio project with its folders and assets to a solution. I'm using Visual Studio DTE.
My directory structure on the file system is the following:
C:\Dir1\Dir2\Stuff
|
+--Stuff <-- folder
| |
| `Stuff.csproj <-- existing project, included in sln
|
+--Subfolder <-- Subfolder in which I want to include my new csproj
| +--Project1 <-- folder
| | |
| | `Project1.csproj <-- existing project, included in sln
| |
| +--Project2 <-- folder
| | |
| | `Project2.csproj <-- existing project, included in sln
| |
| `--Project3 <-- this, subs below and csproj are created from my script
| |
| `Project3.csproj
|
`Stuff.sln
My script creates Subfolder\Project3\Project3.csproj correctly, and I can add it to the solution without any problems, using DTE.
I want, however, to add Project3 in the solution folder 'Subfolder', so it looks like this (dummy image, red arrow shows where I want to have Project3):
How can I accomplish this using Powershell (and optionally EnvDTE)? Any example code would be appreciated. Thanks!