【问题标题】:Publishing project with files with very long names使用名称很长的文件发布项目
【发布时间】:2015-04-02 19:39:36
【问题描述】:

我正在尝试在 Visual Studio 2013 中发布一个项目,其中包含一些名称很长的文件,包括路径位置。我将项目移动到靠近我的根 C:\ 驱动器的位置,这允许它编译,但是在发布时,它会尝试将文件复制到 %appdata% 文件夹,这导致名称超出限制。

这是我得到的错误:

Error   10  Copying file node_modules\grunt-bower\node_modules\bower\node_modules\bower-registry-client\node_modules\bower-config\node_modules\optimist\node_modules\minimist\.travis.yml to C:\Users\jake\AppData\Local\Temp\WebSitePublish\WebProject--1320288221\obj\Debug\Package\PackageTmp\node_modules\grunt-bower\node_modules\bower\node_modules\bower-registry-client\node_modules\bower-config\node_modules\optimist\node_modules\minimist\.travis.yml failed. 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.     0   0   WebProject

有没有办法调整此项目的名称或临时复制到的位置,以便我能够从 Visual Studio 发布?

【问题讨论】:

    标签: asp.net .net visual-studio visual-studio-2013


    【解决方案1】:

    Temp path too long when publishing a web site project引用@Britton

    将此添加到您的发布配置文件以修改临时目录 打包/发布:

    <AspnetCompileMergeIntermediateOutputPath>c:\shortPath\</AspnetCompileMergeIntermediateOutputPath>
    

    或者根据Website publish failing due to file path being too long(引用@Jason Beck@VeeKayBee):

    在 web 项目文件的默认 PropertyGroup 中添加以下行:

    <IntermediateOutputPath>..\Temp</IntermediateOutputPath>
    

    【讨论】:

    • 我使用了第二种解决方案 (&lt;IntermediateOutputPath&gt;..\Temp&lt;/IntermediateOutputPath&gt;),效果很好。谢谢!
    • 我的荣幸。顺便说一句,如果您也可以感谢原始问题中引用的人,那就太好了。
    【解决方案2】:

    除了上面的Amnon Shochot's answer,我还必须从另一个线程申请Roland's answer

    我的发布路径(在 .pubxml 中)现在如下所示:

    <publishUrl>c:\publish\proj\</publishUrl>
    <IntermediateOutputPath>c:\publish\inter\</IntermediateOutputPath>
    <_PackageTempDir>c:\publish\package</_PackageTempDir>
    

    你必须小心这个:

    重要提示:如果设置了此选项,请确保不要将临时文件嵌套在 publishUrl 目录中,因为它会清除 _PackageTempDir em> 文件,导致发布失败,即使它看起来成功。

    【讨论】:

      猜你喜欢
      • 2012-06-05
      • 2012-11-27
      • 1970-01-01
      • 2015-01-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-05
      • 1970-01-01
      相关资源
      最近更新 更多