How do I register a non-strong name assembly for download as if it were in the GAC?

One of our partners provided us with the assembly we needed to access from our application. Unfortunately, this is not a strong name, so we cannot install it in the GAC. And we cannot place it in the same place as our executable file.

Is there a solution for this?

EDIT: this will be a temporary solution only for testing, when they go to RC, we will have a strong team.

+4
source share
3 answers

You have several options at this point.

First, place the assembly in a directory with the name of the assembly (without extension), which is a subdirectory of the application directory .

Secondly, you need to specify the subdirectory that you want the CLR to check the links in the app.config file with the Load methods in the Assembly class , but I would say that it is a very bad idea if you have an assembly and you have There are specific types that you want to use in it. A sequential assembly assembly like this one is usually used when you want to sign an implementation of certain abstractions, which seems not to be here.

+5
source

Workaround using decompilation and signature (using the Developer Command for Visual studio command):

ildasm.exe /all /typelist /out=DataSystem.il DataSystem.dll ilasm.exe /dll /optimize /key=DataSystem.snk DataSystem.il 

DataSystem.snk can be generated as a file using the Visual Studio IDE http://www.bloggedbychris.com/2011/09/29/signing-a-net-assembly-in-visual-studio/

then you can run

 gacutil.exe -i DataSystem.dll 
+3
source

Another solution is to add the following to the machine.config file:

 <runtime> <developmentMode developerInstallation="true"/> </runtime> 

And add DEVPATH = path to the system environment variables.

0
source

Source: https://habr.com/ru/post/1301714/


All Articles