VS2012:我的实体框架模型不包括在我的项目输出使用InstallShield [英] VS2012: My Entity Framework model doesn´t get included to my project output using InstallShield

查看:150
本文介绍了VS2012:我的实体框架模型不包括在我的项目输出使用InstallShield的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我被要求为Windows Forms应用程序创建一个安装程序,该应用程序使用Entity Framework来连接数据库。我修改了我的程序来创建数据库,如果它不存在于最终用户的计算机上,所以它应该没有问题。问题是,我在Visual Studio 2012中使用installshield,在构建我的安装程序后,安装目录中只生成了两个文件:



MyProgram.exe& MyProgram.exe.config



问题是,我相信一个 EntityFramework.dll 文件也应该包含在程序中,但显然, Visual Studio不想包含它。我试过一切我单击了EF模型的属性,并选择了复制到输出或复制如果较新,没有任何内容。我也尝试更改我的.edmx文件的属性,在那里我切换构建操作:无构建操作:编译...但之后,我的整个程序甚至不会建立!它抛出以下错误:

 命名空间不能直接包含诸如字段或方法之类的成员

双击错误后,检查它发生的位置,它以代码打开EDMX文件,显然希望我在开始它...但是这整个事情看起来像是XML ...所以为什么要问我一个命名空间?



我所要做的就是添加我的实体框架模型到我的主要输出,但没有任何作用。或者它至少不会出现在installshield中。我知道我可以从我的项目/ bin中的调试或释放文件夹手动添加EntityFramework.dll文件,但是感觉不对。我应该这样做,还是有原因,我的实体模型没有被添加到我的项目输出?或者为什么我的EDMX文件扔了一个命名空间的错误,当我尝试从无编译选项转换编译器



请帮助...我知道这是一个愚蠢的错误,但我只想要的是,我的实体模型需要在另一台PC上工作的文件被复制(据我所知,我需要的是EntityFramework.dll,也许是EntityFramework.xml)。帮助?

解决方案


所有我想要做的是将我的实体框架模型添加到我的主要
输出,但无效。或者它最不出现在$ $ $ $ $ $ $ $我知道我可以手动添加EntityFramework.dll文件从
我的项目/ bin中的调试或发布文件夹,但那只是没有
感觉正确


在您的installshield项目(当然与您的项目相同的解决方案中),您应该确实看到其依赖的项目的primary.output。如果没有,请右键单击IS项目 - >项目依赖关系 - >并手动检查。



从te IS项目树中,可以在2中指定应用程序数据 - >文件,其中zou可以指定安装目录的物理组织和内容。



在.primary.output - >右键单击 - 依赖从扫描在构建 - >你应该看到所有自动检测到的依赖项的列表,启用/禁用你想要的...它为我工作这样。请注意,以前需要构建。



如果列表中不存在dll,您还可以将其放在左侧的安装目录树中,文件将也被嵌入。


I was recently asked to create an installer for a Windows Forms application that uses Entity Framework to comunicate to a database. I modified my program to create the database if it doesn't exist on the final user's computer, so it should work without problems. Problem is, I'm using installshield for Visual Studio 2012, and after building my installer, only 2 files were generated inside the install directory:

MyProgram.exe & MyProgram.exe.config

Problem is, I believe a EntityFramework.dll file should also be included for the program to work, but apparently, Visual Studio doesn't want to include it. I tried everything. I clicked on the properties of the EF model and selected the "Copy to Output" or "Copy if Newer", and nothing. I also tried to change my .edmx file´s properties where I switched Build Action: None to Build Action: Compile...but after that, my whole program wouldn't even build! It threw the following error:

A namespace cannot directly contain members such as fields or methods   

And after double clicking the error to check where it happened, it opened the EDMX file in code, and apparently wanted me to add a namespace at the start of it...but this whole thing looks like XML...so why does it ask me for a namespace?

All I want to do is add my Entity Framework Model to my Primary Output, but nothing works. Or it doesn't appear in installshield at least. I know I can manually add "EntityFramework.dll" the file from the debug or release folder in my project/bin, but that just doesn't feel right. Should I just do that, or is there a reason why my Entity model isn't being added to my project output? Or why did my EDMX file threw a namespace error when I tried to switch the compile option from None->Compile???

Please help guys...I know it's a dumb mistake, but all I want is that the files required for my entity model to work on another PC be copied (As far as I know, all I need is that EntityFramework.dll and maybe EntityFramework.xml). Help?

解决方案

All I want to do is add my Entity Framework Model to my Primary Output, but nothing works. Or it doesn't appear in installshield at least. I know I can manually add "EntityFramework.dll" the file from the debug or release folder in my project/bin, but that just doesn't feel right

In your installshield project (certainly in the same solution as your project), you should indeed see the primary.output of the project it depends on. If not, right click on IS project -> Project dependencies -> and check manually.

From te IS project tree, it is available in the "2) Specify your application data" -> "Files" where zou can specify the physical organisation and content of your installation directory.

On .primary.output -> right click -> dependencies from scan at build -> You should see a list of all auto-detected dependencies, enable/disable what you want... it works this way for me. Note that a build is required previously.

If the dll is not present in the list, you could also drop it in the installation directory tree on the left and the file will be embedded too.

这篇关于VS2012:我的实体框架模型不包括在我的项目输出使用InstallShield的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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