1

Closed

WindowsMobile build error in CacheLoader (SpecialFolder does not contain a definition for LocalApplicationData)

description

Hi
Thanks for your very good component.
I want to compile project in Visual Studio 2008 to test and run WindowsMobile demo.
But there is an error in GMap.NET.Core project in GMap.NET.Internals\Cache.cs file.
Exception is :
'System.Environment.SpecialFolder' does not contain a definition for 'LocalApplicationData'
I saw that you create a shortcut to this file in GMap.NET.WindowsMobile project and this project is a Smart Device Class Library, and 'LocalApplicationData' is not available in .Net Compact Framework.
I saw that you defined 'PocketPC' symbol for this project, so I'd change CacheLoader class code to this and compile it successfully :

internal class CacheLocator
{
   private static string _location;
   public static string Location
   {
       get
       {
           if (string.IsNullOrEmpty(_location))
               _location = System.Environment.GetFolderPath(System.Environment.SpecialFolder.

if PocketPC

                 ApplicationData

else

                LocalApplicationData

endif

                ) + Path.DirectorySeparatorChar + "GMap.NET" + Path.DirectorySeparatorChar;

           return _location;
       }
       set
       {
           _location = value;

           if (Delay)
           {
               Cache.Instance.CacheLocation = Location;
           }
       }
   }

   public static bool Delay = false;
}

Also I recommend to create some Solution Configuration for your solution, somethings like WindowsMobile-Debug and WindowsMobile-Release, Windows-Debug and Windows-Release , Setup WindowsMobile, Setup-Windows , Test-X , ...

This would simplify the compile process and you can select which project must compile in each configuration.
Also you can define solution wide Symbols, so you don't need to use shortcuts and you can merge GMap.NET.Core and GMap.NET.WindowsForms and GMap.NET.WindowsMobile and GMap.NET.WindowsPresentation projects all in one project (GMap.NET.Core) and user can compile solution by select desired configuration (Platform).
(oh, this method does not work here, because Target Framework for this projects is not equal)

Sorry for my bad english.
Thanks for your excellent work.
Closed Nov 18, 2012 at 8:56 PM by radioman
fixed

comments

radioman wrote Nov 18, 2012 at 8:55 PM

fixed