C
C#11mo ago
!Rushaan

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.
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.
20 Replies
jcotton42
jcotton4211mo ago
can you show the csproj for the app? @Azym Equinox
!Rushaan
!RushaanOP11mo ago
1 min
jcotton42
jcotton4211mo ago
I mean the actual text of the csproj
!Rushaan
!RushaanOP11mo ago
oh how exactly do i open the csproj to see its text
jcotton42
jcotton4211mo ago
though, based on packages.config that looks suspiciously like a Framework project should be an option in the right click, or just open it in something like notepad
!Rushaan
!RushaanOP11mo ago
yes its a .NET Framework 4.7.2 project k
jcotton42
jcotton4211mo ago
yeah that's why dotnet doesn't really work well with Framework projects use msbuild from the VS Command Prompt, or publish from Visual Studio
!Rushaan
!RushaanOP11mo ago
oh
jcotton42
jcotton4211mo ago
yep, typical Framework csproj a giant mess
!Rushaan
!RushaanOP11mo ago
i tried publishing from visual studio but i just cant find the right options, all i want is an executable file but it gives options like cd/dvd, file share etc
jcotton42
jcotton4211mo ago
isn't there a folder option?
!Rushaan
!RushaanOP11mo ago
i dont think so
jcotton42
jcotton4211mo ago
show a screenshot
!Rushaan
!RushaanOP11mo ago
jcotton42
jcotton4211mo ago
oh, huh try the CD option? might just put files somewhere
!Rushaan
!RushaanOP11mo ago
yea i once did that and it worked however i ran the setup file and it opened the application after a minimal setup wizard kind of window but it didnt put the exe somewhere and it wasnt opening again properly as it said something like its already installed
jcotton42
jcotton4211mo ago
oh ok uh, I guess you could just use the build output
!Rushaan
!RushaanOP11mo ago
build output?
jcotton42
jcotton4211mo ago
the result of building your app it'll be in bin
!Rushaan
!RushaanOP11mo ago
oh alr so imma try that tysm dude it worked (got the exe)
Want results from more Discord servers?
Add your server