Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error MSB4216: Could not run the "GenerateResource" task because MSBuild could not create or connect to a task

Tags:

c#

teamcity

Please note that I am able to build this project in Visual Studio Professional 2017: https://github.com/briannoyes/WPFMVVM-StarterCode

But when I try to run the build in Team City 2019.1 it gave me this error:

C:\Program Files\dotnet\sdk\2.0.0\Microsoft.Common.CurrentVersion.targets(2924,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".

Then I found this link:

'dotnet build' error after migrating dotnetcore project to 1.0.4

From there I added this to the project as suggested in a comment:

<Prefer32Bit>false</Prefer32Bit>

But now I am getting this error:

Problem reported from build script (1) Customers\AddEditCustomerView.xaml.cs(25,13): error CS0103: The name 'InitializeComponent' does not exist in the current context Customers\CustomerListView.xaml.cs(25,13): error CS0103: The name 'InitializeComponent' does not exist in the current context OrderPrep\OrderPrepView.xaml.cs(25,13): error CS0103: The name 'InitializeComponent' does not exist in the current context Orders\OrderView.xaml.cs(25,13): error CS0103: The name 'InitializeComponent' does not exist in the current context MainWindow.xaml.cs(25,13): error CS0103: The name 'InitializeComponent' does not exist in the current context CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point··· Build failure condition (1) Process exited with code 1

Here are the settings I have in my build step:

enter image description here

Here is the full build log:

https://pastebin.com/1JdhKWPf

Does anyone have any suggestions?

like image 427
user8128167 Avatar asked Jan 26 '26 05:01

user8128167


1 Answers

Please note that the latest TeamCity by default supports .NET Core, so it automatically added this step:

enter image description here

But the only build step I really needed was step 2 given in my question for my WPF application using the .NET Framework 4.7, NOT .NET Core, so I disabled step 4 and the build now works.

like image 108
user8128167 Avatar answered Jan 28 '26 17:01

user8128167



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!