From PowerShell the specified project in the solution
I would like to build via VisualStudio.DTE.
It doesn't work
I probably need to go down the hierarchy of solution folders in the solution
I don't know how to do it
The solution consists of:
Solution Folder
│ -- Project 1 folder
│ │Yes -Project.csproj
│ <
│ -- Project 2 folder
│ --Projec2.csproj
<
--Solution.sln
--Build.ps1
Here's the code:
$VSDTE=New-Object-ComObject VisualStudio.DTE
$VSDTE.MainWindow.Visible=$True
$VSDTE.Solution.Open("$PSScriptRoot\○○○○.sln")
foreach ($prj in $VSDTE.Solution.Projects)
{
// I want to get out of the hierarchy here.
$VSDTE.Solution.SolutionBuild.BuildProject("Release", $prj.UniqueName, $true)
}
$VSDTE.Quit()
System.Runtime.Interopservices.Marshal :: ReleaseComObject($VSDTE)
Reference
MicroSoft Docs EnvDTE Namespace
You can get the path to MSBuild by using vswhere, which is not a question.For your information – nee 2 days ago
We have decided to deal with it this time
Thank you all for your reply
© 2024 OneMinuteCode. All rights reserved.