[英]Visual Studio 2017 - PreBuild event command line (build another project)
我有多個項目的解決方案。
當我構建項目“ Foo”時,我需要它在Foo之前也構建項目“ SimplePluginFramework”。
即使Foo是在調試模式下構建的,它也需要在發布模式下構建“ SimplePluginFramework”。
我嘗試將其添加到Foo的Pre-build事件命令行中,但是它已存在,代碼為9009,Bar無法構建...
$(MSBuildBinPath)\MSBuild.exe "L:\SL1 - Current System\Core\SL Agent\SLV1\Agent\SimplePluginFramework\SimplePluginFramework.csproj" /t:build /p:Configuration=Release
如何在構建之前使一個項目的構建觸發另一個項目的構建?
我嘗試添加對該項目的引用,但它仍未構建。
錯誤:
1>Target "PreBuildEvent" in file "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets" from project "L:\SL1-(SentiLAN)-SentiLAN v1 - Current System\SentilanCore\SentiLAN Agent\SentilanV1\AgentServiceTpl\SentilanService\SentilanService.csproj" (target "CoreBuild" depends on it):
1>Using "Exec" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
1>Task "Exec"
1> "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe" "L:\SL1 - Current System\Core\SL Agent\SLV1\Agent\SimplePluginFramework\SimplePluginFramework.csproj" /t:build /p:Configuration=release
1> Microsoft (R) Build Engine version 15.3.409.57025 for .NET Framework
1> Copyright (C) Microsoft Corporation. All rights reserved.
1>
1> Build started 15/11/2017 09:47:32.
1> Project "L:\SL1 - Current System\Core\SL Agent\SLV1\Agent\SimplePluginFramework\SimplePluginFramework.csproj" on node 1 (build target(s)).
1> GenerateTargetFrameworkMonikerAttribute:
1> Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
1> CoreCompile:
1> Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
1> _CopyAppConfigFile:
1> Skipping target "_CopyAppConfigFile" because all output files are up-to-date with respect to the input files.
1> CopyFilesToOutputDirectory:
1> SimplePluginFramework -> L:\SL1 - Current System\Core\SL Agent\SLV1\Agent\SimplePluginFramework\lib\net35\SimplePluginFramework.dll
1> Done Building Project "L:\SL1 - Current System\Core\SL Agent\SLV1\Agent\SimplePluginFramework\SimplePluginFramework.csproj" (build target(s)).
1>
1> Build succeeded.
1> 0 Warning(s)
1> 0 Error(s)
1>
1> Time Elapsed 00:00:00.22
項目依賴項:
使用項目| 項目依賴項來定義Foo依賴於SimplePluginFramework。
使用解決方案配置(右鍵單擊解決方案並選擇屬性)來定義解決方案級別的調試配置。使用Foo的調試版本,但使用SimplePluginFramework的發行版本。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.