简体   繁体   中英

Publish web application from MSBuild Script using VS2010 targets resets working directory

I am trying to automatically publish and deploy my .Net 4 web application automatically from a build script to be run by our continuous integration server. I am using the new _WPPCopyWebApplication target from VS2010 to perform the publish, however it appears to reset the current working directory of the msbuild project to c:\\ this causes my prebuild steps to fail as they have relative paths to some external tools. The task I am running from our master.build file is as follows:

<Target Name="PublishWeb">
    <MSBuild 
        Projects="$(ProjectPath)"
        Targets="ResolveReferences;_WPPCopyWebApplication"
        Properties="WebProjectOutputDir=$(DeployPath);OutDir=$(TempOutputFolder)$(WebOutputFolder)\;OutputPath=$(ProjectPath)\bin\Debug;" />
</Target>    

This does not happen when using the legacy _CopyWebApplication. Does anyone have any idea how to resolve this problem?

Two possibilities come to mind:

  1. Use the Exec task to call msbuild.exe, and supply a specific working directory.
  2. Your pre-build steps are evaluated by MSBuild and can reference any MSBuild property, so make your paths relative to something specific, like $(MSBuildProjectDirectory) , or $(MSBuildThisFileDirectory) , instead of just relative to the current directory.

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