我們正在使用的配置改變我們的解決方案裏面。例如:Debug,Test,Staging,Release 但是,這些配置僅用於我們的MVC項目。所有這些庫只使用Debug和Release,這更加合理,因爲我們的庫只需要以調試模式或釋放模式構建。
嘗試從命令行構建單個項目時出現此問題。我需要能夠做到這一點,以便將我們的構建從TeamCity自動部署到我們的測試環境。
當我建立這樣
msbuild myproject.csproj
/t:Build
/P:Configuration=Test
/P:Platform=AnyCPU
/P:DeployOnBuild=True
/P:DeployTarget=MSDeployPublish
/P:MsDeployServiceUrl=https://SERVER:8172/MsDeploy.axd
/P:AllowUntrustedCertificate=True
/P:MSDeployPublishMethod=WMSvc
/P:CreatePackageOnPublish=True
/P:UserName=Username
/P:Password=Passsword
/P:DeployIisAppPath="IISAPPPATH"
我得到以下錯誤的單個項目
myproject.csproj" (Build target) (1) -> "C:\src\myproject.csproj" (default target) (18) -> c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(483,9) : error : The OutputPath property is not set for project 'sampleLibrary.csproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Test' Platform='AnyCPU'. You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project.
我知道這意味着什麼,因爲我的sampleLibrary沒有用於測試的配置,以及樣本庫的映射將包含在我的.sln文件中
問題
有沒有辦法解決這個問題,而無需爲每個庫項目添加這些配置?它在這裏聞起來像一個醜陋的黑客。
我不知道這是否專門解決您遇到的問題但是您可能會從我的SO帖子[在此處]獲得一些有用的信息(http://stackoverflow.com/q/8334475/132599)。 – 2012-01-16 01:40:05