[英]msbuild won't build in release configuration
使用msbuild 14.0並從命令中調用它:
C:\\Program Files (x86)\\MSBuild\\14.0\\Bin\\MSBuild.exe C:\\Project\\MySolution.sln /t:Build /p:Configuration=Release /p:Platform='Any CPU'
MySolution是Visual Studio C#解決方案,由幾個項目組成: Project1 , Project2 ,...
輸出:
Microsoft (R) Build Engine version 14.0.25420.1
Copyright (C) Microsoft Corporation. All rights reserved.
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 2018-06-08 10:48:08 AM.
Project "C:\Project\MySolution.sln" on node 1 (Build /p:Configuration=Release /p:Platform='Any CPU
' target(s)).
ValidateSolutionConfiguration:
Building solution configuration "Debug|Any CPU".
ValidateProjects:
The project "Project3" is not selected for building in solution configuration "Debug|Any CPU".
C:\Project\MySolution.sln.metaproj : error MSB4057: The target "Build /p:Configuration=Release /p:
Platform='Any CPU'" does not exist in the project. [C:\Project\MySolution.sln]
Done Building Project "C:\Project\MySolution.sln" (Build /p:Configuration=Release /p:Platform='Any
CPU' target(s)) -- FAILED.
Build FAILED.
為什么msbuild無法在發布配置中構建解決方案? 它始終默認為調試 ?? 從Visual Studio調用解決方案時,該解決方案已正確配置,並且使用該配置進行構建不會有任何問題。
msbuild始終選擇Project3,並聲稱未選擇它在解決方案配置“ Debug | Any CPU”中進行構建,這是不正確的。 此解決方案中的所有項目也可以在調試配置中構建。 但這不是我要在這里做的。
解決方案配置的屏幕截圖:
列表底部的兩個未選中項目是單元測試。
附加問題:
/verbosity
開關集成到build命令中? 我使用msbuild 15.0代替了msbuild 14.0(無論如何我都以4.6.1為目標框架),錯誤消失了。
您能否在命令中添加此附加屬性並進行檢查。
/p:TargetFramework=<version>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.