How do you use GAC'd assemblies as references using csc.exe?

I am compiling from csc.exe (well, CruiseControl is ...) and I need to reference the DLL in the GAC. I do not have the correct version of this DLL as a simple file, but the GAC has the correct version.

However, you cannot reference assemblies in the GAC using csc - you must have the path to the actual file.

I found several links that claim that you can reverse engineer the path to the actual file, but I was not able to get them to work. I have activated Fusion logging and I can see where the runtime is coming from, but using the path to it in my link does not work.

So, how do you provide csc with a link to the version of the assembly that exists only in the GAC?

+4
source share
3 answers

I had a similar problem. The solution I used was to open a command prompt and change the directory to something like the following (change it depending on which build you want):

  C: \ WINDOWS \ assembly \ GAC_MSIL \ System.Web.Extensions \ 3.5.0.0__31bf3856ad364e35 \

You can then copy the DLL to this directory somewhere outside of the GAC.

+3
source

I would recommend using Nant or MSBuild and just use the .csproj file created by visual studio. Then just ask CruiseControl to use the Nant script. Below are excerpts from the Nant script I wrote,

<csc target="library" output="${basedir}/bin/${basename}.dll" debug="${debug}" optimize="true"> <sources> <include name="src/app/**/*.cs"/> </sources> <references refid="My.Assemblies" /> </csc> 

and links

  <assemblyfileset id="My.Assemblies"><include name="System.dll"></include> <include name="System.Configuration.dll"></include> <include name="System.Core.dll"></include> <include name="System.Data.dll"></include> <include name="System.Data.DataSetExtensions.dll"></include> <include name="System.Drawing.dll"></include> <include name="System.EnterpriseServices.dll"></include> <include name="System.Web.dll"></include> <include name="System.Web.Extensions.dll"></include> <include name="System.Web.Mobile.dll"></include> <include name="System.Web.Services.dll"></include> <include name="System.Xml.dll"></include> <include name="System.Linq.dll"></include> </assemblyfileset> 
+3
source

When I compiled against Excel PIA, I used this path to specify a command line link for csc.exe: C: \ Windows \ Assembly \ GAC \ Microsoft.Office.Interop.Excel \ 11.0.0.0__71e9bce111e9429c \ Microsoft.Office.Interop. Excel.dll

Compilation succeeded.

?? This does not work for you?

0
source

All Articles