MSB3245:无法解析此引用。无法找到程序集

2024-03-23

当我使用 Azure DevOps 构建代码时,收到以下错误消息。同样的代码,当我在本地构建时,我能够成功构建它。

警告 MSB3245:无法解析此引用。无法找到程序集“Azure.Core,Version=1.20.0.0,Culture=neutral,PublicKeyToken=92742159e12e44c8,processorArchitecture=MSIL”。检查以确保该程序集存在于磁盘上。如果您的代码需要此引用,则可能会出现编译错误。

我无法弄清楚我在这里缺少什么。

以下是 YAML 文件:

# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml

trigger:
- feature/bla

variables:
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

pool:
  vmImage: 'windows-latest'

steps:

- task: NuGetToolInstaller@1


- task: NuGetCommand@2
  inputs:
    command: 'restore'
    restoreSolution: './src/Lidia.SSIS.ScriptUtils.sln'    
    
    
- task: VSBuild@1
  inputs:
    solution: './src/bla.sln'
    vsVersion: '16.0'
    msbuildArgs: '/p:OutDir=$(build.artifactstagingdirectory)/bla'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'
    clean: true

- task: PublishBuildArtifacts@1
  displayName: 'Publish ScriptUtils project'
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)/bla'
    ArtifactName: 'bla'
    publishLocation: 'Container'

构建日志片段:

2022-01-24T17:24:41.1372670Z ##[section]Starting: VSBuild
2022-01-24T17:24:41.1534676Z ==============================================================================
2022-01-24T17:24:41.1534981Z Task         : Visual Studio build
2022-01-24T17:24:41.1535235Z Description  : Build with MSBuild and set the Visual Studio version property
2022-01-24T17:24:41.1536444Z Version      : 1.198.1
2022-01-24T17:24:41.1537072Z Author       : Microsoft Corporation
2022-01-24T17:24:41.1537368Z Help         : https://learn.microsoft.com/azure/devops/pipelines/tasks/build/visual-studio-build
2022-01-24T17:24:41.1537684Z ==============================================================================
2022-01-24T17:24:42.4992500Z ##[command]"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.198.1\ps_modules\MSBuildHelpers\vswhere.exe" -version [16.0,17.0) -latest -format json
2022-01-24T17:24:42.9208406Z ##[command]"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" "D:\a\1\s\src\testest.sln" /nologo /nr:false /t:"Clean" /dl:CentralLogger,"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.198.1\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll";"RootDetailId=10b407f2-71af-4715-8e64-1e541b1a862f|SolutionDir=D:\a\1\s\src|enableOrphanedProjectsLogs=true"*ForwardingLogger,"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.198.1\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" /p:OutDir=D:\a\1\a/testest /p:platform="Any CPU" /p:configuration="Release" /p:VisualStudioVersion="16.0" /p:_MSDeployUserAgent="VSTS_50ac3de3-2135-4b5c-a9b3-2b73c7988867_build_319_0"
2022-01-24T17:24:43.0654724Z Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
2022-01-24T17:24:43.1337848Z Build started 1/24/2022 5:24:43 PM.
2022-01-24T17:24:43.3530655Z Project "D:\a\1\s\src\testest.sln" on node 1 (Clean target(s)).
2022-01-24T17:24:43.3539797Z ValidateSolutionConfiguration:
2022-01-24T17:24:43.3540299Z   Building solution configuration "Release|Any CPU".
2022-01-24T17:24:43.4997279Z Project "D:\a\1\s\src\testest.sln" (1) is building "D:\a\1\s\src\testest.Tests\Lidia.SSIS.Tests.csproj" (2) on node 1 (Clean target(s)).
2022-01-24T17:24:43.4997907Z CoreClean:
2022-01-24T17:24:43.4998177Z   Creating directory "obj\Release\".
2022-01-24T17:24:43.6865893Z Project "D:\a\1\s\src\testest.Tests\Lidia.SSIS.Tests.csproj" (2) is building "D:\a\1\s\src\testest\testest.csproj" (3:2) on node 1 (Clean target(s)).
2022-01-24T17:24:43.6867249Z CoreClean:
2022-01-24T17:24:43.6867911Z   Creating directory "obj\Release\".
2022-01-24T17:24:43.6906930Z Done Building Project "D:\a\1\s\src\testest\testest.csproj" (Clean target(s)).
2022-01-24T17:24:43.6908456Z Done Building Project "D:\a\1\s\src\testest.Tests\Lidia.SSIS.Tests.csproj" (Clean target(s)).
2022-01-24T17:24:43.6921849Z Done Building Project "D:\a\1\s\src\testest.sln" (Clean target(s)).
2022-01-24T17:24:43.6958975Z 
2022-01-24T17:24:43.6959730Z Build succeeded.
2022-01-24T17:24:43.6964730Z     0 Warning(s)
2022-01-24T17:24:43.6965326Z     0 Error(s)
2022-01-24T17:24:43.6966592Z 
2022-01-24T17:24:43.6967492Z Time Elapsed 00:00:00.56
2022-01-24T17:24:43.8608970Z ##[command]"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" "D:\a\1\s\src\testest.sln" /nologo /nr:false /dl:CentralLogger,"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.198.1\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll";"RootDetailId=356c0d1e-5323-43e1-bb4e-b9c582c4652a|SolutionDir=D:\a\1\s\src|enableOrphanedProjectsLogs=true"*ForwardingLogger,"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.198.1\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" /p:OutDir=D:\a\1\a/testest /p:platform="Any CPU" /p:configuration="Release" /p:VisualStudioVersion="16.0" /p:_MSDeployUserAgent="VSTS_50ac3de3-2135-4b5c-a9b3-2b73c7988867_build_319_0"
2022-01-24T17:24:44.0215853Z Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
2022-01-24T17:24:44.0785529Z Build started 1/24/2022 5:24:44 PM.
2022-01-24T17:24:44.2417508Z Project "D:\a\1\s\src\testest.sln" on node 1 (default targets).
2022-01-24T17:24:44.2426320Z ValidateSolutionConfiguration:
2022-01-24T17:24:44.2426747Z   Building solution configuration "Release|Any CPU".
2022-01-24T17:24:44.3935986Z Project "D:\a\1\s\src\testest.sln" (1) is building "D:\a\1\s\src\testest\testest.csproj" (2) on node 1 (default targets).
2022-01-24T17:24:44.3937769Z PrepareForBuild:
2022-01-24T17:24:44.3938123Z   Creating directory "D:\a\1\a/testest\".
2022-01-24T17:24:45.6258856Z ResolveAssemblyReferences:
2022-01-24T17:24:45.6259658Z   Primary reference "Azure.Core, Version=1.20.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8, processorArchitecture=MSIL".
2022-01-24T17:24:45.6396543Z ##[warning]C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2203,5): Warning MSB3245: Could not resolve this reference. Could not locate the assembly "Azure.Core, Version=1.20.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
2022-01-24T17:24:45.6435635Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2203,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Azure.Core, Version=1.20.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8, processorArchitecture=MSIL". 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\src\testest\testest.csproj] 

这是 CSPROJ 片段:

 <ItemGroup>
    <Reference Include="Azure.Core, Version=1.20.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8, processorArchitecture=MSIL">
      <HintPath>..\..\..\..\..\..\..\packages\Azure.Core.1.20.0\lib\net461\Azure.Core.dll</HintPath>
    </Reference>
    <Reference Include="Azure.Identity, Version=1.5.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8, processorArchitecture=MSIL">
      <HintPath>..\..\..\..\..\..\..\packages\Azure.Identity.1.5.0\lib\netstandard2.0\Azure.Identity.dll</HintPath>
      <Private>True</Private>
    </Reference> 

这是packages.config 片段:

<packages>
  <package id="Azure.Core" version="1.20.0" targetFramework="net472" />
  <package id="Azure.Identity" version="1.5.0" targetFramework="net472" />
  <package id="Azure.Storage.Blobs" version="12.10.0" targetFramework="net472" /> 

MSB3245:无法解析此引用。无法找到程序集

那是因为你指定了restoreDirectory用于 nuget 恢复任务。

如果构建解决方案时未在本地指定包文件夹,则不应在 Azure-devops 中指定它。

当您指定restoreDirectory对于nuget恢复任务,恢复的包保存在c:\packages文件夹,但项目中包的引用路径仍为旧路径。

这就是您收到错误“无法找到程序集”的原因。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

MSB3245:无法解析此引用。无法找到程序集 的相关文章

随机推荐

  • Pyspark AWS 凭证

    我正在尝试运行一个 PySpark 脚本 当我在本地计算机上运行它时 它可以正常工作 问题是我想从 S3 获取输入文件 无论我如何尝试 我似乎都无法找到设置 ID 和秘密的位置 我找到了一些有关特定文件的答案 前任 通过 Spark 或更好
  • 如何在 F# 中编写枚举而不显式分配数字文字?

    我在 F 中有一个枚举 如下所示 type Creature SmallCreature 0 MediumCreature 1 GiantCreature 2 HumongousCreature 3 CreatureOfNondescrip
  • 在 R 中将文本框保存为 pdf

    我正在尝试在 R 中创建项目符号类型列表 并希望将其保存为 pdf 格式 这成功地在窗口上打印了项目符号列表 a paste0 Starting portfolio value prettyNum 1000000 big mark scie
  • JPQL (JPA) 如果列表有交集则查找对象

    我有两个类 每个类都有一个标签列表 现在我想找到每一个对象ClassA包含列表中的任何项目ClassB 这可以用 JPQL 实现吗 或者使用单个查询 public class ClassA private List
  • 在 Qt 中解析 HTML 的最佳方法?

    在 Qt 中 我将如何解析充满 BAD html 的页面上的所有 a html 标签 href 属性 我会使用内置的 QtWebKit 不知道它的性能如何 但我认为它应该捕获所有 坏 HTML 就像是 class MyPageLoader
  • Unity:编辑器模式不支持 VRDevice 纸板。请在目标设备上运行

    卡板测试时存在屏幕无法分割的问题 我使用的 goolge sdk 版本为 unity 1 6 和 Unity 5 6 2f1 在模拟器 unity游戏场景 中 游戏场景在玩时不会分裂 控制台显示 编辑器模式不支持 VRDevice card
  • 如何动态加载和使用/调用 JavaScript 文件?

    我需要动态加载 JavaScript 文件 然后访问其内容 File test js test function var pub pub defult id 1 return pub 在这种情况下它有效 但我需要动态加载
  • 如何从 C# 连接到正在运行的 Outlook 实例 [重复]

    这个问题在这里已经有答案了 在VBA中 我通常使用appOutlook GetObject Outlook Application 获取正在运行的 Outlook 实例 如果 Outlook 未运行 则会引发错误 我通常在 Excel 中执
  • Android中的卡片翻转动画[关闭]

    Closed 这个问题需要多问focused help closed questions 目前不接受答案 I have tired to make a flip card in android Please make an image vi
  • 如何为 Owl Carousel 2 可见项目中的第一个和最后一个项目添加类?

    我需要向 Owl Carousel 2 上当前可见项目的第一个和最后一个项目添加一个类 DEMO http plnkr co edit t9URfKq9Mwh9jO705h7u p preview http plnkr co edit t9
  • 如何使用 16 或 24 列的 bootstrap

    我需要一些帮助将 bootstrap 2 0 4 设置为 16 或 24 列 而不是默认的 12 列 我无法理解我做错了什么我尝试了 bootstrap 站点上的自定义选项 并尝试更改变量中的网格变量 less 文件并使用 Crunch 重
  • 硒批判

    我只是想听听运行 Selenium 的人的一些意见 http selenium openqa org http selenium openqa org 我对 WaTiN 有很多经验 甚至还为它写了一个录音套件 我让它生成了一些结构良好的代码
  • 寻找 Lua 4.1 alpha

    我正在帮助为一款相当老的游戏 孤岛惊魂 开发多人模式 我想编译lua代码 但游戏使用版本4 1 alpha 我在任何地方都找不到 lua 4 1 alpha tar gz http www lua org work old lua 4 1
  • 适用于 Windows 的 Docker.io [已关闭]

    Closed 这个问题不符合堆栈溢出指南 help closed questions 目前不接受答案 我正在读一个关于 docker 的好问题 答案概述了docker 实现细节 https stackoverflow com questio
  • ReSharper 忽略 TODO 资源管理器上的某些文件夹

    我在我的解决方案中使用 SignalR 他们的 Nuget 包引入了 java 脚本 没关系 但问题是 那里有待办事项 现在显示在我的待办事项列表下 因此 当 ReSharper 扫描 TODO 时 我想忽略特定文件夹或文件 我尝试从 代码
  • Attribute.IsDefined 看不到应用于 MetadataType 类的属性

    如果我通过以下方式将属性应用于分部类元数据类型属性 http msdn microsoft com en us library system componentmodel dataannotations metadatatypeattrib
  • Android 中失败 [INSTALL_FAILED_USER_RESTRICTED:无效的 apk]

    我使用的是Android Studio 3 0 1 当我尝试运行应用程序时 INSTALL FAILED USER RESTRICTED 无效的 apk 发生错误 我还禁用了即时运行 我再次运行应用程序 但出现同样的错误 04 04 10
  • Java 调用 GCC 编译的 C 库可以工作,但使用 G++ 编译时会失败

    我尝试调用这个最小的 C 代码 文件TEST c void Java TEST run 从这个Java代码 文件Example java public class Example public static void main String
  • 在网络应用程序中对数据进行数字签名

    我有一个 Web 应用程序 其中一些数据 不是文件 需要使用 PKI 私钥进行数字签名 PKI 证书和私钥将位于 USB 加密令牌中 当插入 USB 插槽时 该加密令牌会向浏览器注册证书 这减轻了使用证书进行身份验证的痛苦 因为我是通过在应
  • MSB3245:无法解析此引用。无法找到程序集

    当我使用 Azure DevOps 构建代码时 收到以下错误消息 同样的代码 当我在本地构建时 我能够成功构建它 警告 MSB3245 无法解析此引用 无法找到程序集 Azure Core Version 1 20 0 0 Culture