c# - Azure DevOps如何通过引用另一个解决方案中的另一个项目来构建项目

标签 c# asp.net azure asp.net-core azure-devops

正如标题所示,我的每个解决方案都包含依赖于另一个解决方案的项目,例如

解决方案A

AA计划 项目AB 项目交流 解决方案 B(仅包含一个类库,其中有一个文件夹,我将自定义 appsettings.json 文件放入其中。这不能在 DevOps 上构建,因为它不算是一个项目)

项目BA 溶液AA和AC引用BA。在项目AA和AC的.csproj中,有一个HintPath,显示BA的位置

当我在本地环境上编译时,一切都很好,并且能够正确编译和运行。

我使用 GitHub 作为存储库,当我从 Azure DevOps 引用它并尝试构建我的解决方案 A 时,我收到以下错误:

D:\a_tool\dotnet\sdk\2.2.103\Microsoft.Common.CurrentVersion.targets(2110,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "CentralApplicationSettings". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [D:\a\1\s\ManagementStudio.ClassLibrary\ManagementStudio.ClassLibrary.csproj] D:\a_tool\dotnet\sdk\2.2.103\Microsoft.Common.CurrentVersion.targets(2110,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "CentralApplicationSettings". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [D:\a\1\s\ManagementStudio.Data\ManagementStudio.Data.csproj]

它基本上是说它无法从 GitHub 找到所需的引用,这是有道理的,因为 GitHub 和 DevOps 没有类似的文件夹结构,因此 HintPath 对编译器没有意义。

有人建议我将解决方案 B 更改为 NuGet 包,但问题是,每次部署新解决方案时,我都需要将自定义 appsettings 文件放在那里,所以这是不可能的。

是否有其他方法可以在 Azure DevOps 上构建解决方案 A,而无需将其转换为 NuGet 包?

解决方案 A 就像一个帐户管理应用程序,因此我打算将其与另一个更具用途的应用程序一起部署。

编辑:

解决方案 B 有一个文件夹,我将自定义 appsettings.json 文件放在该文件夹中,以便其他部署的应用程序可以访问它们。它就像一个应用程序设置库。

如果我将其设为 NuGet 包,我将无法将 appsettings.json 文件复制到那里。

最佳答案

将另一个解决方案构建到包中,并将其推送到 nuget feed,并在第二个项目上进行恢复时使用该 feed

关于c# - Azure DevOps如何通过引用另一个解决方案中的另一个项目来构建项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56641304/

相关文章:

asp.net - 将单元测试添加到现有的 ASP.NET Web 表单应用程序

asp.net - 如何在我的应用程序中从 Facebook 获取好友?

node.js - 如何使用 Node.js 中的 azure/identity 模块进行身份验证?

c# - 首先使用 Winforms 和 EF 4.1 代码进行数据绑定(bind)

c# - 如何将 eval 字符串放入函数中?

c# - 使用值从 .net 代码隐藏调用 javascript 函数

javascript - 为什么我的 asp 文件上传控件文本框是可点击的?

azure - 使用 ADF 从 Salesforce 报表导入数据

c# - 使用 C# 管理 Azure Web 应用程序的域

c# - 如何使用 LINQ 将数组转换为字典