windows 构建windows azure服务时路径太长错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5739347/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 16:41:41  来源:igfitidea点击:

Path too long error when building a windows azure service

windowsazure

提问by smoothe

I have been trying to publish my service to windows azure. The service consists of a single webRole, however I have added remote login functionality published it and built it a few times, and now all the sudden it will not build. The reason it gives is that

我一直在尝试将我的服务发布到 windows azure。该服务由单个 webRole 组成,但是我添加了远程登录功能,发布并构建了几次,现在突然无法构建。它给出的原因是

Details below:
"Error 56 The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters. C:\Program Files (x86)\MSBuild\Microsoft\Cloud Service\1.0\Visual Studio 10.0\Microsoft.CloudService.targets 202 5 FileSystemCreator"

详细信息如下:
“错误 56 指定的路径、文件名或两者都太长。完全限定的文件名必须少于 260 个字符,目录名必须少于 248 个字符。C:\Program Files (x86) \MSBuild\Microsoft\Cloud Service\1.0\Visual Studio 10.0\Microsoft.CloudService.targets 202 5 FileSystemCreator"

I have gone on all the forums, I have used CSPack command line for packaging the service which is fine but I'm having a really hard time configuring the certificate for remote desktop connect and I would like to take advantage of this feature as I am creating some websites in the onStart event and I would like to peek into IIS. Some microsoft employees do agree that this is a bug and the have promised a fix this issue, refer to post. I am using VS2010 and I do not know how to fix this bug.

我已经访问了所有论坛,我使用 CSPack 命令行来打包服务,这很好,但是我真的很难为远程桌面连接配置证书,我想像我一样利用这个功能在 onStart 事件中创建一些网站,我想查看 IIS。一些微软员工确实同意这是一个错误,并已承诺修复此问题,请参阅帖子。我正在使用 VS2010,但我不知道如何修复此错误。

Can anyone please help, or point me to a place where I can get any help.

任何人都可以请帮助,或指出我可以得到任何帮助的地方。

回答by Michael Petito

I ran into the same problem with a new solution.

我用一个新的解决方案遇到了同样的问题。

Note that, unlike Eugenio Pace's response suggests, the error occurs only when deploying to Azure (and not when running the project in the Azure Compute Emulator).

请注意,与 Eugenio Pace 的回应所暗示的不同,错误仅在部署到 Azure 时发生(而不是在 Azure 计算模拟器中运行项目时)。

Try adding the following line to the first property group of your Windows Azure Visual Studio Project file (*.ccproj):

尝试将以下行添加到 Windows Azure Visual Studio 项目文件 (*.ccproj) 的第一个属性组:

<ServiceOutputDirectory>C:\Azure\</ServiceOutputDirectory>

The trailing slash (for whatever path you select) appears to be required. This folder will be deleted each time you create a package if it exists.

尾随斜杠(对于您选择的任何路径)似乎是必需的。每次创建包时都会删除此文件夹(如果存在)。

This setting seems to redirect the working folder for the package to a shorter base path, preventing the path too long error.

此设置似乎将包的工作文件夹重定向到较短的基本路径,防止路径过长错误。

Credit goes to: http://govada.blogspot.com/2011/12/windows-azure-package-build-error.html

归功于:http: //govada.blogspot.com/2011/12/windows-azure-package-build-error.html

回答by Eugenio Pace

Perhaps the local folder used to store temporary development fabric is too long. See Windows Azure - Resolving "The Path is too long after being fully qualified" Error Message.

也许用于存储临时开发结构的本地文件夹太长。请参阅Windows Azure - 解决“完全限定后路径太长”错误消息

回答by mohlman3

I was having this problem as well when deploying a Node.js project to Azure.

将 Node.js 项目部署到 Azure 时,我也遇到了这个问题。

To fix it, I had to change my "TEMP" and "TMP" user environment variables to something shorter than their default values.

为了修复它,我不得不将我的“TEMP”和“TMP”用户环境变量更改为比它们的默认值更短的值。

In my case, they were pointing by default to %USERPROFILE%\AppData\Local\Temp, changing them to C:\Temp solved it.

就我而言,它们默认指向 %USERPROFILE%\AppData\Local\Temp,将它们更改为 C:\Temp 解决了它。

Make sure you restart Windows after.

确保之后重新启动 Windows。

回答by Dan

The better solution may be to create a symbolic link to your project folder. This doesn't require moving files or changing system variables. Open up the command prompt as an administrator and run this:

更好的解决方案可能是创建一个指向项目文件夹的符号链接。这不需要移动文件或更改系统变量。以管理员身份打开命令提示符并运行:

mklink /D C:\Dev C:\Users\danzo\Source\Workspaces

Obviously you can change "C:\Dev" to whatever you want it to be and you'll need to change the longer path above to the root directory of your soltions/projects folder.

显然,您可以将“C:\Dev”更改为您想要的任何内容,并且您需要将上面较长的路径更改为您的解决方案/项目文件夹的根目录。

回答by Emmanuel DURIN

When you run a cloud service on the development fabric, the development fabric uses a temporary folder to store a number of files including local storage locations, cached binaries, configuration, diagnostics information and cached compiled web site content.

By default this location is: C:\Users\\AppData\Local\dftmp

当您在开发结构上运行云服务时,开发结构使用一个临时文件夹来存储许多文件,包括本地存储位置、缓存的二进制文件、配置、诊断信息和缓存的编译网站内容。

默认情况下,此位置为:C:\Users\\AppData\Local\dftmp

Credit goes to Jim Nakashima of Microsoft : https://blogs.msdn.microsoft.com/jnak/2010/01/14/windows-azure-resolving-the-path-is-too-long-after-being-fully-qualified-error-message/

归功于微软的 Jim Nakashima:https: //blogs.msdn.microsoft.com/jnak/2010/01/14/windows-azure-resolving-the-path-is-too-long-after-being-fully-合格的错误信息/

In order to change the temporary folder, a user environment variable has to be created :

为了更改临时文件夹,必须创建一个 用户环境变量:

It is named _CSRUN_STATE_DIRECTORY

它被命名为 _CSRUN_STATE_DIRECTORY

Give it a value of short named directory like :

给它一个短命名目录的值,如:

c:\AzureTemp

Don't forget to restart Visual Studio in order to have the environmennt variables to be read again

不要忘记重新启动 Visual Studio 以便再次读取环境变量

It fixed many compilations problem !

它修复了许多编译问题!

回答by vicgilbcn

I tried all the above 2 approaches:

我尝试了所有上述两种方法:

-change TEMP and TMP enviromental variables

-更改 TEMP 和 TMP 环境变量

-<ServiceOutputDirectory>path

-<ServiceOutputDirectory>路径

and didn't work. In my case, I had to move the whole project to a shorter path C:\ and worked. I'm using W7 and VS12.

并没有工作。就我而言,我不得不将整个项目移动到较短的路径 C:\ 并工作。我正在使用 W7 和 VS12。

回答by LincolnV

Same problem happened to me when I try Packaging an Umbraco project for Azure (https://github.com/WindowsAzure-Accelerators/wa-accelerator-umbraco/wiki/Deployment), I found the solution is to: Copy and rename the long-name path and folder to "C:\someshortname".

当我尝试为 Azure 打包 Umbraco 项目时发生了同样的问题(https://github.com/WindowsAzure-Accelerators/wa-accelerator-umbraco/wiki/Deployment),我发现解决方案是:复制并重命名长-name 路径和文件夹到“C:\someshortname”。

(solution was suggested by this: link)

(解决方案是由这个建议的:链接