实体框架引用在调试和发布版本之间丢失 [英] Entity Framework References go missing between debug and release build

查看:128
本文介绍了实体框架引用在调试和发布版本之间丢失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在调试版本和发行版本以及引用的使用之间,区别在于一些我不明白的东西。我正在使用Entity Framework 6连接到以前设置的数据库。我可以在调试模式下成功构建和运行项目。如果我将其更改为释放模式,我马上得到构建错误,指出只有在那里的命名空间和类型不能再被找到。我检查了,据我所知,我们可以告诉他们两个目标框架.Net 4.5,我看到的可能是一些其他人的问题。我在解决方案资源管理器中的参考资料中没有任何区别。



我正在使用visual studio 2013,很高兴提供任何代码,但是我不知道将是最相关的。



我遇到的一些错误:

 在Holds.Context.cs 
中的名称空间System.Data中不存在类型或命名空间名称Entity(您缺少程序集引用?)类型或命名空间名称DbContext在Holds.Context.cs
中找不到(您是否缺少using指令或程序集引用?)找不到类型或命名空间名称DbSet(您是否缺少using指令或程序集引用? )在Holds.Context.cs

感谢任何可以提供的指导。

解决方案

切换到发布模式,然后在问题项目上重新安装实体框架,在我的情况下修复了这个问题。


There must be something that I don't understand in the difference between debug builds and release builds and its use of references. I'm using Entity Framework 6 to connect to a database that has previously been set up. I am able to successfully build and run the project while it is in Debug mode. If I change it to release mode I instantly get build errors indicating that the namespaces and types that were just there can no longer be found. I checked and as far as I can tell they both target framework .Net 4.5 which I saw may have been an issue for some other people. I see no difference in what is listed under references in my solution explorer.

I'm using visual studio 2013. Happy to provide any code but I don't know what would be most relevant.

Some of the errors that I'm getting:

The type or namespace name 'Entity' does not exist in the namespace    System.Data' (are you missing an assembly reference?) in Holds.Context.cs
The type or namespace name 'DbContext' could not be found (are you missing a using directive or an assembly reference?) in Holds.Context.cs
The type or namespace name 'DbSet' could not be found (are you missing a using directive or an assembly reference?) in Holds.Context.cs 

Thanks for any guidance that can be provided.

解决方案

Switching to release mode then re-installing entity framework on the problem project fixed this issue in my case.

这篇关于实体框架引用在调试和发布版本之间丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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