Nantes cannot find assembly in PAC

I have a .Net project that uses a MySQL connector that resides in the GAC.

In my Nant build file, there seems to be no way to tell CSC to look in the GAC to find this DLL (or enter information) and my project will not be created.

Is there a way to tell Nantes that this link also exists in Gac.

Its strange indeed because obviously all Microsoft libraries, for example. The "system" is in Gac, and it has no problem building anythign referencing them. I have confirmed that the Mysql Connector is also located in Gac.

Thanks.

+4
source share
2 answers

csc looks for DLLs in the current directory in the framework directory in the directories mentioned in the / lib directory in the directories mentioned in the LIB environment variable.

But not in the GAC. You can compile with csc / r: full_path_to_the_gac_file.dll, it works, but is not very user friendly.

.NET assemblies are installed in two places: in the GAC and in the framework directory (which explains why they are found).

Copy the necessary DLL files to the specified directory and specify it using the / lib switch. Of course, at runtime it will be taken from the PAC.

+3
source

Another (more portable) solution might be:

<csc output="../bin/output.dll" target="library"> <references> <include name="\%windir%\assembly\AForge.dll" /> </references> <sources> <include name="**/*.cs" /> </sources> </csc> 

You can also use the lib tag to add \% windir \ assembly to the search path, but it is marked as deprecated in the NAnt documentation.

0
source

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


All Articles