这似乎是一个常见问题,我发现了几个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。
我已尝试过其他堆栈溢出答案中的一些建议。
向个人资料添加<AspnetCompileMergeIntermediateOutputPath>c:\shortPath\</AspnetCompileMergeIntermediateOutputPath>
似乎无济于事。
添加<IntermediateOutputPath>..\Temp</IntermediateOutputPath>
似乎也不起作用。
我猜是因为这些设置被MSBuild接收,但不是dnu发布。
那么如何告诉dnu发布在C:\ Temp而不是我的appdata目录中构建包?
更新:找到罪魁祸首:我认为超出路径限制的文件不在上面的日志中,并且只记录成功的副本。为了验证这个假设:
运行脚本以递归方式迭代所有文件,并输出超过248个字符的路径长度。结果:
C:\用户\克里斯托弗\应用程序数据\本地\ TEMP \ PublishTemp \ CCollections.Client.Web.Angular96 \为approot \包\ Microsoft.Extensions.Configuration.FileProviderExtensions \ 1.0.0-RC1-最终\ lib中\ net451 \ Microsoft.Extensions.Configuration.FileProviderExtensions.dll
文件路径长:249个字符
C:\用户\克里斯托弗\应用程序数据\本地\ TEMP \ PublishTemp \ CCollections.Client.Web.Angular96 \为approot \包\ Microsoft.Extensions.Configuration.FileProviderExtensions \ 1.0.0-RC1-最终\ lib中\ netcore50 \ Microsoft.Extensions.Configuration.FileProviderExtensions.dll
文件路径长:252个字符
最大的文件夹是191个字符,文件是252个字符,因此分别不超过240个和260个字符。
无论如何,我如何告诉Visual Studio 2015使用“C:\ temp”作为临时目录,而不是我的个人资料的临时目录?
答案 0 :(得分:34)
将临时输出更改为路径名较短的路径。
.pubxml
中打开您的目标.\Properties\PublishProfiles
文本编辑器。PublishOutputPathNoTrailingSlash
下的PropertyGroup
并设置了<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishOutputPathNoTrailingSlash>C:\Temp\Publish</PublishOutputPathNoTrailingSlash>
</PropertyGroup>
</Project>
价值到你想要的路径。{{1}}
答案 1 :(得分:1)
对于project.json中的新asp.net mvc 6,请使用
"exclude": [ "wwwroot", "node_modules" ],`
"publishExclude": [ "**.user", "**.vspscc" ]
答案 2 :(得分:0)
我认为这是你正在寻找的东西:
当你进入&#34;发布网络&#39;对话框,您需要更改目标位置&#39;在&#34;连接&#34;标签。 (用方块框打...)然后浏览到C:\ Temp,你的文件就在那里......
对话框不允许你动态创建C:\ Temp,所以如果你还没有创建它,你需要事先这样做。
我希望这样做。