Visual Studio-路径中的非法字符 [英] Visual Studio- Illegal characters in path

查看:1133
本文介绍了Visual Studio-路径中的非法字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是在Visual Studio Community 2017最新更新之后发生的. 每次尝试打开项目时,都会收到以下警告:

This happen after Visual Studio Community 2017 latest update. Every time I try to open my project I get following warning:

警告IDE0006加载项目时遇到错误.某些项目功能(例如,针对失败项目的完整解决方案分析以及依赖该项目的项目)已被禁用.核心测试

Warning IDE0006 Error encountered while loading the project. Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled. Core.Tests

然后,当我运行构建时,我得到:

Then when I run build I get:

错误"ResolvePackageFileConflicts"任务意外失败. System.ArgumentException:路径中的非法字符.
在System.IO.Path.CheckInvalidPathChars(字符串路径,布尔值checkAdditional)
在System.IO.Path.GetFileName(字符串路径)
在Microsoft.NET.Build.Tasks.ItemUtilities.GetTargetPath(ITaskItem项目)
在Microsoft.NET.Build.Tasks.ItemUtilities.GetReferenceTargetPath(ITaskItem项目)
在Microsoft.NET.Build.Tasks.ConflictResolution.ResolvePackageFileConflicts中. < ExecuteCore> b__35_1(ConflictItem ci)
在Microsoft.NET.Build.Tasks.ConflictResolution.ConflictResolver`1.ResolveConflicts(IEnumerable`1flictItems,Func`2 getItemKey,Action`1 foundConflict,Boolean commitWinner,Action`1 unresolvedConflict)中
在Microsoft.NET.Build.Tasks.ConflictResolution.ResolvePackageFileConflicts.ExecuteCore()
在Microsoft.NET.Build.Tasks.TaskBase.Execute()
在Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
在Microsoft.Build.BackEnd.TaskBuilder中. ExecuteInstantiatedTask> d__26.MoveNext()Core.Tests

Error The "ResolvePackageFileConflicts" task failed unexpectedly. System.ArgumentException: Illegal characters in path.
at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
at System.IO.Path.GetFileName(String path)
at Microsoft.NET.Build.Tasks.ItemUtilities.GetTargetPath(ITaskItem item)
at Microsoft.NET.Build.Tasks.ItemUtilities.GetReferenceTargetPath(ITaskItem item)
at Microsoft.NET.Build.Tasks.ConflictResolution.ResolvePackageFileConflicts.<>c. < ExecuteCore > b__35_1(ConflictItem ci)
at Microsoft.NET.Build.Tasks.ConflictResolution.ConflictResolver`1.ResolveConflicts(IEnumerable`1 conflictItems, Func`2 getItemKey, Action`1 foundConflict, Boolean commitWinner, Action`1 unresolvedConflict)
at Microsoft.NET.Build.Tasks.ConflictResolution.ResolvePackageFileConflicts.ExecuteCore()
at Microsoft.NET.Build.Tasks.TaskBase.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.< ExecuteInstantiatedTask >d__26.MoveNext() Core.Tests

然后是

找不到错误CS0006元数据文件'C:\ tmp \ backend \ Tests \ DataLoader.Tests \ bin \ Debug \ DataLoader.Tests.dll'EResourceConnector.Tests C:\ tmp \ backend \ Tests \ EResourceConnector.Tests \ CSC 1有效

Error CS0006 Metadata file 'C:\tmp\backend\Tests\DataLoader.Tests\bin\Debug\DataLoader.Tests.dll' could not be found EResourceConnector.Tests C:\tmp\backend\Tests\EResourceConnector.Tests\CSC 1 Active

项目的路径只能使用拉丁字符.在构建服务器上,构建工作正常,但是在上次更新VS之后,在我的计算机上却无法运行.我试图重新安装VS,但这没有帮助.

Path to the project is in latin only characters. On the build server build is working but on my computer after last update of VS is not. I've tried to reinstall VS but that didn't help.

那么这个问题是否有解决方案或至少有提示?

So is there any solutions or at least hint for this issue?

我试图排除受此问题影响且有效的文件.但这不是解决我的问题的方法. 有趣的是,只有受影响的文件才是单元测试.

I tried to exclude files which are affected by this issue and that worked. But that is not solution for my problem. Interesting is, that are only affected files are unit tests.

我试图在带有最新Visual Studio 2017的新Windows 10上构建整个解决方案,但该解决方案失败了,因此这显然是我解决方案的问题,但仅在VS的新版本中.我在Visual Studio 2015上尝试了我的解决方案,并且构建正常.

I tried to build whole solution on the fresh Windows 10 with latest Visual Studio 2017 and it's failing so it is obviously my solution's problem but only in the new version of VS. I tried my solution on the Visual Studio 2015 and build worked fine.

无论如何,例如,这是Core.Test.csproj文件,它是导致该问题的原因之一. https://pastebin.com/kq7MFLV1

Anyway, here's for example Core.Test.csproj file which is one of these that are causing that issue. https://pastebin.com/kq7MFLV1

推荐答案

在您的情况下,问题是该行在以下引用中返回:

In your case the problem is the line returns in the following reference:

<Reference Include="System.Collections.Immutable, Version=1.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
      <HintPath>
      ..\..\packages\System.Collections.Immutable.1.3.1\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll
      </HintPath>
</Reference>

将此更改为:

 <Reference Include="System.Collections.Immutable, Version=1.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
      <HintPath>..\..\packages\System.Collections.Immutable.1.3.1\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
 </Reference>

这篇关于Visual Studio-路径中的非法字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆