开发者

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

开发者 https://www.devze.com 2023-01-13 20:19 出处:网络
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 tar

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.
0

精彩评论

暂无评论...
验证码 换一张
取 消