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
Comments
Any advice how I can solve this? |
@rynowak can you point me at the repro project? |
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 |
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. |
@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? |
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. |
@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? |
@jmarolf yeah, add a 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 |
This repro predates the use of Arcade for the project, so it's not an arcade bug 😆 |
@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 |
I'm seeing similar output running dotnet-format:
|
And I have just tested again with latest dev version of dotnet-format from the myget feed.
|
@dazinator do you have a sample repo that I can run dotnet-format against to investigate your issue? |
@rynowak looking at the binlog for your project I think we do not handle SDK imports correctly in the MSBuildWorkspace.
If you run with the folder option @JoeRobich I am seeing this error as well. This could just be a point-in-time problem with the .NET 5 SDK
|
SDK imports should work for free when using Locator, so that's surprising. |
@rainersigwald if you run the command below
and then run this command over this repo: https://github.com/dotnet/tye
you should get a bin log. Would be very curious to get a second opinion on what is happening here |
Here is the binlog produced on my machine |
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. |
@jmarolf I can repro. Filed microsoft/MSBuildLocator#88, but I'm swamped today and can't dig in. |
Thanks so much! |
If you're after more repros, I've got some "MSbuild failed when processing the file ..." errors in this repo:
With version 3.3.111304+7c8f67a570f5fde6a247704733d6742f93c0fa48 from NuGet. Expand for errors list
|
Me too The error:
My dotnet info
My environment
|
I also encountered the issue:
Upgrading dotnet to I'm using latest version of both Mac and Ubuntu. |
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:When I rerun with
-v diag
I get:The text was updated successfully, but these errors were encountered: