简体   繁体   English

TFS:构建包含 .NET 6 和完整框架应用程序的解决方案

[英]TFS: Build solution containing both .NET 6 and Full Framework apps

We are in the process of migrating a web app from .NET 4.8 to .NET 6. While we're in the migration process, we have the old app and the new app both stored in the same solution.我们正在将 Web 应用程序从 .NET 4.8 迁移到 .NET 6。在迁移过程中,旧应用程序和新应用程序都存储在同一个解决方案中。 We want to be able to build and deploy both apps.我们希望能够构建和部署这两个应用程序。

After adding the .NET 6 app, when I try to build the entire solution, (either using the .NET Core steps or using the Visual Studio Build steps), I get the following error even though I have a NuGet Restore step immediately prior to the build step:添加 .NET 6 应用程序后,当我尝试构建整个解决方案时(使用 .NET Core 步骤或使用 Visual Studio 构建步骤),即使在之前有 NuGet 还原步骤,我也会收到以下错误构建步骤:

This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them

Has anyone seen this issue?有没有人看到这个问题? How did you successfully build your solutions that contain both frameworks?您是如何成功构建包含这两个框架的解决方案的?

在此处输入图像描述 在此处输入图像描述

I was able to solve this problem by adding multiple Build Configurations and then having multiple build steps (one for each build config.)我能够通过添加多个构建配置然后有多个构建步骤(每个构建配置一个)来解决这个问题。

In Visual Studio在 Visual Studio 中

In my solution, I created a build configuration that builds all of the projects tied to my full framework app called "ReleaseLegacy", and another config that builds all the projects tied to my .NET 6 app called "ReleaseNET6".在我的解决方案中,我创建了一个构建配置,它构建了与我的完整框架应用程序“ReleaseLegacy”相关的所有项目,以及另一个构建与我的 .NET 6 应用程序相关的所有项目的配置,称为“ReleaseNET6”。

In TFS在 TFS 中

I added my two build configurations as variables for my build.我将我的两个构建配置添加为构建的变量。

在此处输入图像描述

To build to full framework app, I used the Visual Studio Build step, targeting the entire solution, but using the "ReleaseLegacy" build configuration.为了构建完整的框架应用程序,我使用了 Visual Studio 构建步骤,针对整个解决方案,但使用“ReleaseLegacy”构建配置。

在此处输入图像描述

To build the .NET 6 app, I used the .NET Core build step, targeting the entire solution, but using the "ReleaseNET6" build configuration.为了构建 .NET 6 应用程序,我使用了 .NET Core build步骤,针对整个解决方案,但使用了“ReleaseNET6”构建配置。

在此处输入图像描述

Prior to both of the build steps, I also had to add the .NET Core restore step as well as the legacy NuGet Restore step.在这两个构建步骤之前,我还必须添加 .NET Core restore步骤以及旧版 NuGet 还原步骤。 I'm not 100% sure why but the .NET Core step was required to get the full framework build step to succeed.我不是 100% 确定为什么,但需要 .NET Core 步骤才能使完整的框架构建步骤成功。

在此处输入图像描述

Similar to the build steps, I had to add separate test steps for the full framework apps compared to the .NET 6 apps.与构建步骤类似,与 .NET 6 应用程序相比,我必须为完整框架应用程序添加单独的测试步骤。

在此处输入图像描述

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 TFS构建服务器,无需尝试部署即可在解决方案中创建程序包Web Apps - TFS Build server Create packages Web Apps in solution without attempting to deploy 在同一解决方案文件中同时包含 .NET Framework 和 .NET Core 项目的 Azure DevOps 中构建 .sln - Building .sln in Azure DevOps that has both .NET Framework and .NET Core projects in the same solution file .net解决方案以获取与TFS中的变更集关联的文件 - .net solution to get files associated with changesets in TFS 无法命令行构建混合解决方案(.NET Framework与.NET标准) - Unable to Command-Line Build a Mixed Solution (.NET Framework with .NET Standard) 在升级框架中重建 .NET 解决方案 - Rebuild .NET solution in upgraded framework Cake 构建脚本在 Azure Devops 中使用混合 .NET 核心和框架解决方案失败 - Cake build script fails in Azure Devops with mixed .NET core and framework solution 检查是否已安装.NET 4 Full Framework - Check .NET 4 Full Framework is installed 完整.Net中的实体框架核心? - Entity Framework Core in Full .Net? 具有完整框架的ASP NET Core 2 - ASP NET Core 2 with Full Framework VS2017 .Net Core(完整框架)项目的后构建事件获取$(ConfigurationName)的空字符串 - VS2017 .Net Core (Full Framework) Project's Post Build Event gets empty string for $(ConfigurationName)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM