A
Yes, I can. A dependent library can be built into resources and manually downloaded.
Your library is already in the Project References, the project is about to go, the program is successfully launched.First, add a library to the project as a resource:Menu Project - Main Add Existing Item... - select your collection (dll, in the opening dialogue, select the type of Executable Files files). The library will be on the list of project files.Call the context menu on the added file, pick Properties. Then set up in the open window Build Actions - Royal Embedded Resource.Add the following class to your project:public static class Resolver
{
private static volatile bool _loaded;
public static void RegisterDependencyResolver()
{
if (!_loaded) {
AppDomain.CurrentDomain.AssemblyResolve += OnResolve;
_loaded = true;
}
}
private static Assembly OnResolve(object sender, ResolveEventArgs args)
{
Assembly execAssembly = Assembly.GetExecutingAssembly();
string resourceName = String.Format("{0}.{1}.dll",
execAssembly.GetName().Name,
new AssemblyName(args.Name).Name);
using (var stream = execAssembly.GetManifestResourceStream(resourceName)) {
int read = 0, toRead = (int)stream.Length;
byte[] data = new byte[toRead];
do {
int n = stream.Read(data, read, data.Length - read);
toRead -= n;
read += n;
} while (toRead > 0);
return Assembly.Load(data);
}
}
}
This class will download a dependent resource collection as soon as the main programme
They'll use the processor. https://msdn.microsoft.com/en-us/library/system.appdomain.assemblyresolve(v=vs.110).aspx ♪In the class where the programme entrance point is located, add the static designer and call the method. RegisterDependencyResolver♪
For example, if you have a console application:class Program
{
static Program()
{
Resolver.RegisterDependencyResolver();
}
static void Main(string[] args)
{
// ...
}
}
You don't have to take care of the assembly, because it's still not possible.The example is in J. Richter's book CLR via C#.