ASP.NET MVC 3.0创建视图为64位 [英] ASP.NET MVC 3.0 Build Views as 64 bit

查看:108
本文介绍了ASP.NET MVC 3.0创建视图为64位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要建立一个MVC 3.0站点和目标明确的x64。我在试图建立我的MVC 3.0站点设置为x64和设置为True MvcBuildViews平台目标的问题。直到它试图编译的意见都建立罚款。如果我设定的目标平台,以值为anycpu一切都将编译,但设置到x64,当我得到这个错误:

I need to build an MVC 3.0 site and target x64 specifically. I'm having an issue trying to build my MVC 3.0 site with the Platform Target set to x64 and MvcBuildViews set to True. Everything builds fine until it tries to compile the views. If I set the Platform Target to AnyCPU everything will compile, but when set to x64 I get this error:

无法加载文件或程序集Mvc64Bit或它的一个依赖。试图加载程序格式不正确。

Could not load file or assembly 'Mvc64Bit' or one of its dependencies. An attempt was made to load a program with an incorrect format.

这可以很容易地创建一个空白MVC 3.0项目重新创建,卸载该项目,编辑项目文件设置MvcBuildViews项目为true,重新加载项目,在项目的生成属性更改目标平台到x64,再建。

This can easily be recreated by creating a blank MVC 3.0 project, unload the project, edit the project file to set the MvcBuildViews item to "true", reload the project, change the Platform Target in the Project's Build Properties to x64, and then build.

我一直没能在网上找到关于上述错误什么,只是它不匹配的DLL(一个X32,一是x64)的交易,但除非该视图生成引擎是32位还是这个东西没有意义。

I haven't been able to find anything about the above error online, just that it deals with mismatched DLLs (one x32, one x64) but this doesn't make sense unless the view build engine is 32 bit or something.

任何提示点我在正确的方向将大大AP preciated。感谢您阅读!

Any hints to point me in the right direction will be GREATLY appreciated. Thanks for reading!!

推荐答案

我从微软对这个问题的回应。我猜是什么情况是,Visual Studio中调用32位编译器编译网站建成一个64位的DLL。在此之后,它再次调用32位编译器的看法。视图编辑器需要加载64位Web项目的DLL来从定义模型的信息。这就是不正确的格式用武之地32位编译器尝试加载64位Web项目的DLL。

I got a response from Microsoft on this issue. I guess what is happening is that Visual Studio calls a 32-bit compiler that compiles the website into a 64 bit DLL. After that, it calls the 32-bit compiler again for the views. The view compilation needs to load the 64 bit Web project DLLs to get information from the defined models. This is where the "Incorrect format" comes in. The 32 bit compiler tries to load the 64 bit Web project DLLs.

现在,调用从Visual Studio命令提示符的64位aspnet_compiler.exe完美的作品。但是,我想,因为Visual Studio是一个32位应用程序,它无法加载64位编译器。我不知道任何方式来调用64位的,即使有一个方法时,Visual Studio可能不能给通常不会出错的漂亮列表(只是一个假设有,因为我不知道该怎么视觉工作室调用编译器...一个简单的命令行执行工作,但也许它实际上加载DLL,并从VS code里面调用)

Now, calling the 64 bit aspnet_compiler.exe from the Visual Studio Command Prompt works perfectly. But, I guess, since Visual Studio is a 32 bit application, it can't load the 64 bit compiler. I'm not sure of any way to call the 64 bit, and even if there was a way, Visual studio probably couldn't give the nice list of errors that typically does (just an assumption there as I don't know how Visual Studio calls the compiler...a simple command line execution works, but maybe it actually loads the DLL and calls from inside the VS code)

所以,我周围的工作是把物业内MVCBuildViews =真正的声明。后来我把MVCBuildViews = FALSE在释放|值为anycpu'的PropertyGroup,我只是让IIS编译意见时,该网站首次加载。这不是$ P $完全pcompiling,但它会奏效。

So, my work around was to put the MVCBuildViews=true declaration inside the property. I then put MVCBuildViews=false in the 'Release|AnyCPU' propertyGroup and I just let IIS compile the views when the site first loads. It's not precompiling completely, but it will work.

这篇关于ASP.NET MVC 3.0创建视图为64位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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