简体   繁体   中英

msbuild package target issue

I have an MVC 4 web app with VS2012, msbuild and am creating a build script with psake. I've created a publish profile in VS that packages up the project into a zip file. Running it from within VS works fine. However, running it from the command line, I get the following error:

Executing package Microsoft (R) Build Engine version 4.0.30319.32559 [Microsoft .NET Framework, version 4.0.30319.32559] Copyright (C) Microsoft Corporation. All rights reserved.

C:\\Program Files (x86)\\MSBuild\\Microsoft\\VisualStudio\\v10.0\\Web\\Microsoft.Web.P ublishing.targets(2006,11): error MSB4100: Expected "$(_DeploymentUseIis)" to e valuate to a boolean instead of "", in condition "$(_DeploymentUseIis) And ($(L ocalIisVersion) >= '7')". C:\\Program Files (x86)\\MSBuild\\Microsoft\\VisualStudi o\\v10.0\\Web\\Microsoft.Web.Publishing.targets [E:\\bitbucket\\mypopsales\\src\\MyPop Sales\\ConsumerWeb\\ConsumerWeb.csproj] Error: 07/25/2013 07:29:41: At E:\\bitbucket\\mypopsales\\tools\\psake\\psake.psm1:139 char:9 +
throw (" Exec: " + $errorMessage) +
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [<<==>>] Ex ception: Exec: Error executing command msbuild $csprojFile /t:Package /p:Plat form=AnyCPU /p:Configuration=$config /v:q . ERROR: 1

I have Web Deploy 3.5 installed on the box via WebPI. Any idea on how I can resolve this issue? The relevant section of the build script is as follows:

task package -depends test {    
    $csprojFile = "$solution_dir\$consumer\$consumer.csproj";   
    exec{ msbuild $csprojFile /t:Package /p:Platform=AnyCPU /p:Configuration=$config /v:q } 
}

Joy...after spending a couple of hours on this, it turns out to be as simple as adding:

/p:VisualStudioVersion=11.0

to the parameters list.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM