VS2012 &2013:无法发布服务项目 - 指定的路径太长 [英] VS2012 & 2013: Can't publish Services project - specified path is too long

查看:69
本文介绍了VS2012 &2013:无法发布服务项目 - 指定的路径太长的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 VS2012 解决方案,包含 10 个项目,突然间,我无法再将我的服务项目发布到任何文件夹.

I have a VS2012 solution, containing 10 projects, and suddenly, I can no longer publish my Services project to any folder.

当我尝试发布到 D:\temp 时,出现此错误:

When I try to publish to D:\temp, I get this error:

<代码>表述 [System.IO.Path] :: GetFullPath(OBJ \发布%25252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252528Prod%25252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252529 \)" 不能进行评价.指定的路径、文件名或两者都太长.完全限定的文件名必须少于 260 个字符,目录名必须少于 248 个字符.C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets

嗯?

VS2012 (with update 4) 似乎采用了我的配置名称Release(Prod)"并将其完全搞砸了,导致 GetFullPath 生成太长的路径名.

VS2012 (with update 4) seems to have taken my configuration name "Release(Prod)" and completely messed it up, causing the GetFullPath to produce too long a path name.

我该如何解决这个问题?

How the heck can I fix this ?

出于绝望,我尝试在 VS2013 中构建和发布同一个项目 - 它有相同的错误消息.

Out of desperation, I tried to build and publish the same project in VS2013 - and it had the same error message.

我的一位同事说他看到了同样的事情,但通过从他的配置名称中删除空格来修复它.我试过了,这就是为什么我的配置名称现在是Release(Prod)"而不是Release (Prod)",但没有区别.

One of my colleagues said he'd seen the same thing, but had fixed it by removing the spaces from his configuration name. I tried this, which is why my configuration name is now "Release(Prod)" rather than "Release (Prod)", but it made no difference.

我也打开了这个错误提示是错误原因的文件:C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets

I did also open the file which this error is suggesting is the cause of the error: C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets

..并注意到其中有一些关于 AnyCPU 平台名称的信息.我曾尝试让我的服务项目使用AnyCPU"和Any CPU"(郁闷的叹息),但似乎都没有任何区别.

..and noticed that there's something in there concerning the AnyCPU platform name. I have tried getting my Services project to use "AnyCPU" and "Any CPU" (depressed sigh) but neither seems to make any difference.

  <PropertyGroup Condition=" '$(IntermediateOutputPath)' == '' ">
    <IntermediateOutputPath Condition=" '$(PlatformName)' == 'AnyCPU' Or '$(PlatformName)' == ''">$(BaseIntermediateOutputPath)$(Configuration)\</IntermediateOutputPath>
    . . .
  </PropertyGroup>

有没有其他人看到过这个问题?

Has anyone else seen this issue ?

(稍后..)

这太奇怪了(而且令人沮丧).

This is so odd (and frustrating).

我的解决方案有 5 种配置 - 默认的调试和发布配置,以及针对测试、预生产和生产环境的额外配置.

My Solution has 5 configurations - the default Debug and Release ones, plus extra configurations for Test, PreProduction and Production environments.

如果我选择这三个包含括号的配置中的任何一个,我会收到这个荒谬的指定的路径太长"错误,因为 VS2012 破坏了路径名(如我上面的第一个屏幕截图所示).

If I select any of these three configurations containing brackets, I get this ridiculous "The specified path is too long" error, as VS2012 corrupts the pathname (as shown in my first screenshot above).

我不禁想知道...这是某种 VS2012 错误,处理配置名称中的空格或括号吗?

I can't help wondering... is this some kind of VS2012 bug, handling spaces or brackets in the configuration name ?

推荐答案

我可以直接用 (, (, )) 在 Connection 选项卡上的 Target Location 发布到文件系统时(即不从配置名称构建路径) - 但这不是定位的解决方案根据配置不同的位置.

I can deploy to a path directly with (, (, )) in the Target Location on tyhe Connection tab when publishing to the file system (i.e. not building a path from the configuration name) - but that is not a solution to targeting different locations based on the Configuration.

如果您想在配置名称中保留特殊字符,但指定一个不会导致并发布此帖子的部署文件夹的路径可能会有所帮助:Visual Studio:如何正确构建和指定 x64 和 x86 的配置和平台

If you want to keep special characters in the configuration name, but specify a path to the deployment folder that will not cause and issue this post might help: Visual Studio: How to properly build and specify the configurations and platforms for x64 and x86

具体玩这里的设置:

在项目属性页面,选择各种排列解决方案下拉列表中的调试/发布和 x86/x64.确保目标处理器设置正确(应该是,但我发现实例当他们不是时,可能是因为我以前的尝试).还,设置输出目录.那应该没问题并且是自动的(/bin/x86/Debug 等).如果没有,请修复.

In the project properties page, select the various permutations of Debug/Release and x86/x64 in the solution dropdowns. Make sure the target processor is set correctly (it should be, but I found instances when they were not, probably because of my previous attempts). Also, set the output directory. That should be okay and automatic (/bin/x86/Debug, etc.). If not, fix.

看看实际发生的事情也可能有用:

Looking at what is actually seems to be going on is also potentially useful:

查看插入的数字:

  • %25 是一个编码的 %,
  • %28 是一个编码的 (
  • %29 是一个编码的 )
  • %25 is an encoded %,
  • %28 is an encoded (
  • %29 is an encoded )

看路径:

OBJ \推出%252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525 *** *** 28%PROD *** 252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525 29 ***)

obj\Release%252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525***28***Prod%252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525***29***)

我认为正在发生的事情:

所以这似乎是一个很好的线索,表明这些是 URL 或 XML 编码的.似乎正在发生的是 ( 被编码为 %28 然后 % 被递归编码为 %25 - 生成无限的 %252525252525252525....

So that seems like a good clue that these are being URL or XML encoded. What appears to be happening is that the ( is being encoded as %28 and then the % is being recursively encoded as %25 - generating an infinite %252525252525252525....

一个更有趣的问题实际上是为什么它停止从带有这个错误的 % 中创建 25 的(两次它都停止在 214 个字符处创建 25,包括%28/29 - 不是一个很有趣的数字).

A more interesting question is actually why it stops creating 25's from the %'s with this bug (both times it stops creating 25's at 214 characters including the % and the 28 / 29 - not a very interesting number).

查看您引用的文件 C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets - 这些是有道理的字符串正在为 XML 编码.我会说这绝对是一个错误......我没有修复建议.

Looking at the file C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets you reference - it makes sense that these strings are being encoded for XML. I would say this is definitely a bug... I have no suggestions for a fix.

这篇关于VS2012 &amp;2013:无法发布服务项目 - 指定的路径太长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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