Working with WebDeployment in MS Project files

Great article:

The displayed path is determined by the property _MSDeployDirPath_FullPath.

This property is setted by this chain of properties:

  • <_MSDeployDirPath_FullPath>@(_MSDeployDirPath->'%(FullPath)')</_MSDeployDirPath_FullPath>
  • <_MSDeployDirPath Include="$(_PackageTempDir)" />
  • <_PackageTempDir>$(PackageTempRootDir)PackageTmp</_PackageTempDir>
  • <PackageTempRootDir>$(IntermediateOutputPath)Package</PackageTempRootDir>
_MSDeployDirPath_FullPath <-- @(_MSDeployDirPath->'%(FullPath)') <-- _PackageTempDir <-- $(PackageTempRootDir)PackageTmp

AS you can see, you can’t have a relative path, because _MSDeployDirPath_FullPath is the fullpath of _MSDeployDirPath.

But you can simplify the displayed path by overriding the property _PackageTempDir with the path you want to be displayed to your customer. (This path will be used as a temporary directory for the package generation)

You could override the property :

  • In command line :

    msbuild.exe projectfile.csproj /t:Package /p:_PackageTempDir=C:Package
  • Or directly in the project file :

    <Import Project="$(MSBuildBinPath)Microsoft.CSharp.targets" />
    <Import Project="$(MSBuildExtensionsPath32)MicrosoftVisualStudiov10.0WebApplicationsMicrosoft.WebApplication.targets" />
    <!-- Must be after Microsoft.WebApplication.targets import -->