写入文件夹%USERPROFILE%\ AppData \ LocalLow. [英] Writing to folder %USERPROFILE%\AppData\LocalLow.

查看:566
本文介绍了写入文件夹%USERPROFILE%\ AppData \ LocalLow.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,这是一个奇怪的...

Alright here's a weird one...

操作系统:Windows 7 Ultimate,SP1,内部版本7601,64位.

Operating System: Windows 7 Ultimate, SP1, build 7601, 64 bit.

我有一个内置的C#项目:

I've got this C# project that I've built in:

  • VS2005-使用.NET v2.0
  • VS2008-使用.NET v3.5
  • VS2010-使用.NET v4.0

将C#可执行文件安装到64位Win7计算机上的C:\ Program Files(x86)子文件夹中.

The C# executable is installed into a sub-folder of: C:\Program Files (x86) on the 64 bit Win7 computer.

使用VS2005或VS2010版本时,C#代码可以按预期工作.

The C# code works as expected when using the VS2005 or VS2010 version.

使用VS2008版本时,C#代码无法按预期工作.

The C# code does NOT work as expected when using the VS2008 version.

C#程序应该在以下文件夹中创建一个文本文件:%USERPROFILE%\ AppData \ LocalLow.

The C# program is supposed to create a text file in the folder: %USERPROFILE%\AppData\LocalLow.

但是VS2008版本直接在%USERPROFILE%文件夹中创建文本文件.

But the VS2008 version creates the text file directly in the %USERPROFILE% folder.

现在这是一个线索:如果我将C#应用程序的VS2008版本安装在以下子文件夹以外的任何文件夹中:C:\ Program Files(x86),它将按预期工作并在%USERPROFILE中创建文本文件%\ AppData \ LocalLow.因此,例如,如果我安装了 VS2008 C#可执行文件位于C:\ Temp,它将按预期运行,并在以下文件夹中创建文本文件:%USERPROFILE%\ AppData \ LocalLow.

Now here's a clue: If I install the VS2008 version of the C# application in any folder other than a sub-folder of: C:\Program Files (x86), it works as expected and creates the text file in %USERPROFILE%\AppData\LocalLow. So for example, if I install the VS2008 C# executable in C:\Temp it'll work as expected and create the text file in the folder: %USERPROFILE%\AppData\LocalLow.

这是怎么回事?任何援助将不胜感激. Muchas Gracias!

What's up with that? Any assistance would be appreciated. Muchas Gracias!

推荐答案

您好,问题出在64位的32位应用程序的行为位系统.当您在(x86)版本或程序文件文件夹中安装应用程序时,该应用程序应作为32位本机应用程序运行.您的2005年& 2010年 编译工作正常,但是2008编译仅在(x86)版本或程序文件文件夹之外的情况下才能工作,那么您的应用程序的行为就不会像32位普通应用程序那样.我怀疑您的2008年项目正在使用AnyCPU集进行编译 作为目标机器.我认为将此编译属性(在项目属性中)强制为x86,可以解决您的问题.

Hello, the problem resides in the behavior of 32 bit applications in 64 bit systems. When you install an application in the (x86) version or the program files folder, the application is expected to run as a 32 bit native application. Your 2005 & 2010 compilations works fine, but 2008 compilation only works when is outside the (x86) version or the program files folder, then your application's behavior's is not as a 32 bit normal application is. I suspect that your 2008 project is compiling with AnyCPU set as a target machine. Forcing this compilation property (in the project properties) to be a x86 I think will solve your problem.

希望这会有所帮助,

米格尔.


这篇关于写入文件夹%USERPROFILE%\ AppData \ LocalLow.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆