Luk*_*s F 6 c# visual-studio visual-studio-2017
这发生在Visual Studio Community 2017最新更新之后.每当我尝试打开我的项目时,我都会收到以下警告:
警告IDE0006加载项目时遇到错误.某些项目功能(例如失败项目的完整解决方案分析和依赖它的项目)已被禁用.Core.Tests
然后,当我运行构建时,我得到:
错误"ResolvePackageFileConflicts"任务意外失败.System.ArgumentException:路径中的非法字符.
位于 Microsoft.NET.Build的Microsoft.NET.Build.Tasks.ItemUtilities.GetTargetPath(ITaskItem项目)的
System.IO.Path.GetFileName(String path)上的System.IO.Path.CheckInvalidPathChars(String path,Boolean checkAdditional) . Microsoft.Build.Tasks.ConflictResolution.ResolvePackageFileConflicts中的Tasks.ItemUtilities.GetReferenceTargetPath(ITaskItem项).<> c. 在Microsoft.NET.Build.Tasks.ConflictResolution.ConflictResolver`1.ResolveConflicts(IEnumerable`1 conflictItems,Func`2 getItemKey,Action`1 foundConflict,Boolean commitWinner,Action`1 unresolvedConflict) 中的<ExecuteCore> b__35_1(ConflictItem ci) Microsoft的Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() 中的Microsoft.NET.Build.Tasks.TaskBase.Execute() 中的.NET.Build.Tasks.ConflictResolution.ResolvePackageFileConflicts.ExecuteCore().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活性
项目的路径仅限拉丁字符.在构建服务器上构建正在运行,但是在VS的最后一次更新之后,我的计算机上没有.我试图重新安装VS,但这没有帮助.
那么这个问题是否有任何解决方案或至少暗示?
编辑:我试图排除受此问题影响且有效的文件.但这不是我的问题的解决方案.有趣的是,只有受影响的文件才是单元测试.
编辑2:我尝试使用最新的Visual Studio 2017在新的Windows 10上构建完整的解决方案,但它失败了所以这显然是我的解决方案的问题,但仅限于新版本的VS. 我在Visual Studio 2015上尝试了我的解决方案并且构建工作正常.
无论如何,这里是例如Core.Test.csproj导致该问题的文件之一.https://pastebin.com/kq7MFLV1
在您的情况下,问题是以下引用中的行返回:
<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>
Run Code Online (Sandbox Code Playgroud)
将其更改为:
<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>
Run Code Online (Sandbox Code Playgroud)
我有一个类似的问题但在我的情况下,它是由参考中的奇怪字符:
<Reference Include="Office, Version=11.0.0.0, 
 Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<Reference Include="stdole, Version=7.0.3300.0, 
 Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
Run Code Online (Sandbox Code Playgroud)
将以上内容更改为:
<Reference Include="Office, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<Reference Include="stdole, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
Run Code Online (Sandbox Code Playgroud)
解决了这个特殊问题.
提示:我通过反复试验解决了这个问题.我注释掉了csproj文件中的所有ItemGroup并逐个重新引入它们.虽然您的项目可能无法在此过程中构建,但很明显上述错误发生时,您将看到此错误,而不是由于缺少ItemGroup而导致的其他构建错误.
| 归档时间: |
|
| 查看次数: |
6796 次 |
| 最近记录: |