You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Azure Pipelines与Nx的.NET CI构建失败问题排查

问题:NX .NET 远程缓存构建失败,找不到.dll文件

问题背景

参考NX的Azure CI示例搭建NX .NET概念验证项目,包含3个类库(libs)和3个API应用(apps)。修改其中一个API测试缓存与增量构建时,未改动的项目虽显示[remote cache],但构建失败——程序在/obj/Debug目录下查找.dll文件,而实际.dll文件存在于/dist目录。本地执行相同构建命令可正常完成,仅使用远程缓存时出现该问题。

尝试修改project.json的outputs配置(调整obj目录路径),但问题依旧。

相关项目配置

原project.json的build目标配置:

{  
  "name": "ShipmentService",  
  "$schema": "../../node_modules/nx/schemas/project-schema.json",  
  "projectType": "library",  
  "sourceRoot": "libs/ShipmentService",  
  "targets": {    
    "build": {      
      "executor": "@nx-dotnet/core:build",      
      "outputs": [        
        "{workspaceRoot}/dist/libs/ShipmentService",        
        "{workspaceRoot}/libs/ShipmentService/obj"      
      ],      
      "options": {        
        "configuration": "Debug",        
        "noDependencies": true      
      },      
      "configurations": {        
        "production": {          
          "configuration": "Release"        
        }      
      }    
    },    
    "lint": {      
      "executor": "@nx-dotnet/core:format"    
  }  
},  
"tags": []
}

修改后的outputs配置片段:

"outputs": [        
  "{workspaceRoot}/dist/libs/ShipmentService",        
  "{workspaceRoot}/dist/intermediates/libs/ShipmentService/obj"      
],

已尝试的临时解决方法(更新)

将类库的.csproj文件中ProduceReferenceAssembly属性设置为false后,问题得到解决,但不确定这是否为最优方案。

疑问

如何彻底解决该问题?是否需要修改nx.json或project.json中的相关配置?


内容的提问来源于stack exchange,提问作者Jason

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.03 08:05:22