My blog has moved!

Visit http://blog.adamroderick.com/ and update your bookmarks.

Friday, February 16, 2007

Manually Adding a Reference to a Visual Studio 2005 Project

I ran into this problem when trying to reference the SchemaWithNone class in the Microsoft.BizTalk.Component.Utilities namespace. The Microsoft.BizTalk.Component.Utilities assembly is in the GAC only and there is no dll file anywhere.


Through the Visual Studio interface you are not able to reference an assembly in the GAC; however, it can be done by editing the project file (.vbproj, .csproj, etc) manually in a text editor. This information I was able to get from the documentation, but the suggested way to manually add a reference was not accurate.


To add the reference, close the solution in Visual Studio and open up the project file in a text editor. Find the <ItemGroup> element, which contains <Reference> elements. Model the Include attribute after one that is there or the one I have below.


<Reference Include="Microsoft.BizTalk.Component.Utilities, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\WINDOWS\assembly\GAC\Microsoft.BizTalk.Component.Utilities\3.0.1.0__31bf3856ad364e35\Microsoft.BizTalk.Component.Utilities.dll</HintPath>
</Reference>




You can get the values for Version, Culture, PublicKeyToken, and ProcessorArchitecture all from the assembly itself. To get that info, browse to c:\WINDOWS\assembly (assuming c:\WINDOWS is where you have windows installed). Find the name of the assembly, which in my case was Microsoft.BizTalk.Component.Utilities. Right-click on the assembly and choose properties.

The <HintPath> can be relative to the project (as it is above with the ..\..\) or it can be absolute (c:\...).

Save the file, and when you open your solution in Visual Studio, you will now have a reference to the assembly. You can check this by going to the Solution Explorer, right-clicking on the project, and choosing "Properties." Click on the References tab and check that the assembly is listed.

Labels: ,

2 Comments:

Blogger Jill said...

I didn't even know you had your own computer camp/club blog! I'm so excited! I'm not going to read it, but I'm so excited!

April 9, 2007 at 1:56 PM  
Anonymous Anonymous said...

Jill - I do not plan on reading it either.

August 19, 2008 at 12:46 PM  

Post a Comment

Subscribe to Post Comments [Atom]

<< Home