这似乎是一个常见问题,我发现了几个 Stack Overflow 问题,但它们似乎都与 MSBuild 有关。
我试图通过在 Visual Studio 中右键单击我的 asp.net 5 rc1 项目并调用基于文件系统的发布配置文件来发布。
它的设置如下所示:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<CompileSource>False</CompileSource>
<_DefaultDNXVersion>dnx-clr-win-x86.1.0.0-rc1-final</_DefaultDNXVersion>
<UsePowerShell>True</UsePowerShell>
<IISCommand>web</IISCommand>
<WebRoot>wwwroot</WebRoot>
<WwwRootOut>wwwroot</WwwRootOut>
<IncludeSymbols>False</IncludeSymbols>
<Native>False</Native>
<IgnoreDNXRuntime>False</IgnoreDNXRuntime>
<publishUrl>C:\Source\CCollections\artifacts\bin\CCollections.Client.Web.Angular\Release\PublishOutput</publishUrl>
<DeleteExistingFiles>False</DeleteExistingFiles>
</PropertyGroup>
</Project>
这会产生以下输出:
C:\Source\CCollections\src\CCollections.Client.Web.Angular>C:\Users\Christopher\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-final\bin\dnu.cmd发布 "C:\Source\CCollections\src\CCollections.Client.Web.Angular" --out "C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96" --configuration Release --runtime dnx-clr-win-x86.1.0.0-rc1-final --wwwroot "wwwroot" --wwwroot-out "wwwroot" --iis-command "web" Microsoft .NET 开发实用程序 Clr-x86-1.0.0-rc1-16202 在 project.json 中执行脚本“预发布” npm WARN package.json ASP.NET@0.0.0 无描述 npm WARN package.json ASP.NET@0.0.0 没有存储库字段。 npm WARN package.json ASP.NET@0.0.0 没有 README 数据 npm WARN package.json ASP.NET@0.0.0 没有许可字段。 npm WARN 未满足的依赖项 C:\Source\CCollections\src\CCollections.Client.Web.Angular\node_modules\gulp-cssmin\node_modules\gulp-util 需要 minimist@'^0.2.0' 但会加载 npm WARN 未满足的依赖项 C:\Source\CCollections\src\CCollections.Client.Web.Angular\node_modules\gulp-cssmin\node_modules\minimist, npm WARN 未满足的依赖项,即版本 1.1.1 npm WARN 未满足的依赖项 C:\Source\CCollections\src\CCollections.Client.Web.Angular\node_modules\gulp-cssmin\node_modules\through2 需要 readable-stream@'~1.0.17' 但会加载 npm WARN 未满足的依赖项 C:\Source\CCollections\src\CCollections.Client.Web.Angular\node_modules\gulp-cssmin\node_modules\readable-stream, npm WARN 未满足的依赖项,即版本 1.1.13 [12:15:37] 使用 gulpfile C:\Source\CCollections\src\CCollections.Client.Web.Angular\gulpfile.js [12:15:37] 开始'clean:js'... [12:15:37] 开始'clean:css'... [12:15:37] 8.17 毫秒后完成“干净:js” [12:15:37] 7.58 毫秒后完成“干净:css” [12:15:37] 开始“干净”... [12:15:37] 6.63 μs 后完成“清洁” [12:15:38] 使用 gulpfile C:\Source\CCollections\src\CCollections.Client.Web.Angular\gulpfile.js [12:15:38] 开始'min:js'... [12:15:38] 14 毫秒后完成 'min:js' [12:15:38] 开始'min:css'... [12:15:38] 3.02 毫秒后完成'min:css' [12:15:38] 开始“分钟”... [12:15:38] 6.03 μs 后完成“分钟” [12:15:40] 使用 gulpfile C:\Source\CCollections\src\CCollections.Client.Web.Angular\gulpfile.js [12:15:40] 开始'libcopy'... [12:15:40] 19 毫秒后完成“libcopy” 复制到输出路径 C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96 使用包依赖 Microsoft.AspNet.DataProtection.Abstractions 1.0.0-rc1-final 使用包依赖 Microsoft.CodeAnalysis.CSharp 1.1.0-rc1-20151109-01 使用包依赖 Microsoft.AspNet.Identity 3.0.0-rc1-final 使用包依赖 Microsoft.Extensions.Configuration.CommandLine 1.0.0-rc1-final 使用包依赖 Microsoft.Extensions.Logging.Console 1.0.0-rc1-final 使用包依赖 System.Runtime.InteropServices 4.0.0 使用包依赖 System.Diagnostics.Debug 4.0.0 使用包依赖 Microsoft.AspNet.Mvc.Razor.Host 6.0.0-rc1-final 源 C:\Users\Christopher\.dnx\packages\Microsoft.AspNet.Mvc.Razor.Host\6.0.0-rc1-final 目标 C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.AspNet.Mvc.Razor.Host\6.0.0-rc1-final 源 C:\Users\Christopher\.dnx\packages\System.Runtime.InteropServices\4.0.0 使用包依赖EntityFramework.Commands 7.0.0-rc1-final 源 C:\Users\Christopher\.dnx\packages\EntityFramework.Commands\7.0.0-rc1-final 目标 C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\EntityFramework.Commands\7.0.0-rc1-final 来源 C:\Users\Christopher\.dnx\packages\Microsoft.CodeAnalysis.CSharp\1.1.0-rc1-20151109-01 源 C:\Users\Christopher\.dnx\packages\Microsoft.Extensions.Configuration.CommandLine\1.0.0-rc1-final 目标 C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.Extensions.Configuration.CommandLine\1.0.0-rc1-final 源 C:\Users\Christopher\.dnx\packages\Microsoft.AspNet.DataProtection.Abstractions\1.0.0-rc1-final 目标 C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.AspNet.DataProtection.Abstractions\1.0.0-rc1-final 源 C:\Users\Christopher\.dnx\packages\System.Diagnostics.Debug\4.0.0 目标 C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\System.Diagnostics.Debug\4.0.0 使用包依赖 Microsoft.AspNet.Mvc.TagHelpers 6.0.0-rc1-final 源 C:\Users\Christopher\.dnx\packages\Microsoft.AspNet.Mvc.TagHelpers\6.0.0-rc1-final 目标 C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.AspNet.Mvc.TagHelpers\6.0.0-rc1-final 目标 C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.CodeAnalysis.CSharp\1.1.0-rc1-20151109-01 目标 C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\System.Runtime.InteropServices\4.0.0 使用包依赖 Microsoft.Extensions.Configuration.EnvironmentVariables 1.0.0-rc1-final 源 C:\Users\Christopher\.dnx\packages\Microsoft.Extensions.Configuration.EnvironmentVariables\1.0.0-rc1-final 源 C:\Users\Christopher\.dnx\packages\Microsoft.Extensions.Logging.Console\1.0.0-rc1-final 源 C:\Users\Christopher\.dnx\packages\Microsoft.AspNet.Identity\3.0.0-rc1-final 目标 C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.AspNet.Identity\3.0.0-rc1-final 目标 C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.Extensions.Configuration.EnvironmentVariables\1.0.0-rc1-final 使用包依赖 Microsoft.AspNet.Diagnostics 1.0.0-rc1-final 源 C:\Users\Christopher\.dnx\packages\Microsoft.AspNet.Diagnostics\1.0.0-rc1-final 目标 C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.AspNet.Diagnostics\1.0.0-rc1-final 使用包依赖EntityFramework.Core 7.0.0-rc1-final 使用包依赖 Microsoft.AspNet.Mvc.ViewFeatures 6.0.0-rc1-final 源 C:\Users\Christopher\.dnx\packages\Microsoft.AspNet.Mvc.ViewFeatures\6.0.0-rc1-final 目标 C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.AspNet.Mvc.ViewFeatures\6.0.0-rc1-final 目标 C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.Extensions.Logging.Console\1.0.0-rc1-final 使用包依赖 Microsoft.Dnx.Compilation.Abstractions 1.0.0-rc1-final 使用包依赖 Microsoft.Extensions.Configuration.FileExtensions 1.0.0-rc1-final 源 C:\Users\Christopher\.dnx\packages\Microsoft.Extensions.Configuration.FileExtensions\1.0.0-rc1-final 目标 C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.Extensions.Configuration.FileExtensions\1.0.0-rc1-final 使用包依赖 Microsoft.AspNet.Identity.EntityFramework 3.0.0-rc1-final 源 C:\Users\Christopher\.dnx\packages\Microsoft.AspNet.Identity.EntityFramework\3.0.0-rc1-final 源 C:\Users\Christopher\.dnx\packages\EntityFramework.Core\7.0.0-rc1-final 目标 C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\EntityFramework.Core\7.0.0-rc1-final 使用包依赖 System.Diagnostics.DiagnosticSource 4.0.0-beta-23516 使用包依赖 Microsoft.Extensions.Logging.Debug 1.0.0-rc1-final 源 C:\Users\Christopher\.dnx\packages\Microsoft.Extensions.Logging.Debug\1.0.0-rc1-final 目标 C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.Extensions.Logging.Debug\1.0.0-rc1-final 使用包依赖 Microsoft.AspNet.Diagnostics.Abstractions 1.0.0-rc1-final 源 C:\Users\Christopher\.dnx\packages\Microsoft.AspNet.Diagnostics.Abstractions\1.0.0-rc1-final 使用包依赖 Microsoft.AspNet.PageExecutionInstrumentation.Interfaces 1.0.0-rc1-final 源 C:\Users\Christopher\.dnx\packages\Microsoft.AspNet.PageExecutionInstrumentation.Interfaces\1.0.0-rc1-final 目标 C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.AspNet.PageExecutionInstrumentation.Interfaces\1.0.0-rc1-final 使用包依赖 Microsoft.Extensions.Configuration.FileProviderExtensions 1.0.0-rc1-final 源 C:\Users\Christopher\.dnx\packages\Microsoft.Dnx.Compilation.Abstractions\1.0.0-rc1-final 目标 C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.Dnx.Compilation.Abstractions\1.0.0-rc1-final 目标 C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.AspNet.Identity.EntityFramework\3.0.0-rc1-final 目标 C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.AspNet.Diagnostics.Abstractions\1.0.0-rc1-final 使用包依赖 System.Text.Encoding 4.0.0 源 C:\Users\Christopher\.dnx\packages\System.Text.Encoding\4.0.0 目标 C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\System.Text.Encoding\4.0.0 源 C:\Users\Christopher\.dnx\packages\System.Diagnostics.DiagnosticSource\4.0.0-beta-23516 目标 C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\System.Diagnostics.DiagnosticSource\4.0.0-beta-23516 源 C:\Users\Christopher\.dnx\packages\Microsoft.Extensions.Configuration.FileProviderExtensions\1.0.0-rc1-final 目标 C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.Extensions.Configuration.FileProviderExtensions\1.0.0-rc1-final 错误:指定的路径、文件名或两者都太长。完全限定文件名必须少于 260 个字符,目录名必须少于 248 个字符。 错误:指定的路径、文件名或两者都太长。完全限定文件名必须少于 260 个字符,目录名必须少于 248 个字符。 C:\Source\CCollections\src\CCollections.Client.Web.Angular>
我想我的问题在这里:C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\
我需要使用较短的路径,例如 C:\Temp。
我已经尝试了其他堆栈溢出答案中的一些建议。
添加<AspnetCompileMergeIntermediateOutputPath>c:\shortPath\</AspnetCompileMergeIntermediateOutputPath>
到个人资料似乎没有帮助。
添加<IntermediateOutputPath>..\Temp</IntermediateOutputPath>
似乎也不起作用。
我猜这是因为这些设置被 MSBuild 拾取,而不是 dnu 发布。
那么如何告诉 dnu publish 在 C:\Temp 而不是我的 appdata 目录中构建包?
更新:找到罪魁祸首:我认为超出路径限制的文件不在上面的日志中,并且只记录了成功的副本。为了检验这个假设:
- 我通过手动运行 dnu publish 部署到 c:\temp
- 将文件从 c:\temp 复制到 C:\Users\Christopher\AppData\Local\Temp\PublishTemp
运行脚本以递归方式迭代所有文件并输出超过 248 个字符的路径长度。结果:
C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.Extensions.Configuration.FileProviderExtensions\1.0.0-rc1-final\lib\net451\Microsoft.Extensions .Configuration.FileProviderExtensions.dll
文件路径长:249 个字符
C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.Extensions.Configuration.FileProviderExtensions\1.0.0-rc1-final\lib\netcore50\Microsoft.Extensions .Configuration.FileProviderExtensions.dll
文件路径长:252 个字符
最大的文件夹是 191 个字符,文件是 252 个字符,因此分别不超过 240 和 260 个字符。
不管这一切,我如何告诉 Visual Studio 2015 使用“C:\temp”作为它的临时目录,而不是我的配置文件的临时目录?