maxmind/GeoIP2-dotnet

The type or namespace name 'GeoIP2' does not exist in the namespace 'MaxMind' when targeting .NET 4.0

gdoron opened this issue · 7 comments

Hi,

For some reason, I can't use the MaxMind.GeoIP2 namespace, I get the error saying it doesn't exist.
The type or namespace name 'GeoIP2' does not exist in the namespace 'MaxMind' (are you missing an assembly reference?)

I obviously had the dll referenced and checked in the object browser that the namespace exists in the DLL.

This is my code:

using MaxMind.GeoIP2;

namespace jifiti.Common.Location
{
    public class MaxMindGeoLocation
    {
        public GeoLocationResults GetGeoLocationData(string ipAddress)
        {
            using (var client = new WebServiceClient(11111, "AAAAA"))
            {
                // Do the lookup
                var response = client.City(ipAddress);

                return new GeoLocationResults
                           {
                               Country = response.Country.IsoCode,
                               CountryConfidence = response.Country.Confidence,
                               State = response.MostSpecificSubdivision.Name,
                               StateConfidence = response.MostSpecificSubdivision.Confidence,
                               City = response.City.Name,
                               CityConfidence = response.City.Confidence,
                               PostalCode = response.Postal.Code,
                               PostalCodeConfidence = response.Postal.Confidence
                           };
            }
        }
    }
}

I am not sure what might be causing this. Is the assembly referenced in your project? What is your target framework?

Hi,
The project targeted .Net framework 4.0.
After changing the entire solution to 4.5.1 it started working.
Not sure what is the reason for that, but we had to update the solution someday, you just made it come faster :)

Thanks anyway

Hmm, that sounds like an actual bug given that it is supposed to work on 4.0. I am going to re-open this so that we can investigate it further.

What version of Visual Studio are you using? I am having a hard time reproducing this with VS2015 with a project targeting .NET framework 4.0.

2013 SP 4/5.
I can try reproduce it again in a clean solution, worth giving it a shot.

On Tue, Dec 1, 2015, 18:05 Gregory Oschwald notifications@github.com
wrote:

What version of Visual Studio are you using? I am having a hard time
reproducing this with VS2015 with a project targeting .NET framework 4.0.


Reply to this email directly or view it on GitHub
#42 (comment)
.

Sent from my mobile

@gdoron, thanks. After some internal discussion, it looks like we are just going to drop .NET 4.0 support in the next release given January 12 is its EOL. This will also let us remove the dependency on the BCL libraries.

Closed by #43.