views:

895

answers:

4

Okay, so this isn't strictly a programming question, but it is a programming-related question.

I have a C# winforms project that I am trying to add a reference to the System.Messaging dll.

However, when I add the reference (from the .net tab of the Add References dialog), it shows up with a yellow exclamation warning.

Right-clicking on other references will allow me to view them in the object browser. Right clicking on the System.Messaging reference will not.

Here's the kicker though... If I click on another reference and scroll through the list in the object browser, I can see the System.Messaging entry.

I tried a variety of things to fix this so far, including a forced reinstall of the dll in the GAC using gacutil, but it's still not working.

Does anyone have any suggestions as to how to fix this? If I need to provide more information, please leave the specific information request in the comments.

Note. The operating system is Vista.

A: 

Perhaps the reference is somehow broken. Right-click on the project and select "Unload Project". Then use the right-click again to "Edit ...csproj". You are now looking at the actual MS Build "script" used to define your project in the Studio. Search for the System.Messaging reference. I tried it on my local VS2008/Vista and it looks like this:

<Reference Include="System.Messaging" />

If this is correct in your project, perhaps a strange entry in your App.config is redirecting the reference.

David Schmitt
A: 

i faced a similar problem but in my asp.net project (and a different GAC assembly - cant remember the name though). i fixed it by explicity telling my application the exact version to use in my web.config by inserting add assembly tag

for eg:

<add assembly="System.Messaging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

is there a way you can try this with your windows form app.config file (i havent worked much with winforms so not sure)

Raj
+3  A: 

I managed to find the solution after some creative googling.

On the project settings, there is a checkbox marked "Client-only framework subset".

Unchecking that checkbox did the trick.

Andrew Rollings
Andrew, on which project did you check this box? The GAC'ed project or the project referencing the GAC'ed project. Thanks.
Tim Stewart
The one which needed to access the System.Messaging reference.
Andrew Rollings
A: 

Hi,

I've created a tool that will help you to achieve your goal. Muse VSReferences will allow you to add a Global Assembly Cache reference to the project from Add GAC Reference menu item.

Regards Muse VSExtensions

Muse VSExtensions
Scanning for keywords and spamming your product is no way to go through life, son.As can be seen by the accepted answer, the problem had nothing to do with the GAC.
Andrew Rollings