Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSBuild OutputPath property and absolute paths

Tags:

msbuild

I'm trying to set the OutputPath value to an absolute path:

<OutputPath>c:\Projects\xxx\Deployment</OutputPath>

But I get this error:

Error   17  The expression "[System.IO.Path]::GetFullPath(D:\Projects\xxx\trunk\xxx.Web.Deployment\c:\Projects\xxx\Deployment\)" cannot be evaluated. The given path's format is not supported.     1   1   xxx.Web.Deployment

Is there a way to use an absolute path with the OutputPath property? I've tried experimenting with the BaseOutputPath property:

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Deployment|AnyCPU'">
  <BaseOutputPath>C:\Projects\xxx\</BaseOutputPath>
  <OutputPath>.\Deployment</OutputPath>
  <EnableUpdateable>true</EnableUpdateable>
  <UseMerge>true</UseMerge>
  <SingleAssemblyName>xxx.Web.Deployment</SingleAssemblyName>

But it seems to get ignored. What are BaseOutputPath and BaseIntermediateOutputPath used for?

like image 832
Frederik Vig Avatar asked Jun 07 '10 12:06

Frederik Vig


2 Answers

I'm not sure whether you can do what you're talking about, but you can add something similar to the following:

<PropertyGroup>  
    <CentralisedBinariesFolderLocation>c:\wherever</CentralisedBinariesFolderLocation>
</PropertyGroup>  

<Target Name="AfterBuild">
    <Exec Command="xcopy /Y /S /F /R &quot;$(TargetPath)&quot; &quot;$(CentralisedBinariesFolderLocation)&quot;" />
</Target>

Which will copy it to the relevant location after the build.

like image 120
Paul Michaels Avatar answered Sep 25 '22 14:09

Paul Michaels


Try using OutDir instead of OutputPath :

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Deployment|AnyCPU'">
  <OutDir>C:\Projects\xxx\$(Configuration)</OutDir>
  <EnableUpdateable>true</EnableUpdateable>
  <UseMerge>true</UseMerge>
  <SingleAssemblyName>xxx.Web.Deployment</SingleAssemblyName>
</PropertyGroup>
like image 30
Julien Hoarau Avatar answered Sep 24 '22 14:09

Julien Hoarau