Temp path too long when publishing a web site project
- Go to your web project folder, navigate to Properties\PublishProfiles folder.
- open your profile file profile_name.pubxml (not the profile_name.pubxml.user)
- copy/past
<AspnetCompileMergeIntermediateOutputPath>c:\shortPath\</AspnetCompileMergeIntermediateOutputPath>
under the<PropertyGroup>
tag - save your file, you would be able to publish your website using this profil
Add this to your publish profile to modify the temporary directory for package/publish:
<AspnetCompileMergeIntermediateOutputPath>c:\shortPath\</AspnetCompileMergeIntermediateOutputPath>
This is sort of an aside answer, but I ran into this problem when trying to MSBuild a solution that depended on nodeJS and gulp. The problem was that the gulp dependency tree became very deep and the aspnet_compiler was trying to copy that tree to a deeper directory, resulting in this error. I tried everything noted in here but nothing worked.
As it so happened, I was building with TFS, so my solution was to run an attrib +h node_modules\* /S /D
before msbuild to hide the directory tree and then attrib +h node_modules\* /S /D
. That did it for me.
Sure would be nice if the error thrown in this situation by the compiler revealed the path that caused the write to fail...