错误MSB4216:无法运行“GenerateResource”任务,因为MSBuild无法创建或连接到任务

问题描述 投票:0回答:1

请注意,我能够在Visual Studio Professional 2017中构建此项目:https://github.com/briannoyes/WPFMVVM-StarterCode

但是当我尝试在Team City 2019.1中运行构建时,它给了我这个错误:

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".

然后我找到了这个链接:

'dotnet build' error after migrating dotnetcore project to 1.0.4

从那里我按照评论中的建议将其添加到项目中:

<Prefer32Bit>false</Prefer32Bit>

但是现在我收到了这个错误:

从构建脚本报告的问题(1)Customers \ AddEditCustomerView.xaml.cs(25,13):错误CS0103:当前上下文中不存在名称“InitializeComponent”Customers \ CustomerListView.xaml.cs(25,13):error CS0103:当前上下文中不存在名称“InitializeComponent”OrderPrep \ OrderPrepView.xaml.cs(25,13):错误CS0103:当前上下文中存在名称“InitializeComponent”Orders \ OrderView.xaml.cs( 25,13):错误CS0103:当前上下文中不存在名称'InitializeComponent'MainWindow.xaml.cs(25,13):错误CS0103:当前上下文CSC中不存在名称'InitializeComponent':错误CS5001 :程序不包含适用于入口点的静态“Main”方法···构建失败条件(1)使用代码1退出的过程

以下是我在构建步骤中的设置:

enter image description here

这是完整的构建日志:

https://pastebin.com/1JdhKWPf

有没有人有什么建议?

c# teamcity
1个回答
0
投票

请注意,最新的TeamCity默认支持.NET Core,因此它会自动添加此步骤:

enter image description here

但我真正需要的唯一构建步骤是我在使用.NET Framework 4.7,而不是.NET Core的WPF应用程序的问题中给出的第2步,所以我禁用了第4步,现在构建工作正常。

© www.soinside.com 2019 - 2024. All rights reserved.