During the last 3 days I’ve spent sometime on an annoying issue concerning Visual Studio 2012 and Npgsql ( a .Net Data Provider for Postgresql).
If you’ve ever had something similiar :
Error Message: Parser Error Message: Assembly ‘Npgsql, Version=188.8.131.52, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7’ not found
while debugging or running your application, you might need to add the reference of the Npgsql.dll into your GAL.
If you have Visual Studio 2012, the related GAL is located on:
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\gacutil.exe.
Visual Studio 2010 has the same path with the exception of the version which should be V.7.0 (if patched 7.1). Visual studio 2013 should has the same path with the version V.9.0. Once you found it, you should run the command below to insert into the Global Assembly Cache (GAL), the missing reference. (adding the Reference from the Solution, it’s not enough)
What you need to do is to open a command prompt, in my case the Npgsql is located in C:\Npgsql, and run these commands:
#cd C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\ #gacutil.exe /i C:\Npgsql\Npgsql-2.1.2-net40\Npgsql.dll
As you can see from the reference page on MSDN, \i installs the reference as required. A good check would be to run /l after inserted, in order to check if it has been added correctly or not.