我正在尝试构建和发布我的 ASP.NET MVC3项目。我正在尝试使用 MSBuild 方法实现 Web.Release.config 转换
我使用以下 msbuild 命令来做同样的事情:
/p:OutDir=..publish;Configuration=Release;UseWPP_CopyWebApplication=True;PipelineDependsOnBuild=False DeployMVCApp.csproj
我看到了 _CopyWebApplication 中给出的带有 web.config 转换的解决方案。我正在使用与那里提到的相同的命令,但在尝试发布网站时构建失败。我正在复制粘贴错误:
> "C:UsersanirbanDocumentsVisual Studio 2010ProjectsDeployMVCAppDeployMVCAppDeployMVCApp.csproj" (default
> target) (1) -> "C:UsersanirbanDocumentsVisual Studio
> 2010ProjectsDeployMVCAppDeployMVCAp pDeployMVCApp.csproj"
> (ResolveReferences;_CopyWebApplication target) (1:2) ->
> "C:UsersanirbanDocumentsVisual Studio
> 2010ProjectsDeployMVCAppDeployMVCAp pDeployMVCApp.csproj"
> (ResolveReferences;_CopyWebApplication target) (1:3) ->
> c:WindowsMicrosoft.NETFrameworkv4.0.30319Microsoft.Common.targets(214,9)
> : error MSB4184: The expression
> "[System.IO.Path]::GetFullPath(C:Usersanirban DocumentsVisual
> Studio
> 2010ProjectsDeployMVCAppDeployMVCApp\C:UsersanirbanDocumentsVisual
> Studio 2010ProjectsDeployMVCAppDeployMVCApp\..publish) " cannot
> be evaluated. The given path's format is not supported.
> [C:UsersanirbanDocumentsVisual Studio
> 2010ProjectsDeployMVCAppDeployMVCAppDeployMVCApp .csproj]
谁能让我知道我哪里出错了?
查看错误的路径:
C:\Users\anirban\ Documents\Visual Studio 2010\Projects\DeployMVCApp\DeployMVCApp\C:\Users\anirban\Documents\Visual Studio 2010\Projects\DeployMVCApp\DeployMVCApp\..\发布\
如果要在发布模式下生成包,请编辑 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>