Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/257.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# WIndows 8.1应用程序中缺少系统环境定义_C#_Windows 8.1 - Fatal编程技术网

C# WIndows 8.1应用程序中缺少系统环境定义

C# WIndows 8.1应用程序中缺少系统环境定义,c#,windows-8.1,C#,Windows 8.1,我正在制作一个Windows8.1商店应用程序。我想设置一个默认目录来兑现一些图像,并使用以下代码: 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 str

我正在制作一个Windows8.1商店应用程序。我想设置一个默认目录来兑现一些图像,并使用以下代码:

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");
我在System.Environment中发现一个错误,该错误不包含GetFolderPath和SpecialFolder的定义。我仔细观察了一下环境,果然,里面只有这些

#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也应该能够访问所有定义。我用谷歌搜索了一下,看看是否还有其他人有这个问题,但我没有发现任何类似的问题。那么,有人能告诉我为什么我的环境“缺少”了90%的定义吗?其次,我该如何修复它

哦,这是我的推荐信:

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

感谢您阅读我的问题并提供帮助。这是我问过的第一个问题,因此,如果我违反了某些规则或未能包含一些相关信息,请告诉我。

对于Windows应用商店应用程序,您应该使用本地或漫游文件夹来缓存特定于应用程序的数据:

Windows.Storage.ApplicationData.Current.LocalFolder或Windows.Storage.ApplicationData.Current.RoamingFolder

还有用于临时数据的Windows.Storage.ApplicationData.Current.temporary文件夹。

请尝试以下操作:

Environment.GetEnvironmentVariable("LocalAppData");
p、 在windows上测试