How to embed .NET modules into an independent assembly?
I'm trying to automate assembly generation from netmodules. I tried to use "al.exe" tool with this commande line : al module1.netmodule module2.netmodule /target:library /out:assembly.dll. My problem is that my assembly does not embed my netmodules but only references them : - if I open my assembly with "ildasm.exe" tool, I can only see the manifest - if I import my assembly in a new Visual Studio project, it does not work unless I copy the two netmodules beside the assembly
I tried the "ILMerge" tool, it seems to work fine on my simple example : the "ildasm.exe" tool shows the right classes and the assembly can be used in a Visual Studio project. But there are limitations (WPF) I fear to face further in my project.
My questions are : - Is there a way to produce an independant assembly from netmodules using "al.exe" or "csc.exe" ? - How to really embed netmodules into an assembly and not only reference them ? - Do I have to use "ILMerge.exe" ? - What is the real use of "al.exe" ? Can't "csc.exe" do the 开发者_如何学Pythonsame using the "/addmodule" option ?
Have you tried Link.exe - it will do the job. You can find more details about the linker here:
http://msdn.microsoft.com/en-us/library/y0zzbyt4(v=vs.71).aspx
The Link tool is installed as part of Visual Studio. In my machine Link.exe is installed at: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64
The command structure that works for me is shown below:
LINK = "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\Link.exe"
LIBPATH1 = "$(PROGRAMFILES)\Microsoft Visual Studio 8\SDK\v2.0\lib"
LIBPATH2 = "$(PROGRAMFILES)\Microsoft SDKs\Windows\v7.0A\Lib"
$(LINK) /LIBPATH:$(LIBPATH1) /LIBPATH:$(LIBPATH2) /DLL /nologo /LTCG /out:$(DLL_NAME).dll $(EXT_MODULE1) $(EXT_MODULE2) $(EXT_MODULE3) ...
精彩评论