What is the correct way to precompile an ASP.Net MVC 2 application?
What is the correct way to precompile an ASP.Net MVC 2 application from Visual Studio 2010?
I am using asp.net 3.5, and trying to use the post build event.
I am using this;
C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler -v / -p "$(ProjectDir)"
but it gives me an invalid path error on the ProjectDir.
UPDATE: I changed "$(ProjectDir)" to $(ProjectDir)\ and it now gives me this error;
"It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be ca开发者_Python百科used by a virtual directory not being configured as an application in IIS. "
Thanks
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MvcBuildViews>true</MvcBuildViews>
</PropertyGroup>
For more details check this answer.
Start with the absolute path and work from there. What you tried would normally work, although I use the $(SolutionDir)
property, and go from there, as I run this against many different projects.
Here is a list that you may find useful.
Also, I agree with Bugai13. You should upvote/accept answers.
I had a few different issues going on and fixed them.
I used this in my Post Build;
C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler -p "$(ProjectDir)." -v / D:\Work\VSP\deploy
Then I was getting strange errors when it tried to compile my aspx pages. It turns out that I had a "hold" folder in my project to hold original copies of some of my pages. The compiler was trying to compile them even thorugh I didnt need them. After removing those files everything worked fine.
精彩评论