.NET stand alone executable

╄→尐↘猪︶ㄣ 提交于 2019-12-13 02:37:29

问题


I'm using C# Express 2010. I made a WPF application with free VIBlend Edit controls, these controls uses the corresponding dlls, is it possible to create a stand alone executable? I want to copy only the exe to another machine (the framework is installed of course), but I don't want to copy the dll!


回答1:


Try using ILMerge




回答2:


ILMerge

Here are a couple of resources regarding ILMerge that you might find helpfull:

  • Merging .NET assemblies using ILMerge
  • When & How to use ILMerge
  • ILMerge Tasks for NAnt & MSBuild

Using GAC

What you can do is have the DLL's registered in the Global Assembly Cache ( GAC ) on the client machine, this way it could use the assemblies from there.

But they would have to be installed into GAC.

Edit

It seems like I was wrong, however I would strongly advice against including third party dll's into one executable because it might not be allowed by the license aggreement.




回答3:


Not really unless you have the source code to the library and then are willing to spend the time to resolve all the problem you will have when you merge the code into your executable assembly.

If you use a product to merge assemblies (such as SmartAssembly) then you can merge it all into one EXE, but SmartAssembly is not free. (It's a great product, though, that does much more than just merging assemblies)




回答4:


3rd option (from the two already mentioned) is to package the whole thing into an installer (MSI). This would still require the DLLs be somewhere (either in the app folder or GACd), but it presents to the client in a more controlled manner. They just install the package.




回答5:


.NET supports this out of the box. See this guide how to.



来源:https://stackoverflow.com/questions/5017213/net-stand-alone-executable

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