Compile error VS2008

Topics: SharpMap v2.0
Jan 27, 2011 at 8:57 PM

Just checked out the latest version of Sharpmap v2.0 from svn. There seems to be som problem with the solution file for VS2008. When I open the solution file called "SharpMap_v2_vs2008.sln" in Visual Studio 2008 Pro, I get two error messages:

  • "unable to read the project file 'Sharpmap.Demo.AspNet.csproj'. [...] The imported project 'C:\Program Files (x86)\MSBuild\Microsoft\Visual Studio\v.10.0\WebApplications\Microsoft.WebApplication.targets' was not found.[...]"
  • "unable to read the project file 'Sharpmap.Demo.SharpLayers.csproj'. [...] The imported project 'C:\Program Files (x86)\MSBuild\Microsoft\Visual Studio\v.10.0\WebApplications\Microsoft.WebApplication.targets' was not found.[...]"

The messages is clear enough, but since I am using Visual Studio 2008, there is a folder named v.9.0 in MSBuild, not v.10.0. The project file opens anyway, but there is a lot of missing references and when trying to compile it gives something like 130 errors.

Coordinator
Jan 28, 2011 at 8:39 AM

Do you want to do web development? If not you can safely remove all web related projects from the solution file.

Otherwise, try changing the paths to ...\Visual Studio\v9.0\... and see if it works.

Hth FObermaier

Jan 28, 2011 at 8:55 AM

Wil try to change the path. I also tried to download VS2010 expr. and open the 2010 solution file instead. That worked a bit better, but there are still quite a few broken references. Fixing them manually going to take forever...

The reason why I downloaded the source was to see how the shapefile data provider worked and compile it to a usable dll-file. Now, compiling it wasn't very difficult, figuring how it worked was more of a task. So now I'm looking through the rest of the source, trying to figure out how to create a new IGeometryFactory object, wich I need to create a ShapeFileProvider object. I think there is a helper class called GeometryServices somewhere, but at least in Visual Studio 2008 its nowhere to be found.

Coordinator
Jan 28, 2011 at 9:08 AM

you should set configuration to release_net20 and platform to x86. that way all compiles without problems.

The GeometryServices class is located in the SharpMap.Utilities project.

Hth FObermaier

Jan 28, 2011 at 12:21 PM

I had already set it to release_net20 and x86. The project doesn't compile very well (without errors), but I was able to compile the few libraries that I needed to use the Shape file reader, once i figured out that I needed SharpMap.Utilities too (thanks). Btw. the reader worked perfectly :)

Thanks for your help and for a great library!

Mar 29, 2011 at 3:05 PM
FObermaier wrote:

you should set configuration to release_net20 and platform to x86. that way all compiles without problems.

The GeometryServices class is located in the SharpMap.Utilities project.

Hth FObermaier

I set configuration to release_net20 and platform to x86, The project still doesn't compile well;

Coordinator
Mar 29, 2011 at 5:37 PM

which of the branches are you trying to compile, which projects do not compile with this setting?

FObermaier

Developer
Mar 29, 2011 at 7:49 PM

please try to compile this branch and see if all works well: 

https://sharpmapv2.googlecode.com/svn/branches/CustomWmsSamples opening the soluzion Demos\Demo.Wms.sln

Mar 30, 2011 at 1:44 AM
Edited Mar 30, 2011 at 1:49 AM
D_Guidi wrote:

please try to compile this branch and see if all works well: 

https://sharpmapv2.googlecode.com/svn/branches/CustomWmsSamples opening the soluzion Demos\Demo.Wms.sln

many items can't find "\NTS\GeoAPI\bin\Debug_Net20\GeoAPI.dll"

Developer
Mar 30, 2011 at 6:57 AM
chensheng9 wrote:
 many items can't find "\NTS\GeoAPI\bin\Debug_Net20\GeoAPI.dll"

try to compile first the solution folder called "external", then the solution folder called "core" and then the project in the root (sharpmap.wms).

Mar 30, 2011 at 8:38 AM
Edited Mar 30, 2011 at 9:05 AM
D_Guidi wrote:
chensheng9 wrote:
 many items can't find "\NTS\GeoAPI\bin\Debug_Net20\GeoAPI.dll"

try to compile first the solution folder called "external", then the solution folder called "core" and then the project in the root (sharpmap.wms).

 

 

it can compile now,but it give another error when executing:

[FileNotFoundException: “NetTopologySuite.Coordinates.Simple, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null”。]
SharpMap.Utilities.InternalFactoryService..ctor() in C:\Documents and Settings\Administrator\SharpMap.Utilities\GeometryServices.cs:105
SharpMap.Utilities.GeometryServices..cctor() in C:\Documents and Settings\Administrator\SharpMap.Utilities\GeometryServices.cs:36
[TypeInitializationException: “SharpMap.Utilities.GeometryServices”。]
   SharpMap.Utilities.GeometryServices..ctor() +0
SharpMap.Demo.Wms.MvcApplication.Application_Start() in C:\Documents and Settings\Administrator\SharpMap.Demo.Wms\Global.asax.cs:19
Developer
Mar 30, 2011 at 9:32 AM
Edited Mar 30, 2011 at 10:07 AM

check if NetTopologySuite.Coordinates.Simple.dll is inside SharpMap.Demo.Wms\bin folder, if not, try to force a compilation of the  NetTopologySuite.Coordinates.Simple project, the recompile  SharpMap.Demo.Wms and see if the dll is copied. I try to check if also on my pc the error happens.

<edit>

I've tried and the NetTopologySuite.Coordinates.Simple.dll file is copied in the bin folder

of course, IT works on my machine: http://goo.gl/yslS

</edit>

Mar 31, 2011 at 9:13 AM
Edited Mar 31, 2011 at 9:50 AM

It still can not excute,I don't know why .is there anyone can help me?thank you very much.I really want to test sharpmap wms with openlayer,but I  and my classmates can't solve the errors when excuting the demo(vs2008),thanks again!(english is not my first language,I am sorry for the errors in my words)

the demo address :

https://sharpmapv2.googlecode.com/svn/branches/CustomWmsSamples opening the soluzion Demos\Demo.Wms.sln

and my error:

[FileNotFoundException: “NetTopologySuite.Coordinates.Simple, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null”。]
SharpMap.Utilities.InternalFactoryService..ctor() in C:\Documents and Settings\Administrator\SharpMap.Utilities\GeometryServices.cs:105
SharpMap.Utilities.GeometryServices..cctor() in C:\Documents and Settings\Administrator\SharpMap.Utilities\GeometryServices.cs:36
[TypeInitializationException: “SharpMap.Utilities.GeometryServices”。]
   SharpMap.Utilities.GeometryServices..ctor() +0
SharpMap.Demo.Wms.MvcApplication.Application_Start() in C:\Documents and Settings\Administrator\SharpMap.Demo.Wms\Global.asax.cs:19
Mar 31, 2011 at 4:05 PM

?

Coordinator
Apr 1, 2011 at 9:50 AM

I just did a fresh checkout and checked the following configurations

  • Debug_Net20 | AnyCPU
  • Debug_Net20 | x86
  • Release_Net20 | AnyCPU
  • Release_Net20 | x86

and everything worked out fine.

Try updating your local repository (svn update) and perform clean and rebuild on Demo.Wms.sln

Hth FObermaier