Link to home
Start Free TrialLog in
Avatar of infotechelg
infotechelgFlag for United States of America

asked on

"Primary Reference" Warning in Visual Studio

Hello. Recently, while trying to build a project that has a reference to an Assembly generated three warnings (see attached image).

However, when I go to that assembly and rebuild it, it builds just fine. In the project, I remove the reference to the assembly and re-add it, try to build, and get the same errors.

I'm not quite sure how to go about fixing this, especially since the Assembly builds without issue. Everything here is .NET 4.0 in VS2010.

Generically, the warnings are to the effect of: "The primary reference "assembly" could not be resolved because it has an indirect dependency on the framework assembly....which could not be resolved in the currently targeted framework..."

Note that I did trace this down to the installation (via NuGet) of Google.Apis.Analytics.v3 Client Library. When I uninstall the installation from the Assembly, rebuild, and then rebuild my projects, everything is back to normal.

So, I'm not too sure why this Library would be causing everything to get blow'd up. Any help would be greatly appreciated.

Thanks for your help!
VSERROR.PNG
Avatar of Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger)
Flag of Canada image

A Warning is not an error, so things compile even with warnings.

It looks like the EtailorConfigurator dll that you are referencing uses an older version of the framework than the 4.0 that your application is using. The compiler can thus not insure that your application as a whole (application with its dlls) will work in different environments than the one you are using for development.

Either try to find a newer version of that dll, or be sure to thoroughly test your application on the server on which it will be installed before putting it in production.
Avatar of infotechelg

ASKER

Thanks, Jacques.

The Etailer assembly uses 4.0 (see EtailerDotNetVersion.png). This compiles and runs just fine on its own. This assembly is used by other, smaller assemblies (all in 4.0).

Ever since I installed the Google.Apis.Analytics.v3 Client Library to the Etailer assembly, none of the other assemblies will compile. Yes, those are warnings I get, but there are 100s of errors because the Etailer assembly code the smaller assemblies are referencing. The warnings and errors have to be related.

Here is a lot more detail. Leaving the "using Google.Apis.Analytics.v3" lines uncommented in the Etailer assembly class, I commented out all the methods that actually use Google.Apis.Analytics.v3 and rebuilt the assembly. Then I went into one of the smaller assemblies that reference Etailer and it built just fine. See (Websites2SuccessfulBuild.png).

Now, if I uncomment the methods that use Google.Apis.Analytics.v3 and rebuild Etailer, that's when everything goes haywire. Again, Etailer will rebuild just fine, but when I try to rebuild the Websites2 assembly, nothing works. See Websites2Unsuccessful.png. Please note the 157 errors (because these are all Etailer objects Websites2 is trying to access.  And, of course, i get the 3 warnings from my original post.
Websites2SuccessfulBuild.PNG
EtailerDotNetVersion.PNG
Websites2Unsuccessful.PNG
SOLUTION
Avatar of Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger)
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
While Jacques' response wasn't really the solution, some of the things he said helped me to think of other reasons why this would be happening, which ultimately lead me to the solution.