Visual Studio - Illegal characters on the way

This happens after the last update of Visual Studio Community 2017. Each time I try to open my project, I get the following warning:

Warning IDE0006 Error loading project. Some project features, such as a complete analysis of solutions for a failed project and projects that depend on it, were disabled. Core.tests

Then, when I run build, I get:

Error Failed to complete the ResolvePackageFileConflicts task. System.ArgumentException: Illegal characters in the path.
in System.IO.Path.CheckInvalidPathChars (String path, Boolean checkAdditional)
in System.IO.Path.GetFileName (line path)
in Microsoft.NET.Build.Tasks.ItemUtilities.GetTargetPath (ITaskItem element)
in Microsoft.NET.Build.Tasks.ItemUtilities.GetReferenceTargetPath (ITaskItem element)
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

and then

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

The path to the project is only in Latin characters. The assembly server works on the assembly, but on my computer, after the last update, VS is not. I tried reinstalling VS, but that didn't help.

So, are there any solutions, or at least a hint of this problem?

EDIT: I tried to exclude files affected by this issue and it worked. But this is not a solution to my problem. Interestingly, only the affected files are unit tests.

EDIT2: I tried to build the whole solution on fresh Windows 10 with the latest version of Visual Studio 2017, and it does not work, so this is obviously my problem with the solution, but only in the new version of VS. I tried my solution on Visual Studio 2015 and worked fine.

Anyway, here is an example of the Core.Test.csproj file, which is one of them that cause this problem. https://pastebin.com/kq7MFLV1

ScreenShot errors from this project.

+5
source share
4 answers

In your case, the problem is returning the string in the following link:

 <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> 

Change this to:

  <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> 
+6
source

I had a similar problem, but in my case it was a weird character in Reference:

 <Reference Include="Office, Version=11.0.0.0, &#xD;&#xA; Culture=neutral, PublicKeyToken=71e9bce111e9429c" /> <Reference Include="stdole, Version=7.0.3300.0, &#xD;&#xA; Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 

Change above:

 <Reference Include="Office, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" /> <Reference Include="stdole, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 

Fixed this specific issue.

Tip. I resolved this with trial and error. I commented out all the elements in the csproj file and re-introduced them one by one. Despite the fact that your project may not be created during this process, it becomes clear when the error is higher, because you will see only this error and not other build errors due to the lack of elements.

+2
source

@Delfi - I updated VS 2017 on Friday 2017-08-18 and started getting the same "ResolvePackageFileConflicts" error today on some projects. I noticed that the problem occurs when any link in the .csproj file has a Hintpath. After using Notepad to remove the Hintpath from the affected links, assemblies now work fine.

This seems to be the problem with the latest VS 2017 update. Visual C # 2017 00369-60000-00001-AA019 Microsoft Visual C # 2017

Example:

 <Reference Include="Atalasoft.dotImage.WinControls, Version=10.0.6.53316, Culture=neutral, PublicKeyToken=2b02b46f7326f73b, processorArchitecture=x86"> <HintPath>..\..\..\..\..\Program Files\Atalasoft\DotImage 10.0\bin\4.0\Atalasoft.dotImage.WinControls.dll</HintPath> <SpecificVersion>False</SpecificVersion> </Reference> 

Changed ...

 *<Reference Include="Atalasoft.dotImage.WinControls, Version=10.5.0.61849, Culture=neutral, PublicKeyToken=2b02b46f7326f73b, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> </Reference>* 

Hope this helps you solve your problem.

Note. I have not tried, but this could also be fixed by removing and re-adding the affected links in the project through the solution explorer.

+1
source

I also had a problem with this line

  <HintPath>&gt;$(SolutionDir).lib\Foo.Bar.dll</HintPath> 

Removing &gt; worked for me.

  <HintPath>$(SolutionDir).lib\Foo.Bar.dll</HintPath> 
0
source

Source: https://habr.com/ru/post/1271054/


All Articles