简体   繁体   English

VS19中发布错误“找不到路径的一部分”的原因(错误:MSB3027,MSB3021)?

[英]Reason for publishing error “could not find a part of the path” in VS19 (Errors: MSB3027, MSB3021)?

There are several questions posted about this, but I tried many of the solutions and it did not fix my issue.关于此问题发布了几个问题,但我尝试了许多解决方案,但并没有解决我的问题。

The issue is when I publish my ASP.NET Core 2.2 project, I get this error (formatted for easier readability):问题是当我发布我的 ASP.NET Core 2.2 项目时,我收到此错误(为便于阅读而格式化):

Unable to copy file "C:\Users\lfirstname\TFS\dotnet\Project Name\Project Name\Dev\LFirstname\BranchName\Project Name\Website\wwwroot\lib\jquery-validation-unobtrusive\jquery.validate.unobtrusive.min.js"  
 
to  
 
"C:\Users\lfirstname\TFS\dotnet\Project Name\Project Name\Dev\LFirstname\BranchName\Project Name\Website\obj\Release\netcoreapp2.2\win-x64\PubTmp\Out\wwwroot\lib\jquery-validation-unobtrusive\jquery.validate.unobtrusive.min.js".  
 
Could not find a part of the path  
 
'C:\Users\lfirstname\TFS\dotnet\Project Name\Project Name\Dev\LFirstname\BranchName\Project Name\Website\obj\Release\netcoreapp2.2\win-x64\PubTmp\Out\wwwroot\lib\jquery-validation-unobtrusive\jquery.validate.unobtrusive.min.js'.

In the publish output I get warning MSB3026, and errors MSB3027 and MSB3021.在发布 output 中,我收到警告 MSB3026,以及错误 MSB3027 和 MSB3021。

The only way I managed to go around it is by branching out of the branch I was trying to publish.我设法围绕它进行 go 的唯一方法是分支出我试图发布的分支。 Then, in the new branch, publishing was successful.然后,在新的分支中,发布成功。 However, this is an inconsistent fix because at one point I had to branch out of the original branch again, and I had similar errors when publishing the new one (this time it was picking on some other files in addition to jquery).但是,这是一个不一致的修复,因为有一次我不得不再次从原始分支分支出来,并且在发布新分支时我遇到了类似的错误(这次它选择了除了 jquery 之外的一些其他文件)。

I'm wondering why is this happening and why does branching out (sometimes) fix it?我想知道为什么会发生这种情况以及为什么分支(有时)会解决它?

Some of the other things I tried that did not work:我尝试过的其他一些不起作用的事情:

  • cleaning and rebuilding project and solution清洁和重建项目和解决方案
  • restarting VS and the PC重启VS和PC
  • deleting obj and bin folders in the solution删除解决方案中的objbin文件夹
  • deleting local copy of project (and its parent folders) and getting latest in TFS删除项目(及其父文件夹)的本地副本并获取最新的 TFS
  • creating a new publish profile创建新的发布配置文件

EDIT: When I make a new branch, it publishes successfully and the output is like this编辑:当我创建一个新分支时,它会成功发布,output 是这样的

Website -> C:\Users\lfirstname\TFS\dotnet\Project Name\Project Name\Dev\LFirstname\BranchName\Project Name\Website\bin\Release\netcoreapp2.2\win-x64\Website.dll
Website -> C:\Users\lfirstname\TFS\dotnet\Project Name\Project Name\Dev\LFirstname\BranchName\Project Name\Website\bin\Release\netcoreapp2.2\win-x64\Website.Views.dll
Website -> C:\Users\lfirstname\TFS\dotnet\Project Name\Project Name\Dev\LFirstname\BranchName\Project Name\Website\obj\Release\netcoreapp2.2\win-x64\PubTmp\Out\
Web App was published successfully file:///C:/Users/lfirstname/TFS/dotnet/Project%20Name/Project%20Name/Dev/LFirstname/BranchName/Project%20Name/Website/bin/Release/netcoreapp2.2/publish/

Just wanted to say that I noticed it's the third line that starts failing and giving me errors about about not being able to copy jquery js file.只是想说我注意到第三行开始失败并给我关于无法复制 jquery js 文件的错误。

EDIT 2: I'm encountering this issue yet again.编辑2:我又遇到了这个问题。 This time I noticed that only one of the publish profile's configuration settings encounters this error.这次我注意到只有一个发布配置文件的配置设置遇到了这个错误。 But on my coworkers machine the same code publishes fine with the configuration.但是在我的同事机器上,相同的代码可以通过配置正常发布。

With lots of help, I finally know what the problem was.在很多帮助下,我终于知道问题出在哪里了。 Due to the project's location and certain JS libraries, some of the file paths were over 260 characters (the limit for Windows 10), resulting in failure to publish some files.由于项目所在位置和某些JS库,部分文件路径超过260个字符(Windows 10的限制),导致部分文件无法发布。

The solution is to make Windows 10 accept file paths over 260 characters .解决方案是让 Windows 10 接受超过 260 个字符的文件路径

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 MSB3021 在 Visual Studio 中运行 Service Fabric 应用时无法复制文件找不到部分路径错误 - MSB3021 Unable to copy file could not find part of path error when running Service Fabric app in Visual Studio Azure Devops 上的 Msbuild 任务:无法创建 /bin/debug,因为已存在同名的文件或目录。 (MSB3021、MSB3026、MSB3027) - Msbuild Task on Azure Devops: Cannot create /bin/debug because a file or directory with the same name already exists. (MSB3021, MSB3026, MSB3027) 错误 MSB3027:无法将“C:\\pagefile.sys”复制到“bin\\roslyn\\pagefile.sys”。 超过 10 次重试次数。失败 - Error MSB3027: Could not copy “C:\pagefile.sys” to “bin\roslyn\pagefile.sys”. Exceeded retry count of 10. Failed VS2013-Msbuild失败错误MSB3086:找不到AL.exe - VS2013 - Msbuild fails Error MSB3086: Could not find AL.exe VS2015 MSB3884 警告:找不到规则集文件 - VS2015 MSB3884 warning: Could not find rule set file 错误MSB3147:找不到所需的文件'setup.bin'发布到本地失败 - error MSB3147: Could not find required file 'setup.bin' Publish to Local FAILURE Teamcity:错误MSB3147:找不到所需的文件'setup.bin' - Teamcity: error MSB3147: Could not find required file 'setup.bin' MSBuild 错误 MSB4096 开始看似无缘无故地发生了 - MSBuild Error MSB4096 started hapening seemingly without reason 发布错误:使用dotnet publish的MSB4019 - Publishing Error: MSB4019 using dotnet publish MSB 构建错误 - MSB building error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM