Trying to publish WPF App but getting error

C:\Program Files\dotnet\sdk\5.0.411\Microsoft.Common.CurrentVersion.targets(3162,5): error MSB4216: Could not run the "GenerateResource" task because MSBuild could not create or connect to a task host with runtime "CLR4" 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\5.0.411\MSBuild.exe" exists and can be run. [C:\Users\rusha\source\repos\WeatherApp\WeatherApp\WeatherApp.csproj]
C:\Program Files\dotnet\sdk\5.0.411\Microsoft.Common.CurrentVersion.targets(3184,7): error MSB4028: The "GenerateResource" task's outputs could not be retrieved from the "FilesWritten" parameter. Object does not match target type.


I'm trying to publish a WPF C# application so that I get it's .exe but I keep getting that error.

The command I ran was dotnet publish -c Release

MSBuild.exe was not present in the folder give in error so from somewhere of Visual Studio folder I found MSBuild.exe and copy pasted it in that folder and still getting the exact same error.
Was this page helpful?