这似乎是一个普遍的问题,我在 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 publish "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 Development Utility Clr-x86-1.0.0-rc1-16202
Executing script 'prepublish' in project.json npm WARN package.json ASP.NET@0.0.0 No description npm WARN package.json ASP.NET@0.0.0 No repository field. npm WARN package.json ASP.NET@0.0.0 No README data npm WARN package.json ASP.NET@0.0.0 No license field. npm WARN unmet dependency C:\Source\CCollections\src\CCollections.Client.Web.Angular\node_modules\gulp-cssmin\node_modules\gulp-util requires minimist@'^0.2.0' but will load npm WARN unmet dependency C:\Source\CCollections\src\CCollections.Client.Web.Angular\node_modules\gulp-cssmin\node_modules\minimist, npm WARN unmet dependency which is version 1.1.1 npm WARN unmet dependency C:\Source\CCollections\src\CCollections.Client.Web.Angular\node_modules\gulp-cssmin\node_modules\through2 requires readable-stream@'~1.0.17' but will load npm WARN unmet dependency C:\Source\CCollections\src\CCollections.Client.Web.Angular\node_modules\gulp-cssmin\node_modules\readable-stream, npm WARN unmet dependency which is version 1.1.13 [12:15:37] Using gulpfile C:\Source\CCollections\src\CCollections.Client.Web.Angular\gulpfile.js [12:15:37] Starting 'clean:js'... [12:15:37] Starting 'clean:css'... [12:15:37] Finished 'clean:js' after 8.17 ms [12:15:37] Finished 'clean:css' after 7.58 ms [12:15:37] Starting 'clean'... [12:15:37] Finished 'clean' after 6.63 μs [12:15:38] Using gulpfile C:\Source\CCollections\src\CCollections.Client.Web.Angular\gulpfile.js [12:15:38] Starting 'min:js'... [12:15:38] Finished 'min:js' after 14 ms [12:15:38] Starting 'min:css'... [12:15:38] Finished 'min:css' after 3.02 ms [12:15:38] Starting 'min'... [12:15:38] Finished 'min' after 6.03 μs [12:15:40] Using gulpfile C:\Source\CCollections\src\CCollections.Client.Web.Angular\gulpfile.js [12:15:40] Starting 'libcopy'... [12:15:40] Finished 'libcopy' after 19 ms Copying to output path C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96 Using Package dependency Microsoft.AspNet.DataProtection.Abstractions 1.0.0-rc1-final Using Package dependency Microsoft.CodeAnalysis.CSharp 1.1.0-rc1-20151109-01 Using Package dependency Microsoft.AspNet.Identity 3.0.0-rc1-final Using Package dependency Microsoft.Extensions.Configuration.CommandLine 1.0.0-rc1-final Using Package dependency Microsoft.Extensions.Logging.Console 1.0.0-rc1-final Using Package dependency System.Runtime.InteropServices 4.0.0 Using Package dependency System.Diagnostics.Debug 4.0.0 Using Package dependency Microsoft.AspNet.Mvc.Razor.Host 6.0.0-rc1-final Source C:\Users\Christopher\.dnx\packages\Microsoft.AspNet.Mvc.Razor.Host\6.0.0-rc1-final Target C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.AspNet.Mvc.Razor.Host\6.0.0-rc1-final Source C:\Users\Christopher\.dnx\packages\System.Runtime.InteropServices\4.0.0 Using Package dependency EntityFramework.Commands 7.0.0-rc1-final Source C:\Users\Christopher\.dnx\packages\EntityFramework.Commands\7.0.0-rc1-final Target C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\EntityFramework.Commands\7.0.0-rc1-final Source C:\Users\Christopher\.dnx\packages\Microsoft.CodeAnalysis.CSharp\1.1.0-rc1-20151109-01 Source C:\Users\Christopher\.dnx\packages\Microsoft.Extensions.Configuration.CommandLine\1.0.0-rc1-final Target C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.Extensions.Configuration.CommandLine\1.0.0-rc1-final Source C:\Users\Christopher\.dnx\packages\Microsoft.AspNet.DataProtection.Abstractions\1.0.0-rc1-final Target C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.AspNet.DataProtection.Abstractions\1.0.0-rc1-final Source C:\Users\Christopher\.dnx\packages\System.Diagnostics.Debug\4.0.0 Target C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\System.Diagnostics.Debug\4.0.0 Using Package dependency Microsoft.AspNet.Mvc.TagHelpers 6.0.0-rc1-final Source C:\Users\Christopher\.dnx\packages\Microsoft.AspNet.Mvc.TagHelpers\6.0.0-rc1-final Target C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.AspNet.Mvc.TagHelpers\6.0.0-rc1-final Target C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.CodeAnalysis.CSharp\1.1.0-rc1-20151109-01 Target C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\System.Runtime.InteropServices\4.0.0 Using Package dependency Microsoft.Extensions.Configuration.EnvironmentVariables 1.0.0-rc1-final Source C:\Users\Christopher\.dnx\packages\Microsoft.Extensions.Configuration.EnvironmentVariables\1.0.0-rc1-final Source C:\Users\Christopher\.dnx\packages\Microsoft.Extensions.Logging.Console\1.0.0-rc1-final Source C:\Users\Christopher\.dnx\packages\Microsoft.AspNet.Identity\3.0.0-rc1-final Target C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.AspNet.Identity\3.0.0-rc1-final Target C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.Extensions.Configuration.EnvironmentVariables\1.0.0-rc1-final Using Package dependency Microsoft.AspNet.Diagnostics 1.0.0-rc1-final Source C:\Users\Christopher\.dnx\packages\Microsoft.AspNet.Diagnostics\1.0.0-rc1-final Target C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.AspNet.Diagnostics\1.0.0-rc1-final Using Package dependency EntityFramework.Core 7.0.0-rc1-final Using Package dependency Microsoft.AspNet.Mvc.ViewFeatures 6.0.0-rc1-final Source C:\Users\Christopher\.dnx\packages\Microsoft.AspNet.Mvc.ViewFeatures\6.0.0-rc1-final Target C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.AspNet.Mvc.ViewFeatures\6.0.0-rc1-final Target C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.Extensions.Logging.Console\1.0.0-rc1-final Using Package dependency Microsoft.Dnx.Compilation.Abstractions 1.0.0-rc1-final Using Package dependency Microsoft.Extensions.Configuration.FileExtensions 1.0.0-rc1-final Source C:\Users\Christopher\.dnx\packages\Microsoft.Extensions.Configuration.FileExtensions\1.0.0-rc1-final Target C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.Extensions.Configuration.FileExtensions\1.0.0-rc1-final Using Package dependency Microsoft.AspNet.Identity.EntityFramework 3.0.0-rc1-final Source C:\Users\Christopher\.dnx\packages\Microsoft.AspNet.Identity.EntityFramework\3.0.0-rc1-final Source C:\Users\Christopher\.dnx\packages\EntityFramework.Core\7.0.0-rc1-final Target C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\EntityFramework.Core\7.0.0-rc1-final Using Package dependency System.Diagnostics.DiagnosticSource 4.0.0-beta-23516 Using Package dependency Microsoft.Extensions.Logging.Debug 1.0.0-rc1-final Source C:\Users\Christopher\.dnx\packages\Microsoft.Extensions.Logging.Debug\1.0.0-rc1-final Target C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.Extensions.Logging.Debug\1.0.0-rc1-final
Using Package dependency Microsoft.AspNet.Diagnostics.Abstractions 1.0.0-rc1-final Source C:\Users\Christopher\.dnx\packages\Microsoft.AspNet.Diagnostics.Abstractions\1.0.0-rc1-final Using Package dependency Microsoft.AspNet.PageExecutionInstrumentation.Interfaces 1.0.0-rc1-final Source C:\Users\Christopher\.dnx\packages\Microsoft.AspNet.PageExecutionInstrumentation.Interfaces\1.0.0-rc1-final Target C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.AspNet.PageExecutionInstrumentation.Interfaces\1.0.0-rc1-final Using Package dependency Microsoft.Extensions.Configuration.FileProviderExtensions 1.0.0-rc1-final Source C:\Users\Christopher\.dnx\packages\Microsoft.Dnx.Compilation.Abstractions\1.0.0-rc1-final Target C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.Dnx.Compilation.Abstractions\1.0.0-rc1-final Target C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.AspNet.Identity.EntityFramework\3.0.0-rc1-final Target C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.AspNet.Diagnostics.Abstractions\1.0.0-rc1-final Using Package dependency System.Text.Encoding 4.0.0 Source C:\Users\Christopher\.dnx\packages\System.Text.Encoding\4.0.0 Target C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\System.Text.Encoding\4.0.0 Source C:\Users\Christopher\.dnx\packages\System.Diagnostics.DiagnosticSource\4.0.0-beta-23516 Target C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\System.Diagnostics.DiagnosticSource\4.0.0-beta-23516 Source C:\Users\Christopher\.dnx\packages\Microsoft.Extensions.Configuration.FileProviderExtensions\1.0.0-rc1-final Target C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\approot\packages\Microsoft.Extensions.Configuration.FileProviderExtensions\1.0.0-rc1-final Error: 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. Error: 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.
C:\Source\CCollections\src\CCollections.Client.Web.Angular>
我认为我的问题在这里:C:\Users\Christopher\AppData\Local\Temp\PublishTemp\CCollections.Client.Web.Angular96\
我需要使用一个更短的路径,比如C:\Temp。
我尝试了其他stackoverflow答案中的一些建议。
将<AspnetCompileMergeIntermediateOutputPath>c:\shortPath\</AspnetCompileMergeIntermediateOutputPath>
添加到配置文件中似乎没有帮助。
添加<IntermediateOutputPath>..\Temp</IntermediateOutputPath>
也似乎不起作用。
我猜这是因为这些设置被MSBuild捕获,但并没有被dnu publish捕获。
那么,我该如何告诉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"作为其临时目录,而不是我的个人资料的临时目录?
-o
(或者如果你想更明确一些,可以使用--output
)开关吗? - Dealdiane--out
的别名,我已经在使用了。我理解这个错误的性质,并且当我手动运行此命令时,部署到较短的路径(如c:\inetpub\site
)可以正常工作。我的问题是,当我使用Visual Studio的发布功能时,如何让它提供不同的目录。它正在使用那个长的临时目录,我不知道如何告诉它使用一个不同、更短的临时目录来执行dnu publish
。 - Chris