.net-assembly

ASP.Net Core register Controller at runtime

☆樱花仙子☆ 提交于 2020-04-07 12:04:33
问题 I am asking myself if it is possible to load a DLL with Controller s in it at runtime and use it. The only solution I've found is to add an assembly via ApplicationPart on the StartUp : var builder = services.AddMvc(); builder.AddApplicationPart( AssemblyLoadContext.Default.LoadFromAssemblyPath( @"PATH\ExternalControllers.dll" )); Do anyone know if it is possible to register Controller at any time, because the issue with that solution is, that you have to restart the WebService when you want

ASP.Net Core register Controller at runtime

不羁的心 提交于 2020-04-07 12:02:50
问题 I am asking myself if it is possible to load a DLL with Controller s in it at runtime and use it. The only solution I've found is to add an assembly via ApplicationPart on the StartUp : var builder = services.AddMvc(); builder.AddApplicationPart( AssemblyLoadContext.Default.LoadFromAssemblyPath( @"PATH\ExternalControllers.dll" )); Do anyone know if it is possible to register Controller at any time, because the issue with that solution is, that you have to restart the WebService when you want

ASP.Net Core register Controller at runtime

故事扮演 提交于 2020-04-07 12:02:07
问题 I am asking myself if it is possible to load a DLL with Controller s in it at runtime and use it. The only solution I've found is to add an assembly via ApplicationPart on the StartUp : var builder = services.AddMvc(); builder.AddApplicationPart( AssemblyLoadContext.Default.LoadFromAssemblyPath( @"PATH\ExternalControllers.dll" )); Do anyone know if it is possible to register Controller at any time, because the issue with that solution is, that you have to restart the WebService when you want

Visual Studio asks me to reference a nonexistent assembly

爱⌒轻易说出口 提交于 2020-02-03 03:16:45
问题 I somehow brought my project to a state where Visual Studio 2013 fails to compile it with a ridiculous error: The type 'System.Collections.Generic.Dictionary`2' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Collections, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. First of all, there is no such assembly, it does not exist . Second, Dictionary<TKey, TValue> is defined in mscorlib.dll , which is referenced by default, of

Visual Studio asks me to reference a nonexistent assembly

蓝咒 提交于 2020-02-03 03:16:26
问题 I somehow brought my project to a state where Visual Studio 2013 fails to compile it with a ridiculous error: The type 'System.Collections.Generic.Dictionary`2' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Collections, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. First of all, there is no such assembly, it does not exist . Second, Dictionary<TKey, TValue> is defined in mscorlib.dll , which is referenced by default, of

Asp.net Core Load Assembly

ⅰ亾dé卋堺 提交于 2020-02-02 12:12:46
问题 I am tring to load some .dll files from a folder: var fileNames = Directory .GetFiles(path, "*.dll", searchOption); var assemblyNames = fileNames .Select(AssemblyLoadContext.GetAssemblyName); List<Assembly> assemblies = new List<Assembly>(); foreach (AssemblyName assemblyName in assemblyNames) { assemblies.Add(Assembly.Load(assemblyName)); } But somehow the assembly cannot be loaded: FileNotFoundException, Could not load file or assembly [...] The system cannot find the file specified. How is

Can I use Activator.CreateInstance with an Interface?

我只是一个虾纸丫 提交于 2020-01-29 06:15:54
问题 I have an example: Assembly asm = Assembly.Load("ClassLibrary1"); Type ob = asm.GetType("ClassLibrary1.UserControl1"); UserControl uc = (UserControl)Activator.CreateInstance(ob); grd.Children.Add(uc); There I'm creating an instance of a class, but how can I create an instance of a class which implements some interface? i.e. UserControl1 implements ILoad interface. U: I can cast object to interface later, but I don't know which type in the assemblies implements the interface. 回答1: This is some

Can someone explain me the functionality of the Assembly Class to me?

五迷三道 提交于 2020-01-24 00:19:53
问题 I want to Load and Create Assemblies during runtime and someone told me to use the Namespace System.Reflection.Assembly and System.Reflection.Emit. Only reference I found was on the msdn, but it´s not as good to work with it when you don´t know where and how to start. I already googled but I didn´t find any useful tutorials/samples/references. Can someone explain the functionality to me or give me some samples/tutorials? 回答1: http://msdn.microsoft.com/en-us/library/saf5ce06.aspx public static

migrate.exe ignoring binding redirects

浪尽此生 提交于 2020-01-22 20:06:09
问题 I am trying to run the migrate.exe application from EntityFramework on a specific DLL. This DLL references the Microsoft.Azure.KeyVault.WebKey nuget package. When I try to run the command ./migrate MyProject.Data /startUpDirectory=C:\myDir /startUpConfigurationFile=C:\myDir\Redirect.config I get the following error ERROR: Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6ae ed' or one of its dependencies. The located assembly's

Deserialization problem: Error when deserializing from a different program version

自古美人都是妖i 提交于 2020-01-17 02:53:30
问题 I finally decided myself to post my problem, after a couple of hours spent searching the Internet for solutions and trying some. [Problem Context] I am developing an application which will be deployed in two parts: an XML Importer tool: its role is to Load/Read an xml file in order to fill some datastructures, which are afterwards serialized into a binary file. the end user application: it will Load the binary file generated by the XML Importer and do some stuff with the recovered data