After I found the answer, my last question was about resolving the assembly ( AppDomain.CurrentDomain.AssemblyResolve requesting the assembly <AppName> .resources? ), Now I can embed assembly references in my program, except that some of them does not work.
First of all, I will configure my collector at the first entrance to my Program.cs program
AppDomain.CurrentDomain.AssemblyResolve += AssemblyManager.Instance.Resolver;
Here is my real resolver;
public Assembly Resolver(object sender, ResolveEventArgs args)
{
AssemblyName askedAssembly = new AssemblyName(args.Name);
lock (this)
{
Assembly assembly;
string resourceName = string.Format("Assets.Assemblies.{0}.dll", askedAssembly.Name);
using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
{
if (stream == null)
{
LogManager.Instance.Write(LogMessageTypes.Fatal, string.Format("Can not resolve asked assembly: {0}", askedAssembly.Name));
MessageBox.Show(i18n.CanNotLoadRequiredAssembliesMessage, i18n.CanNotLoadRequiredAssembliesTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
Environment.Exit(-1);
}
byte[] assemblyData = new byte[stream.Length];
stream.Read(assemblyData, 0, assemblyData.Length);
assembly = Assembly.Load(assemblyData);
}
LogManager.Instance.Write(LogMessageTypes.Trace, "Loaded embedded assembly: " + askedAssembly.Name);
return assembly;
}
}
Now my program references these library assemblies.
- Esent.Collections.dll
- Esent.Interop.dll
- HtmlAgilityPack.dll
- Ionic.Zip.Reduced.dll
- System.Windows.Forms.Calendar.dll
- AxInterop.ShockwaveFlashObjects
- Interop.ShockwaveFlashObjects
- irrKlang.NET4.dll
- ikpMP3.dll
- Nini.dll (SOLVED)
; Esent.Collections, Esent.Interop, HtmlAgilityPack, Ionic.Zip.Reduced, System.Windows.Forms.Calendar, AxInterop.ShockwaveFlashObjects, Interop.ShockwaveFlashObjects .
irrKlang.NET.4, Nini ShockwaveFlash, , , .
irrKlang , irrKlang.NET4 ikpMP3.dll, .
Nini.dll VS debug/release, , , ( ).
.
, Marc Gravell , Nini.dll.
irrKlang, irrKlang.NET4.dll - , , ikpMp3.dll - , - irrKlang.NET4.dll , ikpMp3. ?