什么是正确的方法precompile一个ASP.Net MVC 2应用程序? [英] What is the correct way to precompile an ASP.Net MVC 2 application?

查看:81
本文介绍了什么是正确的方法precompile一个ASP.Net MVC 2应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是正确的方法precompile从Visual Studio 2010的ASP.Net MVC 2应用程序?

What is the correct way to precompile an ASP.Net MVC 2 application from Visual Studio 2010?

我使用asp.net 3.5,并尝试使用后生成事件。

I am using asp.net 3.5, and trying to use the post build event.

我使用这一点;

C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler -v / -p "$(ProjectDir)"

但它给我上PROJECTDIR无效路径错误。

but it gives me an invalid path error on the ProjectDir.

更新:我改变了$(PROJECTDIR),以$(PROJECTDIR)\\,它现在给了我这个错误;

UPDATE: I changed "$(ProjectDir)" to $(ProjectDir)\ and it now gives me this error;

这是使用注册为allowDefinition =应用程序级别之外'MachineToApplication'的节是错误的。这个错误可以通过未被配置为在IIS中应用程序的虚拟目录引起的。

"It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS. "

感谢

推荐答案

我不得不去的几个不同的问题和固定它们。

I had a few different issues going on and fixed them.


  1. 我在帖子中使用此版本;

  1. I used this in my Post Build;

C:\\ WINDOWS \\ Microsoft.NET \\框架\\ V2.0.50727 \\ aspnet_compiler -p$(PROJECTDIR)。 -v / D:\\工作\\ VSP \\部署

C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler -p "$(ProjectDir)." -v / D:\Work\VSP\deploy

然后我得到奇怪的错误,当它试图编译我的aspx页面。事实证明,我在我的项目举行了一些我的网页原件进行了持有的文件夹。编译器试图编译它们甚至thorugh我没有需要他们。删除这些文件后一切正常。

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.

这篇关于什么是正确的方法precompile一个ASP.Net MVC 2应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆