.net发布网站时提示严重性指定的路径或文件名太长,或者两者都太长。完全限定文件名必须少于 260 个字符,并且目录名必须少于 248 个字符。
是因为临时文件夹太长,自己设个临时文件夹:
在发布的网站根目录中找到*.publishproj文件,在<PropertyGroup>节点内添加<IntermediateOutputPath>..\Temp</IntermediateOutputPath>,将可以设置发布过程中的临时文件存放目录,这里设置的..\Temp将会在项目目录中自动创建一个Temp文件夹,
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.30319</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{931b5de2-a433-45c0-a8f1-b320be80eebe}</ProjectGuid>
<SourceWebPhysicalPath>$(MSBuildThisFileDirectory)</SourceWebPhysicalPath>
<SourceWebVirtualPath>/WebSite</SourceWebVirtualPath>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<SourceWebProject>http://localhost:4354</SourceWebProject>
<SourceWebMetabasePath>/IISExpress/7.5/LM/W3SVC/9/ROOT</SourceWebMetabasePath>
<!--指定发布过程中临时文件的存放目录-->
<IntermediateOutputPath>..\Temp</IntermediateOutputPath>
</PropertyGroup>