1

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?

sgarcia.dev
  • 5,671
  • 14
  • 46
  • 80

1 Answers1

0

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.

floppy12
  • 1,045
  • 6
  • 12