weird error in rider, happened from nowhere

  Microsoft.Common.CurrentVersion.targets(3262, 5): [MSB4216] Could not run the "GenerateResource" task because MSBuild could not create or connect to a task host with runtime "NET" and architecture "x86".  Please ensure that (1) the requested runtime and/or architecture are available on the machine, and (2) that the required executable "C:\Program Files\dotnet\sdk\6.0.400\MSBuild.dll" exists and can be run.

 

  Microsoft.Common.CurrentVersion.targets(3284, 7): [MSB4028] The "GenerateResource" task's outputs could not be retrieved from the "FilesWritten" parameter. Object does not match target type.

 

The project works just fine in Visual Studio

0
6 comments

 Hello! When this issue appears? Is it when you load or try to build a solution? Can you please share a screenshot?

0

I have exactly the same issue, for me it began with the latest version (2022.3) of Rider that introduced better .NET 7 support. We have some solutions which are mixed of various frameworks, including .NET Framework 4.8, .NET Core, .NET 5.

The error is displayed when building, as well as an error in (oddly) only one of our projects in the solution that fails to resolve a bunch of namespaces in installed and references NuGet packages, e.g. fails to resolve Json from System.Text.Json.

I've rolled back to 2022.2 and I have no issue anymore.

Hope that helps, I'd love to know what the problem is so I can continue using the latest versions of Rider.

0

Joe, do you have the same error when you try to build with dotnet build in Terminal? Does it help if you disable R# Build in Preferences | Build, Execution, Deployment | Toolset and Build, does it help if you change Toolset at the same place?

0

Hi Olga,

Thank you for the support, I've tried each of your suggestions and only changing the toolset helped. I changed it from the dotnet SDK 7.0.101 to MSBuild v17. The project that has the failures targets .NET Framework 4.8, and uses the old-style csproj. I believe this is the source of the problem. I can repro with the following steps:

1. Create a new empty solution
2. Add a new project - .Net Framework | Desktop Application (WPF, .NET Framework 4.8.x)
3. Build the solution/project, observe that it succeeds using Visual Studio's MS Build toolset. (For me it was 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\amd64\MSBuild.exe')
4. Add a new project - .Net / .Net Core | Class Library (SDK: 5.0, Framework: net5.0)
5. Build the solution, observe that it fails to build the WPF project and attempts to use the dotnet SDK build tool. (For me it was 'C:\Program Files\dotnet\sdk\7.0.101\MSBuild.dll'). The Class Library succeeds fine.

I believe that as soon as any .NET/.NET Core project is in the solution, the toolset changes to use the dotnet SDK, regardless of if it can build all project types. I'm not sure what changed between Rider versions 2022.2 and 2022.3.

0

Joe, thank you for the reply. I was able to reproduce it with the described steps and created a corresponding record on our tracker: RIDER-87821. Please watch it for monitoring the progress on the issue.

0

I had the same issue with a net 4.72 windows forms app. Works to build and run in rider 2022.1.1 but not in the latest version of rider which I just updated to.

Changing the toolset in accordance to Olga Diakonova suggestion solved the problem. I now build using Visual studio 2022 MS build

0

Please sign in to leave a comment.