1

So I made a C# project in visual studio with 3 class library projects. Everything works fine when debugging but When I try to deploy. Database and Program installs just fine but when I try to open the Application, I get an Assembly or File not Found Exception. The DLL he can't find is a class library in my project.

On the File System Editor, VS automatically detected the dependencies and included the 3 dll files in to application directory. I tried excluding these dll's and just adding the class library projects's primary output's (Same dll) but still the same error.

I used a Custom Installer class for creating my database on installation. But I don't think that is relevant.

dotNes
  • 75
  • 3
  • 10

2 Answers2

2

If you have verified that your 3 assemblies are indeed deployed to your destination folder, it could very well be an another dependency that you have not included in your setup project.

  • Please double check that you indeed have the right number of assemblies included.
  • You can also right click the setup project and refresh dependencies.
  • Have you checked that dependencies in the setup project aren't excluded (by mistake)?
  • Furthermore, it may also be a .NET profile issue. Do you depend on assemblies that are only available in the full .NET profile, and your destination only has the client profile installed?

In worst case, run the SysInternals process monitor and that way figure out which assembly is missing.

Magnus Johansson
  • 28,010
  • 19
  • 106
  • 164
  • Indeed it was the SMO assembly that I was missing and that caused the error. Thank you very much! – dotNes Mar 01 '12 at 18:15
  • Is it possible though to just put the dll's in a folder like bin and expect that everything will work without further changes ? – dotNes Mar 01 '12 at 18:17
  • I'm not exactly sure what you mean, but you can certainly add files manually in the setup project. Right click the destination app folder, select add file (or assembly), and add as many as you wish. – Magnus Johansson Mar 01 '12 at 18:18
1

you need to include all dll's that are not part of the .net framework with your deployable. Your custom installer will copy these files to the location of the executable on install.

i usually create a folder called /deploy and copy all my needed dlls in there. I also change my projects settings to output to the /deploy-directory (instead of bin/). after you build, this directory will contain all dll's and other resources needed to run the application.

mindandmedia
  • 6,800
  • 1
  • 24
  • 33