Website publish failing due to file path being too long Website publish failing due to file path being too long asp.net asp.net

Website publish failing due to file path being too long


From http://forums.asp.net/t/1944241.aspx?Website+publish+failing+due+to+file+path+being+too+long

Add the following line in default PropertyGroup of web project file.

<IntermediateOutputPath>..\Temp\</IntermediateOutputPath>

You can likely make the above path C:\temp or ......\Temp (as needed to get it as close to root of the drive as possible.

In my case, there was no .csproj or .vbproj (website project file) but there was a website.publishproj file that warns you not to edit it, but I did anyway, and it did the trick.


Thanks to Stelvio, from http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2156195-fix-260-character-file-name-length-limitation , there is a solution :

Well, I found a workaround that ALLOW work with path with more than 260 chars.

Disclaimer: I've tried this trick only on Windows 8 x64 and Visual Studio 2013

So, to make it work I've just create a junction to the folder with the mklink command:

Assume this is the original path: d:\very\very\long\path\to\solution\folder, you can obtain a short link as d:\short_path_to_solution_folder just jaunching this command from a dos shell as administrator: mklink /J d:\short_path_to_solution_folder d:\very\very\long\path\to\solution\folder

change source and destination path to you needs

Best Regards! Stelvio

from this link :http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2156195-fix-260-character-file-name-length-limitation


While moving the project closer to the root file does work. I found a link to a solution that did work for me. The site also does a great job at discussion the issue as well as the details behind his solution.

Sayed Hashimi's solution to long path issue

EDIT:

To Summarize the provided link:

You can update your publish profile file, which is used by MSBuild, to include a replace rule that will shorten the path of your output when publishing to a web deploy package (Zip file).

For example, let's say publishing using the default profile created by Visual Studio, we get the following paths in the zip file:

archive.xmlContent\C_C\Temp\package\WebApplication1\obj\Release\Package\PackageTmpContent\C_C\Temp\package\WebApplication1\obj\Release\Package\PackageTmp\binContent\C_C\Temp\package\WebApplication1\obj\Release\Package\PackageTmp\bin\WebApplication1.dllContent\C_C\Temp\package\WebApplication1\obj\Release\Package\PackageTmp\index.htmlContent\C_C\Temp\package\WebApplication1\obj\Release\Package\PackageTmp\Web.configparameters.xmlsystemInfo.xml

The trick is to replace all of the path defined after Content with a shorter path. In this particular example, replace the path with "website" in the PackagePath element.

One can edit the publishing profile file (.pubxml) and add the follow lines near the end of the file, just before the Project element is terminated.

<PropertyGroup>  <PackagePath Condition=" '$(PackagePath)'=='' ">website</PackagePath>  <EnableAddReplaceToUpdatePacakgePath Condition=" '$(EnableAddReplaceToUpdatePacakgePath)'=='' ">true</EnableAddReplaceToUpdatePacakgePath>    <PackageDependsOn>    $(PackageDependsOn);    AddReplaceRuleForAppPath;    </PackageDependsOn></PropertyGroup><Target Name="AddReplaceRuleForAppPath" Condition=" '$(EnableAddReplaceToUpdatePacakgePath)'=='true' ">  <PropertyGroup>    <_PkgPathFull>$([System.IO.Path]::GetFullPath($(WPPAllFilesInSingleFolder)))</_PkgPathFull>  </PropertyGroup>  <!-- escape the text into a regex -->  <EscapeTextForRegularExpressions Text="$(_PkgPathFull)">    <Output TaskParameter="Result" PropertyName="_PkgPathRegex" />  </EscapeTextForRegularExpressions>  <!-- add the replace rule to update the path -->  <ItemGroup>    <MsDeployReplaceRules Include="replaceFullPath">      <Match>$(_PkgPathRegex)</Match>      <Replace>$(PackagePath)</Replace>    </MsDeployReplaceRules>  </ItemGroup></Target>

Now, the publish profile paths should look something like the following:

archive.xmlContent\websiteContent\website\binContent\website\bin\WebApplication1.dllContent\website\index.htmlContent\website\Web.configparameters.xmlsystemInfo.xml