UseWPP_CopyWebApplication with web.config transformations

2.8k Views Asked by At

I am trying to build and publish my ASP.NET MVC3 project. I am trying to achieve Web.Release.config transformation using using the MSBuild method

I have used the following msbuild command to do the same : msbuild

 /p:OutDir=..\publish\;Configuration=Release;UseWPP_CopyWebApplication=True;PipelineDependsOnBuild=False DeployMVCApp.csproj

I saw the solution given in _CopyWebApplication with web.config transformations. I am using the same commands as mentioned there but the build fails while trying to publish the website. I am copy pasting the error :

>       "C:\Users\anirban\Documents\Visual Studio 2010\Projects\DeployMVCApp\DeployMVCApp\DeployMVCApp.csproj" (default
> target) (1) ->    "C:\Users\anirban\Documents\Visual Studio
> 2010\Projects\DeployMVCApp\DeployMVCAp p\DeployMVCApp.csproj"
> (ResolveReferences;_CopyWebApplication target) (1:2) ->
> "C:\Users\anirban\Documents\Visual Studio
> 2010\Projects\DeployMVCApp\DeployMVCAp p\DeployMVCApp.csproj"
> (ResolveReferences;_CopyWebApplication target) (1:3) ->  
> c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(214,9)
> : error MSB4184: The expression
> "[System.IO.Path]::GetFullPath(C:\Users\anirban\ Documents\Visual
> Studio
> 2010\Projects\DeployMVCApp\DeployMVCApp\\C:\Users\anirban\Documents\Visual
> Studio 2010\Projects\DeployMVCApp\DeployMVCApp\\..\publish\) " cannot
> be evaluated. The given path's format is not supported.
> [C:\Users\anirban\Documents\Visual Studio
> 2010\Projects\DeployMVCApp\DeployMVCApp\DeployMVCApp .csproj]

Can anyone let me know where I am going wrong?

1

There are 1 best solutions below

0
On

Look at the path in error :

C:\Users\anirban\ Documents\Visual Studio 2010\Projects\DeployMVCApp\DeployMVCApp\C:\Users\anirban\Documents\Visual Studio 2010\Projects\DeployMVCApp\DeployMVCApp\..\publish\

If you want to generate your package when you build in release mode, edit your csproj file, and search for :

<Target Name="AfterBuild">
</Target>

And update it to :

<Target Name="AfterBuild" Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' AND $(FirstRun) != 'false'">
    <MSBuild Projects="$(ProjectPath)" Properties="FirstRun=false;Configuration=Release;PipelineDependsOnBuild=False;UseWPP_CopyWebApplication=True;WebProjectOutputDir=$(ProjectDir)..\Output\$(ProjectName);OutDir=$(ProjectDir)bin\" Targets="ResolveReferences;_CopyWebApplication" />
</Target>