自动生成的"App_Web ********.cs"临时目录中的文件导致生成错误 [英] Auto-generated "App_Web********.cs" files in temp directory causing build errors

查看:89
本文介绍了自动生成的"App_Web ********.cs"临时目录中的文件导致生成错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以这一直困扰着我一段时间,但是有时在我的Visual Studio 2013 ASP.NET MVC4项目中,我将删除一个未使用的ViewModel类,并在下一个看起来像这样的下一次编译时得到一个错误(对于我刚刚删除的名为"MostRecentMemberListing.cs"的ViewModel):

So this has been bugging me for a while, but sometimes in my Visual Studio 2013 ASP.NET MVC4 project, I will delete an unused ViewModel class, and will get an error on the next compile that looks like this (for a ViewModel called "MostRecentMemberListing.cs" that I just deleted):

错误9类型或名称空间名称'MostRecentMemberListing'不存在 存在于命名空间"MembershipCenter.ViewModels"中(是否丢失了 大会 参考?)c:\ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ Temporary ASP.NET Files \ temp \ 3e932790 \ 42b7ff67 \ App_Web_cvlbfbci.1.cs 29 MembershipCenter

Error 9 The type or namespace name 'MostRecentMemberListing' does not exist in the namespace 'MembershipCenter.ViewModels' (are you missing an assembly reference?) c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\temp\3e932790\42b7ff67\App_Web_cvlbfbci.1.cs 29 MembershipCenter

如果我在VS的错误列表"面板中双击错误,它将打开位于以下路径的文件:C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\temp\3e932790\42b7ff67,它是系统生成的视图文件(?),其类名为.

If I double-click the error in the "Error List" panel of VS, it opens a file located in this path: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\temp\3e932790\42b7ff67, which is a system-generated view file(?) with a classname of _Page_Views_Home_MostRecentMember_cshtml.

我尝试删除奇怪的文件本身,其包含的文件夹以及ITS包含的文件夹,一直删除到Temporary ASP.NET Filestemp文件夹的路径.但是每次我重新编译项目时,所有这些文件夹和文件都直接在其中重新创建,并且遇到相同的编译错误.

I've tried deleting the weird file itself, as well as its containing folder, and ITS containing folder, all the way up the path to the temp folder under Temporary ASP.NET Files. But everytime I re-compile my project all those folders and files are re-created in that directly and I get the same compile error.

我正在编译时通过项目文件中的<MvcBuildViews>true</MvcBuildViews>构建我的视图.如果关闭此设置,则可以正常构建+运行,但是当我将其重新设置为true时,将返回构建错误.

I am building my Views during the compilation, via <MvcBuildViews>true</MvcBuildViews> in the project file. If I turn this setting off, I can build + run just fine, but when I turn it back to true, the build error returns.

以前有人遇到过此错误吗?与IIS有关吗?我正在运行本地IIS,而不是IIS Express.

Has anyone encountered this error before? Is it related to IIS? I am running Local IIS, not IIS Express.

推荐答案

这与IIS(本地或其他方式)无关.您所看到的那个长而奇怪的文件名就是编译器在编译时给视图的名称.您所描述的一切都告诉您,您的其中一个视图中存在编译错误.可能是HTML标签不匹配,模型属性调用错误等.

This is not related to IIS, local or otherwise. That long, strange file name you are seeing is the name the compiler gives to a view when it compiles it. What everything you have described is telling you is that you have a compilation error in one of your views. It could be mismatched HTML tags, a bad model property call, etc.

查看您的错误消息,您在/Views/Home/MostRecentMember.cshtml中有一个视图.此外,似乎您确实是在模型声明中缺少名称空间,或者在您尝试发送的模型中声明了错误的名称空间.

Looking at your error message, you have a view in the /Views/Home/MostRecentMember.cshtml. Further, it appears that you are indeed either missing the namespace for your model declaration or declared the wrong namespace for the model that you are trying to send in.

删除文件名奇怪的东西不会像重建时那样做,它会回来,很可能使用不同的名称.

Deleting the strangely named file will do nothing as when you rebuild, it will come back, most likely with a different name.

这篇关于自动生成的"App_Web ********.cs"临时目录中的文件导致生成错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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