[英]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 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”。
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.