Skip to content
This repository has been archived by the owner on May 17, 2024. It is now read-only.

FileNotFoundException trying to load assembly System.Configuration.ConfigurationManager #169

Closed
paulomorgado opened this issue Dec 19, 2019 · 11 comments · Fixed by #197
Closed

Comments

@paulomorgado
Copy link

First time I tried, I got:

System.IO.FileNotFoundException: Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
File name: 'System.Configuration.ConfigurationManager, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
   at Microsoft.Build.Evaluation.ToolsetConfigurationReader..ctor(PropertyDictionary`1 environmentProperties, PropertyDictionary`1 globalProperties)
   at Microsoft.Build.Evaluation.ToolsetReader.ReadAllToolsets(Dictionary`2 toolsets, ToolsetRegistryReader registryReader, ToolsetConfigurationReader configurationReader, PropertyDictionary`1 environmentProperties, PropertyDictionary`1 globalProperties, ToolsetDefinitionLocations locations)
   at Microsoft.Build.Evaluation.ProjectCollection.InitializeToolsetCollection(ToolsetRegistryReader registryReader, ToolsetConfigurationReader configReader)
   at Microsoft.Build.Evaluation.ProjectCollection..ctor(IDictionary`2 globalProperties, IEnumerable`1 loggers, IEnumerable`1 remoteLoggers, ToolsetDefinitionLocations toolsetDefinitionLocations, Int32 maxNodeCount, Boolean onlyLogCriticalEvents, Boolean loadProjectsReadOnly)
   at MSBuild.Abstractions.MSBuildWorkspace..ctor(ImmutableArray`1 paths, Boolean noBackup) in /_/src/MSBuild.Abstractions/MSBuildWorkspace.cs:line 23
   at MSBuild.Abstractions.MSBuildWorkspaceLoader.LoadWorkspace(String path, Boolean noBackup) in /_/src/MSBuild.Abstractions/MSBuildWorkspaceLoader.cs:line 45
   at MSBuild.Conversion.Program.Run(String project, String workspace, String msbuildPath, Boolean diffOnly, Boolean noBackup) in /_/src/try-convert/Program.cs:line 73

What am I missing here?

@cartermp
Copy link
Contributor

Do you have a repro project?

@jmarolf
Copy link
Contributor

jmarolf commented Dec 19, 2019

@paulomorgado which version of the .NET Core SDK and Visual Studio 2019 do you have installed? We need to load your project with the desktop version of MSBuild to do the conversion and it looks like something is blowing up in the process of doing that.

@Sappharad
Copy link

Sappharad commented Dec 26, 2019

Don't start try-convert from the Visual Studio 2019 developer command prompt. If you start it from the VS developer command prompt you get this error.

If you run it from a normal powershell instance or the regular command prompt it works fine.

Source: I just got the same error and this was how I fixed it.

@jmarolf
Copy link
Contributor

jmarolf commented Jan 8, 2020

hmm I cannot repoduce this in my developer command prompt. which version of the .NET Core sdks do you have installed?

@Sappharad
Copy link

Sappharad commented Jan 8, 2020

According to Add/Remove Programs I had the following .NET Core versions installed on the machine where I can reproduce the issue:

.NET Core SDK 1.0.0 (x64)
.NET Core SDK 1.0.2 (x64)
.NET Core SDK 1.0.3 (x64)
.NET Core SDK 1.0.4 (x64)
.NET Core SDK 1.1.0 (x64)
Microsoft .NET Core Runtime - 2.2.0 (x64)
Microsoft .NET Core SDK 2.0.0 (x64)
Microsoft .NET Core SDK 2.0.2 (x64)
Microsoft .NET Core SDK 2.0.3 (x64)
Microsoft .NET Core SDK 2.1.100 (x64)
Microsoft .NET Core SDK 2.1.101 (x64)
Microsoft .NET Core SDK 2.1.102 (x64)
Microsoft .NET Core SDK 2.1.103 (x64)
Microsoft .NET Core SDK 2.1.104 (x64)
Microsoft .NET Core SDK 2.1.2 (x64)
Microsoft .NET Core SDK 2.1.200 (x64)
Microsoft .NET Core SDK 2.1.201 (x64)
Microsoft .NET Core SDK 2.1.202 (x64)
Microsoft .NET Core SDK 2.1.4 (x64)
Microsoft .NET Core SDK 2.1.400 (x64)
Microsoft .NET Core SDK 2.1.401 (x64)
Microsoft .NET Core SDK 2.1.401 (x64)  [is actually listed twice]
Microsoft .NET Core SDK 2.1.402 (x64)
Microsoft .NET Core SDK 2.1.403 (x64)
Microsoft .NET Core SDK 2.1.500 (x64)
Microsoft .NET Core SDK 2.1.502 (x64)
Microsoft .NET Core SDK 2.1.503 (x64)
Microsoft .NET Core SDK 2.1.504 (x64)
Microsoft .NET Core SDK 2.1.505 (x64)
Microsoft .NET Core SDK 2.1.602 (x64)
Microsoft .NET Core SDK 2.1.604 (x64)
Microsoft .NET Core SDK 2.1.700 (x64)
Microsoft .NET Core SDK 2.1.701 (x64)
Microsoft .NET Core SDK 2.1.801 (x64)
Microsoft .NET Core SDK 2.1.802 (x64)
Microsoft .NET Core SDK 2.2.100 (x64)
Microsoft .NET Core SDK 2.2.105 (x64)
Microsoft .NET Core SDK 2.2.109 (x64)
Microsoft .NET Core SDK 2.2.110 (x64)
Microsoft .NET Core SDK 2.2.202 (x64)
Microsoft .NET Core SDK 2.2.204 (x64)
Microsoft .NET Core SDK 2.2.300 (x64)
Microsoft .NET Core SDK 2.2.301 (x64)
Microsoft .NET Core SDK 2.2.401 (x64)
Microsoft .NET Core SDK 2.2.402 (x64)
Microsoft .NET Core SDK 3.1.100 (x64) from Visual Studio

Most of these were probably installed by Visual Studio updates. But like I said, it works fine if you're not using the VS developer command prompt, so hopefully that works for other people who run into this.

@jmarolf
Copy link
Contributor

jmarolf commented Jan 8, 2020

@Sappharad if you run dotnet --version is it different between your normal and developer command prompts?

@Sappharad
Copy link

@jmarolf No, they both say 3.1.100

@paulomorgado
Copy link
Author

@jmarolf, @Sappharad is right. It doesn't work on the Developer PowerShell for VS2019.

This is my dotnet --info:

PS C:\Users\pamorgad> dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.1.200-preview-014850
 Commit:    f5ed1f237f

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19536
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.1.200-preview-014850\

Host (useful for support):
  Version: 3.1.0
  Commit:  65f04fb6db

.NET Core SDKs installed:
  1.1.14 [C:\Program Files\dotnet\sdk]
  2.1.202 [C:\Program Files\dotnet\sdk]
  2.1.504 [C:\Program Files\dotnet\sdk]
  2.1.505 [C:\Program Files\dotnet\sdk]
  2.1.507 [C:\Program Files\dotnet\sdk]
  2.1.600-preview-009497 [C:\Program Files\dotnet\sdk]
  2.1.600 [C:\Program Files\dotnet\sdk]
  2.1.601 [C:\Program Files\dotnet\sdk]
  2.1.602 [C:\Program Files\dotnet\sdk]
  2.1.604 [C:\Program Files\dotnet\sdk]
  2.1.700-preview-009597 [C:\Program Files\dotnet\sdk]
  2.1.700-preview-009601 [C:\Program Files\dotnet\sdk]
  2.1.700-preview-009618 [C:\Program Files\dotnet\sdk]
  2.1.700 [C:\Program Files\dotnet\sdk]
  2.1.701 [C:\Program Files\dotnet\sdk]
  2.1.800-preview-009677 [C:\Program Files\dotnet\sdk]
  2.1.800-preview-009696 [C:\Program Files\dotnet\sdk]
  2.1.800-preview-009711 [C:\Program Files\dotnet\sdk]
  2.1.800 [C:\Program Files\dotnet\sdk]
  2.1.801 [C:\Program Files\dotnet\sdk]
  2.1.802 [C:\Program Files\dotnet\sdk]
  2.2.106 [C:\Program Files\dotnet\sdk]
  2.2.200-preview-009804 [C:\Program Files\dotnet\sdk]
  2.2.200 [C:\Program Files\dotnet\sdk]
  2.2.201 [C:\Program Files\dotnet\sdk]
  2.2.202 [C:\Program Files\dotnet\sdk]
  2.2.203 [C:\Program Files\dotnet\sdk]
  2.2.204 [C:\Program Files\dotnet\sdk]
  2.2.300-preview-010046 [C:\Program Files\dotnet\sdk]
  2.2.300-preview-010050 [C:\Program Files\dotnet\sdk]
  2.2.300-preview-010067 [C:\Program Files\dotnet\sdk]
  2.2.300 [C:\Program Files\dotnet\sdk]
  2.2.301 [C:\Program Files\dotnet\sdk]
  2.2.400-preview-010195 [C:\Program Files\dotnet\sdk]
  2.2.400-preview-010219 [C:\Program Files\dotnet\sdk]
  2.2.400-preview-010234 [C:\Program Files\dotnet\sdk]
  2.2.400 [C:\Program Files\dotnet\sdk]
  2.2.401 [C:\Program Files\dotnet\sdk]
  2.2.402 [C:\Program Files\dotnet\sdk]
  3.0.100-preview8-013437 [C:\Program Files\dotnet\sdk]
  3.1.100 [C:\Program Files\dotnet\sdk]
  3.1.200-preview-014850 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.0-preview7.19365.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.0-preview8.19374.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 1.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 1.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0-preview7-27912-14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0-preview8-28373-17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.0.0-preview7-27912-14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.0.0-preview8-28373-17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

@jmarolf
Copy link
Contributor

jmarolf commented Jan 8, 2020 via email

@jmarolf
Copy link
Contributor

jmarolf commented Jan 14, 2020

Unfortunately I am not able to reproduce this.

If someone could set COREHOST_TRACE = 1 on a machine where this is happening that would allow us to get more info about where the runtime is looking for assemblies.

@stijnherreman
Copy link

@jmarolf I've attached try-convert.txt. The project converts fine using a regular cmd, but fails when using the Developer Command Prompt and Developer PowerShell (opened through Visual Studio).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants