2014-01-22 33 views
4

我在製作Windows 8.1商店應用程序。我想設置一個默認目錄cashe一些圖像和我使用此代碼做到這一點:在Windows 8.1應用程序中缺少System.Environment定義

using System; 
using System.Collections.Generic; 
using System.IO; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 

namespace YouMaps.Tiles 
{ 
class TileLoader 
{ 
    public const string defaultCasheName = "YouMapsTileCashe"; 
    public static string defaultCasheDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "YouMaps"); 

我得到的是統環境不包含GetFolderPath和SpecialFolder定義錯誤。我F12'ed超過環境果然,這一切是在那裏

#region Assembly System.Runtime.Extensions.dll, v4.0.0.0 
// C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5.1\System.Runtime.Extensions.dll 
#endregion 
using System.Security; 

namespace System 
{ 
public static class Environment 
{ 

    public static int CurrentManagedThreadId { get; } 
    public static bool HasShutdownStarted { get; } 
    public static string NewLine { get; } 
    public static int ProcessorCount { get; } 
    public static int TickCount { get; } 
    public static void FailFast(string message);   
    public static void FailFast(string message, Exception exception); 
} 
} 

然而,當我看到在使用Windows MSDN似乎表明,即使是Windows 8.1應該有機會獲得全方位的定義。我使用Google進行搜索,並在堆棧溢出中查看是否有其他人有這個問題,但我甚至沒有發現任何東西。所以,這個問題 - 誰能告訴我爲什麼我的環境「缺少」其定義的90%,其次,我該如何解決它?

哦,這裏是我的引用:

.NET for Windows Store apps 
Bing Maps for C#, C++, or Visual Basic 
Microsoft Visual C++ 2013 Runtime Package for Windows 
SharpKml 
Windows 

感謝您閱讀我的問題,並提供幫助。這是我所問過的第一個問題,如果我違反了某些規則禮節或未能包含一些相關信息讓我知道。

回答

0

試試這個:

Environment.GetEnvironmentVariable("LocalAppData"); 

附:在窗戶上測試

相關問題