Assembly Not Found on deployment of C# project

本秂侑毒 提交于 2020-01-06 01:51:12

问题


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.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/9521450/assembly-not-found-on-deployment-of-c-sharp-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!