如何在发布期间使用x64 aspnet_compiler

Mar*_*cin 2 msbuild asp.net-mvc 64-bit publish visual-studio-2012

我有MVC 5应用程序,它使用RazorGenerator.MVC和RazorGenerator.MsBuild.因此我的MvcBuildViews设置为false,因为不再需要它.该应用程序是Visual Studio 2012中的.NET 4.5.

当我使用Web发布工具发布我的应用程序时(右键单击MVC项目 - >发布),我在发布期间使用选项进行预编译.

当我使用任何CPU或x32平台时,一切都运行良好.但是,当我尝试发布x64应用程序时,我遇到了aspnet_compiler的问题.

它始终尝试使用:*C:\ Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe*一个而不是64个版本,因此我的应用程序无法使用x64平台发布.

我找到的唯一可以改变路径的地方是在MvcBuildViews目标下,但是因为它总是对我来说是假的,它永远不会达到这个目标而且不能使用AspNetCompiler ToolPath.

我想知道从哪里(哪个目标文件或任务文件)包含该路径?我搜索了所有我认为无法找到的目标.

Ala*_*SFT 7

对于Visual Studio 2013,可以在此处找到解决方案:配置Visual Studio 2013以允许ASPNETCOMPILER使用x64编译器进行预编译(感谢Nitin)

捷径:

将Project/PropertyGroup xml标记中的以下xml添加到发布配置文件(位于项目的Properties\PublishProfiles目录中).

<AspnetCompilerPath>C:\Windows\Microsoft.NET\Framework64\v4.0.30319</AspnetCompilerPath>
Run Code Online (Sandbox Code Playgroud)


Mic*_*age 7

在您喜欢的文本编辑器中打开项目的csproj文件。

定位:

<MvcBuildViews>true</MvcBuildViews>
Run Code Online (Sandbox Code Playgroud)

在其下面添加以下内容:

<AspNetToolPath Condition=" '$(Platform)' == 'x64'">$(windir)\Microsoft.NET\Framework64\v4.0.30319</AspNetToolPath>
Run Code Online (Sandbox Code Playgroud)

定位:

<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'" >
  <AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
</Target>
Run Code Online (Sandbox Code Playgroud)

修改AspNetCompiler行,如下所示:

<AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" ToolPath="$(AspNetToolPath)" />
Run Code Online (Sandbox Code Playgroud)