3

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?

user8128167
  • 6,929
  • 6
  • 66
  • 79
  • Hi. You've posted a shot of your step 2 setup, but based on the log it's step 4 that's failing. You say you're able to build the project in Visual Studio, but can you build it on your own machine from the command line? – Nanhydrin Mar 05 '19 at 15:58
  • I can build on the command line and it gives me no errors using this command: msbuild ZzaDesktop.sln – user8128167 Mar 12 '19 at 17:37
  • @Nanhydrin, thanks for the tip. I disabled build step 4 and it now works. Please post as answer and I will mark is as the solution. – user8128167 Mar 12 '19 at 17:47
  • I don't feel like I've earned that one, I just steered you in the right direction :) You should answer it yourself and accept your answer so you can say why it was the right solution. – Nanhydrin Mar 12 '19 at 21:45

1 Answers1

1

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.

user8128167
  • 6,929
  • 6
  • 66
  • 79