Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am trying to publish a Website project from a vendor that has ridiculously long paths to some of its files. When publishing, the error is:

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.

When I publish, Visual Studio 2012 Update 3 is attempting to write to a temp directory, and the prefix is quite long:

 C:UserscuserAppDataLocalTempWebSitePublishMidasCMS400v9-1580334405objDebugPackagePackageTmp

I thought I might be able to redirect VS to a different temporary directory at c:em by following this SO answer: Temp path too long when publishing a web site project

I create my publication profile, and as soon as I open it, there is an error indicating that WebPublishMethod is not an element of PropertyGroup. Regardless, I updated the file so it looks like this:

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>FileSystem</WebPublishMethod>
    <LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish />
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <publishUrl>C:SitesMidasPublish</publishUrl>
    <DeleteExistingFiles>False</DeleteExistingFiles>
    <AspnetCompileMergeIntermediateOutputPath>c:em</AspnetCompileMergeIntermediateOutputPath>
  </PropertyGroup>
</Project>

When I try to publish, I get the a modal box pop-up entitled "File Modification Detected", with the message "The project YourWebsite has been modified outside the environment", and it asks me if I want to reload. In my error list, I continue to get the error about the path being too long, as it is not attempting to use the c:em directory I identified.

I need to put this bloody thing onto a server, I am up for any solution that allows me to publish the bloody thing. I don't know much about the Website project template, so please let me know if there is a better way.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
679 views
Welcome To Ask or Share your Answers For Others

1 Answer

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:emp 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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...