英文:
Use PowerShell developer command prompt to build solution
问题
如何在PowerShell脚本中使用开发人员PowerShell命令提示符Launch-VsDevShell.ps1来编译解决方案?
我希望在开发人员控制台的环境中进行编译
当运行此脚本时,我可以访问所有的环境变量
当我从脚本中启动Launch-VsDevShell.ps1时,我无法看到在执行Launch-VsDevShell.ps1后使用给定参数启动msbuild的选项。
我希望以参数的方式启动Launch-VsDevShell.ps1,类似于这样
& "C:\Program Files\Microsoft Visual Studio22\Professional\Common7\Tools\Launch-VsDevShell.ps1" -arglist
当使用直接的msbuild.exe时,我使用以下代码
$arglist = "$workfolder\build$sln /m /nr:false /bl:$workfolder\Logs\binarylog_$date_$sln.binlog /nologo /flp:errorsonly;LogFile=$msbuildlogErr"
$resbuild = Start-Process $msbuild -ArgumentList $arglist -PassThru
我找不到任何示例。
英文:
How do use the developer powershell command prompt Launch-VsDevShell.ps1 in powershell script to compile solution ?
I want to compile inside the environment of the developer console
when runing this script i get all environment variable accessible
when i launch the Launch-VsDevShell.ps1 from script i dont have see option to add parameters to start msbuild after the execution of the Launch-VsDevShell.ps1 with given parameters.
i wish to strta the Launch-VsDevShell.ps1 with argumets .
somthing like this
& "C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\Tools\Launch-VsDevShell.ps1" -arglist
when using direct msbuild.exe i use the follwoing code
$arglist = "$workfolder\build$sln /m /nr:false /bl:$workfolder\Logs\binarylog_$date_$sln.binlog /nologo /flp:errorsonly;LogFile=$msbuildlogErr"
$resbuild = Start-Process $msbuild -ArgumentList $arglist -PassThru
i couldn't find any example
答案1
得分: 1
Source the file, which will set all environment variables, then compile using msbuild as usual:
. "C:\Program Files\Microsoft Visual Studio22\Professional\Common7\Tools\Launch-VsDevShell.ps1"
msbuild /path/to/solution.sln
英文:
Source the file, which will set all environment variables, then compile using msbuild as usual:
. "C:\Program Files\Microsoft Visual Studio22\Professional\Common7\Tools\Launch-VsDevShell.ps1"
msbuild /path/to/solution.sln
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论