Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advice about msbuild task warnings #584

Open
rynowak opened this issue Feb 29, 2020 · 24 comments
Open

Advice about msbuild task warnings #584

rynowak opened this issue Feb 29, 2020 · 24 comments
Labels
Question This issue is requesting information about dotnet-format

Comments

@rynowak
Copy link
Member

rynowak commented Feb 29, 2020

I'm trying to make sense of some of the warnings dotnet-format is spitting out. This is on a solution containing .net core projects, using SDK 3.1.101 on macOS.

When I run dotnet-format on my solution, I get:

Formatting code files in workspace '/Users/ryan/github.com/<path to>.sln.
  Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings.
  Format complete in 5610ms.

When I rerun with -v diag I get:

Formatting code files in workspace '/Users/ryan/github.com/<pathtosln>.sln'.
  Loading workspace.
  Msbuild failed when processing the file '/Users/ryan/github.com/<projectname>' with message: /usr/local/share/dotnet/sdk/3.1.101/Microsoft.Common.CurrentVersion.targets: (1540, 5): The "Microsoft.Build.Tasks.ResolveNonMSBuildProjectOutput" task could not be loaded from the assembly Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.  Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
  Found project reference without a matching metadata reference: /Users/ryan/github.com/dotnet/<projectname>
  Msbuild failed when processing the file '/Users/ryan/github.com/<projectname>' with message: /usr/local/share/dotnet/sdk/3.1.101/Microsoft.Common.CurrentVersion.targets: (1540, 5): The "ResolveNonMSBuildProjectOutput" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "/usr/local/share/dotnet/sdk/3.1.101" directory.
  Found project reference without a matching metadata reference: /Users/ryan/github.com/dotnet/<projectname>
  Found project reference without a matching metadata reference: /Users/ryan/github.com/<projectname>
  Msbuild failed when processing the file '/Users/ryan/github.com/<projectname>' with message: /usr/local/share/dotnet/sdk/3.1.101/Microsoft.Common.CurrentVersion.targets: (1540, 5): The "ResolveNonMSBuildProjectOutput" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "/usr/local/share/dotnet/sdk/3.1.101" directory.
  Found project reference without a matching metadata reference: /Users/ryan/github.com/<projectname>
  Found project reference without a matching metadata reference: /Users/ryan/github.com/<projectname>
  Found project reference without a matching metadata reference: /Users/ryan/github.com/<projectname>
  Complete in 4307ms.
  Determining formattable files.
  Complete in 985ms.
  Running formatters.
  Complete in 518ms.
  Formatted 0 of 106 files.
  Format complete in 5816ms.
@rynowak
Copy link
Member Author

rynowak commented Feb 29, 2020

Any advice how I can solve this?

@jmarolf
Copy link
Contributor

jmarolf commented Mar 2, 2020

@rynowak can you point me at the repro project?

@jmarolf
Copy link
Contributor

jmarolf commented Mar 2, 2020

This is normally caused by the msbuild that we use (that comes from the .NET Core SDK) being unable to load msbuild tasks for your project. If the SDK installed on this machine builds without issue then it could be a bug in how .NET format loads assemblies. We've tried to mimic MSBuild behavior as close as possible but we could have gotten something wrong. Again a github repo or sample project would be helpful

@rynowak
Copy link
Member Author

rynowak commented Mar 2, 2020

I'll need a bit to figure out how to repo. This doesn't occur with an empty project, but I can't provide access right now to the one I'm having issues with.

@jmarolf
Copy link
Contributor

jmarolf commented Mar 9, 2020

@rynowak Took a look at this. The warning is coming from here. For some reason the output path for the project is not being set and we give a warning. I assume that this is an arcade issue since arcade manipulates the output paths for all projects that include its sdk. I assume there is some MSBuild property that we will need to add here. @rainersigwald is there any properties you need to set or targets you need to run for sdks to finish running their props and targets? Is this actually an arcade bug in disguise?

@rainersigwald
Copy link
Member

I'm not sure I understand the issue. Is it possible for dotnet-format to produce full MSBuild logs for its design-time builds? That would probably be the best debugging tool here.

@jmarolf
Copy link
Contributor

jmarolf commented Mar 9, 2020

@rainersigwald I think I will need to update the msbuild workspace to output a binary log. Is there any advice on how to do that programmatically with the build manager? I assume I will need to set something here?

@rainersigwald
Copy link
Member

@jmarolf yeah, add a new Microsoft.Build.Logging.BinaryLogger() to

https://github.com/dotnet/roslyn/blob/441c154b27eafc9ed04feda1786f0f07ce448f14/src/Workspaces/Core/MSBuild/MSBuild/Build/ProjectBuildManager.cs#L171

The examples in our unit tests use a lot of helper methods and aren't super clear, unfortunately, and the way we hook it up in msbuild.exe is also not particularly informative. Holler if you have questions.

@rynowak
Copy link
Member Author

rynowak commented Mar 11, 2020

I assume that this is an arcade issue since arcade manipulates the output paths for all projects that include its sdk. I assume there is some MSBuild property that we will need to add here. @rainersigwald is there any properties you need to set or targets you need to run for sdks to finish running their props and targets? Is this actually an arcade bug in disguise?

This repro predates the use of Arcade for the project, so it's not an arcade bug 😆

@jmarolf
Copy link
Contributor

jmarolf commented Mar 11, 2020

@rynowak ah, I'll go back through history and see what's happened then, thanks! this PR: dotnet/roslyn#42319 should allow me to get a full log of what happened

@JoeRobich JoeRobich added the Question This issue is requesting information about dotnet-format label Mar 17, 2020
@dazinator
Copy link

I'm seeing similar output running dotnet-format:

 Formatting code files in workspace 'C:\Users\DarrellTunnell\source\repos\Foo\src\Foo.sln'.
  Loading workspace.
  Msbuild failed when processing the file 'C:\Users\DarrellTunnell\source\repos\Foo\src\Foo.Server\Foo.Server.csproj' with message: C:\Users\DarrellTunnell\source\repos\Foo\src\Foo.Server\Foo.Server.csproj: (0, 0): Foo.Shared does not provide an inclusive lower bound for dependency GridShared. An approximate best match of GridShared 2.4.18 was resolved.
  Msbuild failed when processing the file 'C:\Users\DarrellTunnell\source\repos\Foo\src\Foo.Server\Foo.Server.csproj' with message: C:\Program Files\dotnet\sdk\3.1.201\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Microsoft.CodeAnalysis.BuildTasks.Csc" task could not be loaded from the assembly C:\Program Files\dotnet\sdk\3.1.201\Roslyn\Microsoft.Build.Tasks.CodeAnalysis.dll. Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
  Msbuild failed when processing the file 'C:\Users\DarrellTunnell\source\repos\Foo\src\Foo.Client\Foo.Client.csproj' with message: C:\Users\DarrellTunnell\source\repos\Foo\src\Foo.Client\Foo.Client.csproj: (0, 0): Hub.Shared does not provide an inclusive lower bound for dependency GridShared. An approximate best match of GridShared 2.4.18 was resolved.
  Msbuild failed when processing the file 'C:\Users\DarrellTunnell\source\repos\Foo\src\Foo.Client\Foo.Client.csproj' with message: C:\Program Files\dotnet\sdk\3.1.201\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\3.1.201" directory.
  Msbuild failed when processing the file 'C:\Users\DarrellTunnell\source\repos\Foo\src\Foo.Shared\Foo.Shared.csproj' with message: C:\Users\DarrellTunnell\source\repos\Foo\src\Foo.Shared\Foo.Shared.csproj: (0, 0): Project dependency GridShared does not contain an inclusive lower bound. Include a lower bound in the dependency version to ensure consistent restore results.
  Msbuild failed when processing the file 'C:\Users\DarrellTunnell\source\repos\Foo\src\Foo.Shared\Foo.Shared.csproj' with message: C:\Program Files\dotnet\sdk\3.1.201\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\3.1.201" directory.
  Msbuild failed when processing the file 'C:\Users\DarrellTunnell\source\repos\Foo\src\Foo.Landing.Page\Foo.Landing.Page.csproj' with message: C:\Program Files\dotnet\sdk\3.1.201\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\3.1.201" directory.
  Complete in 3375ms.
  Determining formattable files.
  Complete in 37ms.
  Running formatters.
  Complete in 12ms.
  Formatted 0 of 400 files.
  Format complete in 3429ms.

@dazinator
Copy link

dazinator commented Apr 14, 2020

And I have just tested again with latest dev version of dotnet-format from the myget feed.
Same issue running dotnet-format -v diag -w src

 Using MSBuild.exe located in 'C:\Program Files\dotnet\sdk\3.1.201\'
  Formatting code files in workspace 'C:\Users\DarrellTunnell\source\repos\Foo\src\Foo.sln'.
  Loading workspace.
  Msbuild failed when processing the file 'C:\Users\DarrellTunnell\source\repos\Foo\src\Foo.Server\Foo.Server.csproj' with message: C:\Users\DarrellTunnell\source\repos\Foo\src\Foo.Server\Foo.Server.csproj: (0, 0): Foo.Shared does not provide an inclusive lower bound for dependency GridShared. An approximate best match of GridShared 2.4.18 was resolved.
  Msbuild failed when processing the file 'C:\Users\DarrellTunnell\source\repos\Foo\src\Foo.Server\Foo.Server.csproj' with message: C:\Program Files\dotnet\sdk\3.1.201\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Microsoft.CodeAnalysis.BuildTasks.Csc" task could not be loaded from the assembly C:\Program Files\dotnet\sdk\3.1.201\Roslyn\Microsoft.Build.Tasks.CodeAnalysis.dll. Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
  Msbuild failed when processing the file 'C:\Users\DarrellTunnell\source\repos\Foo\src\Foo.Client\Foo.Client.csproj' with message: C:\Users\DarrellTunnell\source\repos\Foo\src\Foo.Client\Foo.Client.csproj: (0, 0): Foo.Shared does not provide an inclusive lower bound for dependency GridShared. An approximate best match of GridShared 2.4.18 was resolved.
  Msbuild failed when processing the file 'C:\Users\DarrellTunnell\source\repos\Foo\src\Foo.Client\Foo.Client.csproj' with message: C:\Program Files\dotnet\sdk\3.1.201\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\3.1.201" directory.
  Msbuild failed when processing the file 'C:\Users\DarrellTunnell\source\repos\Foo\src\Foo.Shared\Foo.Shared.csproj' with message: C:\Users\DarrellTunnell\source\repos\Foo\src\Foo.Shared\Foo.Shared.csproj: (0, 0): Project dependency GridShared does not contain an inclusive lower bound. Include a lower bound in the dependency version to ensure consistent restore results.
  Msbuild failed when processing the file 'C:\Users\DarrellTunnell\source\repos\Foo\src\Foo.Shared\Foo.Shared.csproj' with message: C:\Program Files\dotnet\sdk\3.1.201\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\3.1.201" directory.
  Found project reference without a matching metadata reference: C:\Users\DarrellTunnell\source\repos\Foo\src\Foo.Shared\Foo.Shared.csproj
  Found project reference without a matching metadata reference: C:\Users\DarrellTunnell\source\repos\Foo\src\Foo.Client\Foo.Client.csproj
  Msbuild failed when processing the file 'C:\Users\DarrellTunnell\source\repos\Foo\src\Foo.Landing.Page\Foo.Landing.Page.csproj' with message: C:\Program Files\dotnet\sdk\3.1.201\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\3.1.201" directory.
  Found project reference without a matching metadata reference: C:\Users\DarrellTunnell\source\repos\Foo\src\Foo.Landing.Page\Foo.Landing.Page.csproj
  Complete in 4110ms.
  Determining formattable files.
  Complete in 55ms.
  Running formatters.
  Complete in 14ms.
  Formatted 0 of 400 files.
  Format complete in 4183ms.

@jmarolf
Copy link
Contributor

jmarolf commented Apr 14, 2020

after merging this pr -v should produce a *.binlog file. Let me test this against @rynowak's case and see if I can get to the bottom of what is happening.

@jmarolf
Copy link
Contributor

jmarolf commented Apr 14, 2020

@dazinator do you have a sample repo that I can run dotnet-format against to investigate your issue?

@jmarolf
Copy link
Contributor

jmarolf commented Apr 14, 2020

@rynowak looking at the binlog for your project I think we do not handle SDK imports correctly in the MSBuildWorkspace.

C:\source\tye-master\Directory.Build.props(4,31): error MSB4236: The SDK 'Microsoft.DotNet.Arcade.Sdk' specified could not be found. [C:\source\tye-master\src\Microsoft.Tye.Hosting\Microsoft.Tye.Hosting.csproj]
C:\source\tye-master\Directory.Build.props(4,31): error MSB4236: The SDK 'Microsoft.DotNet.Arcade.Sdk' specified could not be found. [C:\source\tye-master\src\Microsoft.Tye.Core\Microsoft.Tye.Core.csproj]
C:\source\tye-master\Directory.Build.props(4,31): error MSB4236: The SDK 'Microsoft.DotNet.Arcade.Sdk' specified could not be found. [C:\source\tye-master\src\Microsoft.Tye.Extensions\Microsoft.Tye.Extensions.csproj]
C:\source\tye-master\Directory.Build.props(4,31): error MSB4236: The SDK 'Microsoft.DotNet.Arcade.Sdk' specified could not be found. [C:\source\tye-master\src\Microsoft.Tye.Hosting.Diagnostics\Microsoft.Tye.Hosting.Diagnostics.csproj]
C:\source\tye-master\Directory.Build.props(4,31): error MSB4236: The SDK 'Microsoft.DotNet.Arcade.Sdk' specified could not be found. [C:\source\tye-master\src\Microsoft.Tye.Hosting.Runtime\Microsoft.Tye.Hosting.Runtime.csproj]
C:\source\tye-master\Directory.Build.props(4,31): error MSB4236: The SDK 'Microsoft.DotNet.Arcade.Sdk' specified could not be found. [C:\source\tye-master\src\Microsoft.Tye.Proxy\Microsoft.Tye.Proxy.csproj]

If you run with the folder option dotnet format --folder . you will not see these errors

@JoeRobich I am seeing this error as well. This could just be a point-in-time problem with the .NET 5 SDK

C:\Program Files\dotnet\sdk\5.0.100-preview.1.20155.7\Roslyn\Microsoft.CSharp.Core.targets(59,5):
	error MSB4062: The "Microsoft.CodeAnalysis.BuildTasks.Csc" task could not be loaded from the assembly C:\Program Files\dotnet\sdk\5.0.100-preview.1.20155.7\Roslyn\Microsoft.Build.Tasks.CodeAnalysis.dll.
	Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
	The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

@rainersigwald
Copy link
Member

SDK imports should work for free when using Locator, so that's surprising.

@jmarolf
Copy link
Contributor

jmarolf commented Apr 15, 2020

@rainersigwald if you run the command below

dotnet tool install -g dotnet-format --version 4.0.121404 --add-source https://dotnet.myget.org/F/format/api/v3/index.json

and then run this command over this repo: https://github.com/dotnet/tye

dotnet-format -w tye.sln -v diag

you should get a bin log. Would be very curious to get a second opinion on what is happening here

@jmarolf
Copy link
Contributor

jmarolf commented Apr 15, 2020

Here is the binlog produced on my machine
formatDiagnosticLog.zip

@snebjorn
Copy link

I'm also seeing this issue on my netcoreapp3.1 project

❯ dotnet-format -v diag
  Formatting code files in workspace 'path\to\project\myproject.csproj'.
  Loading workspace.
  Msbuild failed when processing the file 'path\to\project\myproject.csproj' with message: C:\Program Files\dotnet\sdk\3.1.201\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Microsoft.CodeAnalysis.BuildTasks.Csc" task could not be loaded from the assembly C:\Program Files\dotnet\sdk\3.1.201\Roslyn\Microsoft.Build.Tasks.CodeAnalysis.dll. Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

@rainersigwald
Copy link
Member

@jmarolf I can repro. Filed microsoft/MSBuildLocator#88, but I'm swamped today and can't dig in.

@jmarolf
Copy link
Contributor

jmarolf commented Apr 16, 2020

Thanks so much!

@canton7
Copy link

canton7 commented Apr 26, 2020

If you're after more repros, I've got some "MSbuild failed when processing the file ..." errors in this repo:

cd src
dotnet format -v diag

With version 3.3.111304+7c8f67a570f5fde6a247704733d6742f93c0fa48 from NuGet.

Expand for errors list
  Msbuild failed when processing the file 'C:\Users\Antony\Documents\Projects\RestEase\src\RestEase\RestEase.csproj' with message: C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Microsoft.CodeAnalysis.BuildTasks.Csc" task could not be loaded from the assembly C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.Build.Tasks.CodeAnalysis.dll. Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. Confirm that the  declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
  Msbuild failed when processing the file 'C:\Users\Antony\Documents\Projects\RestEase\src\RestEase\RestEase.csproj' with message: C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with  in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\3.1.300-preview-015048" directory.
  Msbuild failed when processing the file 'C:\Users\Antony\Documents\Projects\RestEase\src\RestEase\RestEase.csproj' with message: C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with  in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\3.1.300-preview-015048" directory.
  Msbuild failed when processing the file 'C:\Users\Antony\Documents\Projects\RestEase\src\RestEase\RestEase.csproj' with message: C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with  in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\3.1.300-preview-015048" directory.
  Msbuild failed when processing the file 'C:\Users\Antony\Documents\Projects\RestEase\src\RestEase\RestEase.csproj' with message: C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Microsoft.CodeAnalysis.BuildTasks.Csc" task could not be loaded from the assembly C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.Build.Tasks.CodeAnalysis.dll. Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. Confirm that the  declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
  Msbuild failed when processing the file 'C:\Users\Antony\Documents\Projects\RestEase\src\RestEase\RestEase.csproj' with message: C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with  in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\3.1.300-preview-015048" directory.
  Msbuild failed when processing the file 'C:\Users\Antony\Documents\Projects\RestEase\src\RestEase\RestEase.csproj' with message: C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with  in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\3.1.300-preview-015048" directory.
  Msbuild failed when processing the file 'C:\Users\Antony\Documents\Projects\RestEase\src\RestEase\RestEase.csproj' with message: C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with  in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\3.1.300-preview-015048" directory.
  Msbuild failed when processing the file 'C:\Users\Antony\Documents\Projects\RestEase\src\RestEase\RestEase.csproj' with message: C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Microsoft.CodeAnalysis.BuildTasks.Csc" task could not be loaded from the assembly C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.Build.Tasks.CodeAnalysis.dll. Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. Confirm that the  declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
  Msbuild failed when processing the file 'C:\Users\Antony\Documents\Projects\RestEase\src\RestEase\RestEase.csproj' with message: C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with  in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\3.1.300-preview-015048" directory.
  Msbuild failed when processing the file 'C:\Users\Antony\Documents\Projects\RestEase\src\RestEase\RestEase.csproj' with message: C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with  in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\3.1.300-preview-015048" directory.
  Msbuild failed when processing the file 'C:\Users\Antony\Documents\Projects\RestEase\src\RestEase\RestEase.csproj' with message: C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with  in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\3.1.300-preview-015048" directory.
  Msbuild failed when processing the file 'C:\Users\Antony\Documents\Projects\RestEase\src\RestEase\RestEase.csproj' with message: C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Microsoft.CodeAnalysis.BuildTasks.Csc" task could not be loaded from the assembly C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.Build.Tasks.CodeAnalysis.dll. Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. Confirm that the  declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
  Msbuild failed when processing the file 'C:\Users\Antony\Documents\Projects\RestEase\src\RestEase\RestEase.csproj' with message: C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with  in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\3.1.300-preview-015048" directory.
  Msbuild failed when processing the file 'C:\Users\Antony\Documents\Projects\RestEase\src\RestEase\RestEase.csproj' with message: C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with  in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\3.1.300-preview-015048" directory.
  Msbuild failed when processing the file 'C:\Users\Antony\Documents\Projects\RestEase\src\RestEase\RestEase.csproj' with message: C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with  in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\3.1.300-preview-015048" directory.
  Msbuild failed when processing the file 'C:\Users\Antony\Documents\Projects\RestEase\src\RestEaseUnitTests\RestEaseUnitTests.csproj' with message: C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with  in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\3.1.300-preview-015048" directory.
  Msbuild failed when processing the file 'C:\Users\Antony\Documents\Projects\RestEase\src\RestEaseUnitTests\RestEaseUnitTests.csproj' with message: C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with  in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\3.1.300-preview-015048" directory.
  Msbuild failed when processing the file 'C:\Users\Antony\Documents\Projects\RestEase\src\RestEaseUnitTests\RestEaseUnitTests.csproj' with message: C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with  in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\3.1.300-preview-015048" directory.
  Msbuild failed when processing the file 'C:\Users\Antony\Documents\Projects\RestEase\src\RestEaseUnitTests\RestEaseUnitTests.csproj' with message: C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with  in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\3.1.300-preview-015048" directory.
  Msbuild failed when processing the file 'C:\Users\Antony\Documents\Projects\RestEase\src\RestEaseUnitTests\RestEaseUnitTests.csproj' with message: C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with  in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\3.1.300-preview-015048" directory.
  Msbuild failed when processing the file 'C:\Users\Antony\Documents\Projects\RestEase\src\RestEaseUnitTests\RestEaseUnitTests.csproj' with message: C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with  in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\3.1.300-preview-015048" directory.
  Msbuild failed when processing the file 'C:\Users\Antony\Documents\Projects\RestEase\src\RestEaseUnitTests\RestEaseUnitTests.csproj' with message: C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with  in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\3.1.300-preview-015048" directory.
  Msbuild failed when processing the file 'C:\Users\Antony\Documents\Projects\RestEase\src\RestEaseUnitTests\RestEaseUnitTests.csproj' with message: C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with  in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\3.1.300-preview-015048" directory.
  Msbuild failed when processing the file 'C:\Users\Antony\Documents\Projects\RestEase\src\RestEaseUnitTests\RestEaseUnitTests.csproj' with message: C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with  in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\3.1.300-preview-015048" directory.
  Msbuild failed when processing the file 'C:\Users\Antony\Documents\Projects\RestEase\src\RestEaseUnitTests\RestEaseUnitTests.csproj' with message: C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with  in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\3.1.300-preview-015048" directory.
  Msbuild failed when processing the file 'C:\Users\Antony\Documents\Projects\RestEase\src\RestEaseUnitTests\RestEaseUnitTests.csproj' with message: C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with  in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\3.1.300-preview-015048" directory.
  Msbuild failed when processing the file 'C:\Users\Antony\Documents\Projects\RestEase\src\RestEaseUnitTests\RestEaseUnitTests.csproj' with message: C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with  in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\3.1.300-preview-015048" directory.
  Msbuild failed when processing the file 'C:\Users\Antony\Documents\Projects\RestEase\src\RestEaseUnitTests\RestEaseUnitTests.csproj' with message: C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with  in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\3.1.300-preview-015048" directory.
  Msbuild failed when processing the file 'C:\Users\Antony\Documents\Projects\RestEase\src\RestEaseUnitTests\RestEaseUnitTests.csproj' with message: C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with  in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\3.1.300-preview-015048" directory.
  Msbuild failed when processing the file 'C:\Users\Antony\Documents\Projects\RestEase\src\RestEaseUnitTests\RestEaseUnitTests.csproj' with message: C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with  in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\3.1.300-preview-015048" directory.
  Msbuild failed when processing the file 'C:\Users\Antony\Documents\Projects\RestEase\src\RestEaseUnitTests\RestEaseUnitTests.csproj' with message: C:\Program Files\dotnet\sdk\3.1.300-preview-015048\Roslyn\Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with  in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\3.1.300-preview-015048" directory.

@solrevdev
Copy link

Me too

The error:

dotnet format -v diag
  Formatting code files in workspace '/home/solrevdev/Code/bitbucket/mysolution/mysolution.sln'.
  Loading workspace.
  Msbuild failed when processing the file '/home/solrevdev/Code/bitbucket/mysolution/src/consoleproject1/consoleproject1.csproj' with message: /usr/share/dotnet/sdk/3.1.201/Roslyn/Microsoft.CSharp.Core.targets: (59, 5): The "Microsoft.CodeAnalysis.BuildTasks.Csc" task could not be loaded from the assembly /usr/share/dotnet/sdk/3.1.201/Roslyn/Microsoft.Build.Tasks.CodeAnalysis.dll. Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
 Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
  Msbuild failed when processing the file '/home/solrevdev/Code/bitbucket/mysolution/src/consoleproject2/consoleproject2.csproj' with message: /usr/share/dotnet/sdk/3.1.201/Roslyn/Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "/usr/share/dotnet/sdk/3.1.201" directory.
  Msbuild failed when processing the file '/home/solrevdev/Code/bitbucket/mysolution/src/webproject3/webproject3.csproj' with message: /usr/share/dotnet/sdk/3.1.201/Roslyn/Microsoft.CSharp.Core.targets: (59, 5): The "Csc" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "/usr/share/dotnet/sdk/3.1.201" directory.
  Complete in 3406ms.
  Determining formattable files.
  Complete in 1144ms.
  Running formatters.
  Complete in 879ms.
  Formatted 0 of 172 files.
  Format complete in 5433ms.```

My dotnet info

dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.1.201
 Commit:    b1768b4ae7

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  19.10
 OS Platform: Linux
 RID:         ubuntu.19.10-x64
 Base Path:   /usr/share/dotnet/sdk/3.1.201/

Host (useful for support):
  Version: 3.1.3
  Commit:  4a9f85e9f8

.NET Core SDKs installed:
  2.1.805 [/usr/share/dotnet/sdk]
  2.2.402 [/usr/share/dotnet/sdk]
  3.0.103 [/usr/share/dotnet/sdk]
  3.1.201 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.17 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.7 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.17 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.7 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.17 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.7 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download
solrevdev@hplaptop ~ $ 

My environment

screenfetch -n
 solrevdev@hplaptop
 OS: Ubuntu 19.10 eoan
 Kernel: x86_64 Linux 5.3.0-51-generic
 Uptime: 6h 31m
 Packages: 2720
 Shell: bash 5.0.3
 Resolution: 1920x1080
 DE: GNOME 
 WM: GNOME Shell
 WM Theme: 
 GTK Theme: Yaru [GTK2/3]
 Icon Theme: Yaru
 Font: Ubuntu 11
 CPU: Intel Core i5-7200U @ 4x 3.1GHz
 GPU: i915drmfb
 RAM: 5400MiB / 7878MiB

@lihuanglx
Copy link

I also encountered the issue:

The "Microsoft.Build.Tasks.ResolveNonMSBuildProjectOutput" task could not be loaded from the assembly Microsoft.Build.Tasks.Core

Upgrading dotnet to 3.1.202 resolved this.

I'm using latest version of both Mac and Ubuntu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question This issue is requesting information about dotnet-format
Projects
None yet
Development

No branches or pull requests

9 participants