Include local dll in Azure DevOps pipeline

Andrea Tassera

In my C# project I'm referencing one of my company's DLLs, which is not on NuGet (as it's not public) and my pipeline in Azure DevOps keeps failing because it says it cannot find the reference.

Error CS0234: The type or namespace name 'YYY' does not exist in the namespace 'ZZZ' (are you missing an assembly reference?)

Following the advice from this post I have copied the dll in my solution and I'm referencing it from there, so the dll is version controlled and lives in the repo. Here an extract from the csproj:

<Reference Include="ZZZ.YYY, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
  <SpecificVersion>False</SpecificVersion>
  <HintPath>..\PrivateReferences\ZZZ.YYY.dll</HintPath>
  <Private>False</Private>
</Reference>

The solution builds perfectly from my machine, but it keeps failing on Azure. What am I missing?

Thanks!

EDIT AFTER Bright Ran-MSFT REPLY
Here is the extract from my yaml:

trigger:
- develop

pool: 'Default'

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Debug'

steps:

- task: NuGetToolInstaller@1

- task: NuGetCommand@2
  inputs:
    restoreSolution: '$(solution)'

- task: NuGetCommand@2
  inputs:
    command: 'restore'
    restoreSolution: '**/*.sln'
    feedsToUse: 'select'
    vstsFeed: '<GUID of my Feed>'

- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'
Bright Ran-MSFT

You can publish these DLLs as yourself custom NuGet package to an Azure Artifacts feed on Azure DevOps. Then in the pipeline for your project, you can use the NuGet restore task to restore the package into your project.

After publishing the package, when building your project via Visual Studio on your local machine, you also can connect to the Azure Artifacts feed to restore the package into your project.

[UPDATE]

Have you checked the output console logs of the pipeline run to see what caused the package can't be restored? Whether the reason is unauthorized error, such as 401 or 403?

If so, before the NuGet restore task, you need to use the NuGet Authenticate task to provide the authentication information. Here you also need to create a NuGet service connection for use.

Normally, the feed you set up to publish yourself custom packages is private, when accessing the feed in the pipeline, the authentication is required.

On your local Visual Studio, due to you have log in with your account, VS will automatically authenticate with your account when you connect to the feed.

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

Secret Pipeline Parameter in Azure Devops

分類Dev

Build pipeline for service fabric app on Azure devops

分類Dev

Azure DevOps release pipeline with git-flow

分類Dev

Fail to active conda in Azure DevOps pipeline

分類Dev

How to use previous Azure DevOps yaml pipeline name in triggered pipeline?

分類Dev

Azure DevOps Build Pipeline - A failed build still gets deployed to Azure

分類Dev

How to write a secret to azure key vault from Azure DevOps pipeline?

分類Dev

Azure devops pipeline get work items between builds

分類Dev

Azure DevOps Release Pipelines - Using Powershell with Pipeline variables inside brackets

分類Dev

Unable to print the variable right after set it in Azure devops pipeline

分類Dev

Migrate VS2017 Azure DevOps pipeline to VS2019

分類Dev

Azure Devops Pipeline trigger ignore paths when a tag is triggered

分類Dev

Azure Devops Build Pipeline for solution with multiple project types

分類Dev

Release pipeline to Prod is just queued, not starting to deploy- devops Azure

分類Dev

passing pipeline variable as argument into Powershell build step not working in Azure DevOps

分類Dev

How do you delay and schedule a stage to only run the latest build in an Azure Devops yaml pipeline?

分類Dev

Azure DevOps PipelineのMavenビルドエラー

分類Dev

Share PowerShell variable between two tasks of the job agent in Release pipeline in Azure DevOps

分類Dev

How to fix: In Azure Devops connection string is null despite setting Variable in the build Pipeline

分類Dev

Pass file content as build argument in azure devops pipeline docker build task

分類Dev

How can I exclude changes to the pipeline yaml file to trigger a build i azure devops?

分類Dev

How to add Approval before Slot Swap task in Release pipeline on Azure DevOps

分類Dev

Azure DevOps Pipeline Azure BlobStorageアップロードファイル403Forbidden Exception

分類Dev

In Azure Devops, how can i use pipeline variables in a "Azure CLI task v.2" running shell script?

分類Dev

Azure DevOps Pipelineの定義を継承することは可能ですか?

分類Dev

Azure DevOps Multi Stage Pipeline Error: No package found with specified pattern: /home/vsts/work/1/s/**/*.zip - How do I fix?

分類Dev

Azure-testhost.dllが原因でDevOpsパイプラインが失敗する

分類Dev

azure devops variable group

分類Dev

Azure Devops - Build Automation

Related 関連記事

  1. 1

    Secret Pipeline Parameter in Azure Devops

  2. 2

    Build pipeline for service fabric app on Azure devops

  3. 3

    Azure DevOps release pipeline with git-flow

  4. 4

    Fail to active conda in Azure DevOps pipeline

  5. 5

    How to use previous Azure DevOps yaml pipeline name in triggered pipeline?

  6. 6

    Azure DevOps Build Pipeline - A failed build still gets deployed to Azure

  7. 7

    How to write a secret to azure key vault from Azure DevOps pipeline?

  8. 8

    Azure devops pipeline get work items between builds

  9. 9

    Azure DevOps Release Pipelines - Using Powershell with Pipeline variables inside brackets

  10. 10

    Unable to print the variable right after set it in Azure devops pipeline

  11. 11

    Migrate VS2017 Azure DevOps pipeline to VS2019

  12. 12

    Azure Devops Pipeline trigger ignore paths when a tag is triggered

  13. 13

    Azure Devops Build Pipeline for solution with multiple project types

  14. 14

    Release pipeline to Prod is just queued, not starting to deploy- devops Azure

  15. 15

    passing pipeline variable as argument into Powershell build step not working in Azure DevOps

  16. 16

    How do you delay and schedule a stage to only run the latest build in an Azure Devops yaml pipeline?

  17. 17

    Azure DevOps PipelineのMavenビルドエラー

  18. 18

    Share PowerShell variable between two tasks of the job agent in Release pipeline in Azure DevOps

  19. 19

    How to fix: In Azure Devops connection string is null despite setting Variable in the build Pipeline

  20. 20

    Pass file content as build argument in azure devops pipeline docker build task

  21. 21

    How can I exclude changes to the pipeline yaml file to trigger a build i azure devops?

  22. 22

    How to add Approval before Slot Swap task in Release pipeline on Azure DevOps

  23. 23

    Azure DevOps Pipeline Azure BlobStorageアップロードファイル403Forbidden Exception

  24. 24

    In Azure Devops, how can i use pipeline variables in a "Azure CLI task v.2" running shell script?

  25. 25

    Azure DevOps Pipelineの定義を継承することは可能ですか?

  26. 26

    Azure DevOps Multi Stage Pipeline Error: No package found with specified pattern: /home/vsts/work/1/s/**/*.zip - How do I fix?

  27. 27

    Azure-testhost.dllが原因でDevOpsパイプラインが失敗する

  28. 28

    azure devops variable group

  29. 29

    Azure Devops - Build Automation

ホットタグ

アーカイブ