Working with WebDeployment in MS Project files

1–2 minutes

Originally from

Found, then improved from

Found, then improved

Repost

the wolf peeling off absolute path labels from a package and re-tying it with a rope, one amber label, the raven watching

Great article: http://stackoverflow.com/questions/2959964/vs2010-web-deploy-how-to-remove-absolute-paths-and-automate-setacl

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>
Plaintext
_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 :


Plaintext
msbuild.exe projectfile.csproj /t:Package /p:_PackageTempDir=C:Package


  • Or directly in the project file :


XML
<Import Project="$(MSBuildBinPath)Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)MicrosoftVisualStudiov10.0WebApplicationsMicrosoft.WebApplication.targets" />


<!-- Must be after Microsoft.WebApplication.targets import -->
<PropertyGroup>
  <_PackageTempDir>C:Package</_PackageTempDir>
</PropertyGroup>