在我们的解决方案中,我们有超过 150 个项目,我需要先构建一个项目,但我不想为超过 100 个项目一一设置项目引用或项目依赖项。这是浪费时间。所以我在这个问题之前问了以下问题:
正如@Leo Liu 建议我可以先使用批处理文件来构建项目,这应该是一个有效的解决方法。作为优化,我想在该项目的构建事件中设置这个bat文件,这样我只需要构建那个项目,不需要从外部手动运行bat文件。
但是,当我使用以下构建事件构建该项目时:
call "$(ProjectDir)\MyTest.bat"
我收到了这个错误:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin\Microsoft.Common.CurrentVersion.targets(5074,5): error MSB3073: The command "call "C:\Users\Myname\Source\repos\MysolutionName\GenerateFile\MyTest.bat"" exited with code 1. [C:\Users\\Source\repos\MysolutionName\GenerateFile\GenerateFile.csproj]
更新:bat文件中的脚本是:
@echo OFF
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsDevCmd.bat"
echo "Starting Build for all Projects with proposed changes"
MSBuild.exe "C:\Users\MyName\Source\repos\MySolutionName\MySolutionName.sln"
pause
echo "All builds completed."
有什么建议吗?提前致谢。