C# model.context.cs的内容总是为我创建的每个模型生成错误输出
将C#/MVC/Entity框架与Visual Studio for Web 2013 Express结合使用 对于我创建的每个模型,C# model.context.cs的内容总是为我创建的每个模型生成错误输出,c#,asp.net-mvc,entity-framework,visual-studio,C#,Asp.net Mvc,Entity Framework,Visual Studio,将C#/MVC/Entity框架与Visual Studio for Web 2013 Express结合使用 对于我创建的每个模型,.Context.cs始终只是“ErrorGeneratingOutput” 这将导致以下错误: Error 1 A namespace cannot directly contain members such as fields or methods C:\[..]\Part Compare\Models\Parts.Context.cs 1
.Context.cs
始终只是“ErrorGeneratingOutput”
这将导致以下错误:
Error 1 A namespace cannot directly contain members such as fields or methods C:\[..]\Part Compare\Models\Parts.Context.cs 1 1 Part Compare
我在创建模型时也会遇到以下错误:
Error 2 Compiling transformation: Metadata file 'D:\Microsoft Visual Studio 12.0\Common7\Tools\..\IDE\EntityFramework.dll' could not be found C:\[..]\Part Compare\Models\Parts.tt 1 1 Part Compare
Error 3 Compiling transformation: Metadata file 'D:\Microsoft Visual Studio 12.0\Common7\Tools\..\IDE\Microsoft.Data.Entity.Design.dll' could not be found C:\[..]\Part Compare\Models\Parts.tt 1 1 Part Compare
我尝试过通过Nuget重新安装实体框架,从不同的来源创建模型,等等
似乎没有什么能解决它。我不同意可能的重复。你的链接完全不同——Unity中的游戏开发(显然)与VS中的实体框架问题相反。此外,错误/问题不同,解决方案不适用。如果您不同意,请回答为什么,否则,任何其他想法/可能的重复都非常感谢,因为我仍在努力解决这个问题。谢谢,“复制”显示了可能导致此错误的代码类型。这可能会给你一个暗示。我们看不到你的代码,所以对我们来说它可以是任何东西。我还没有任何代码。任何新项目都会发生这种情况。我已经深入研究了它,显然我需要将Entity Framework降级到版本5,但是Microsoft.AspNet.Identity.EntityFramework依赖于EF6。有什么想法吗?很抱歉,我没有提供详细信息,我对Visual Studio for Web/ASP.Net/etc还是有点陌生。生成的代码一定是在什么地方出错了。试着找个地方。编译器应该向您显示错误的来源。