我正在尝试构建和发布我的ASP.NET MVC3项目。我正在尝试使用MSBuild方法实现Web.Release.config转换
我使用了以下msbuild命令来执行相同的操作:msbuild
/p:OutDir=..\publish\;Configuration=Release;UseWPP_CopyWebApplication=True;PipelineDependsOnBuild=False DeployMVCApp.csproj
我在_CopyWebApplication with web.config transformations中看到了解决方案。我使用的是与那里提到的相同的命令,但是在尝试发布网站时构建失败了。我复制粘贴错误:
> "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]
任何人都可以告诉我哪里出错了吗?
答案 0 :(得分:1)
查看错误的路径:
C:\ Users \ anirban \ Documents \ Visual Studio 2010 \项目\ DeployMVCApp \ DeployMVCApp \ C:\用户\ anirban \文档\ Visual Studio 2010 \ Projects \ DeployMVCApp \ DeployMVCApp \ .. \ publish \
如果要在构建发布模式时生成程序包,请编辑csproj文件,然后搜索:
<Target Name="AfterBuild">
</Target>
并将其更新为:
<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>