I have a strange issue that hopefully someone can help me with. I got a new laptop and I'm trying to publish the same ASP.NET MVC 5 project on the new machine with precompiled views. However, when I do a publish with "Precompile during publishing" option checked, it does not create the precompiled views. Now, if I copy the exact command that it ran and run it in the Command Prompt, the precompiled views are created.
Here's the details. Both machine have Windows 10 Anniversary Update (Version 1607) with Visual Studio 2013 Update 5. Publishing the app on the old machine with the same publish profile generates the precompiled views. On the new machine, publishing from the "Publish Web" dialog runs without errors, but no precompiled views are generated. I then copied this exact command to the Command Prompt that VS used to precompile:
C:\windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v / -p C:\MyApp\obj\Release\AspnetCompileMerge\Source -c C:\MyApp\obj\Release\AspnetCompileMerge\TempBuildDir
When I ran it, it created the precompiled views in the TempBuildDir\bin
directory!
The only difference I can think of between the machines are the Windows Updates.
Any ideas? Thanks.
1 Answers
Answers 1
Do you use the x64 verson of Windows?
Also you can try set $(AspnetCompilerPath) manually:
msbuild.exe /p:AspnetCompilerPath="C:\windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe"
or add it to your project:
<PropertyGroup> <AspnetCompilerPath Condition=" '$(AspnetCompilerPath)'=='' " >C:\windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe</AspnetCompilerPath> </PropertyGroup>
I've made this assumption, because the Microsoft.Web.Publishing.AspNetCompileMerge.targets
file contains the string:
We can't use the in-place aspnet_compiler because it will output to the aspnet temp folder which is only suiteable to run on the current machine.
0 comments:
Post a Comment