Open Closed

Azure Devops Build Pipeline SourceLink.Create.CommandLine Error #60


User avatar
0
wazbek created

Hi

I am getting the following error in my Azure Devops build pipeline on the '.NET Core Build' task.

##[error]/home/vsts/.nuget/packages/sourcelink.create.commandline/2.8.3/build/SourceLink.Create.CommandLine.targets(30,5): Error : unable to convert OriginUrl: https://eohesa@dev.azure.com/eohesa/NextecBase/_git/NextecBase

This is what my pipeline yaml looks like:

- job: aspnetcore
    displayName: .NET Core
    pool:
      vmImage: 'ubuntu-latest'
    steps:
      - task: DotNetCoreInstaller@0
        displayName: 'Install .NET Core Sdk'
        inputs:
          version: 3.1.101
          
      - task: DotNetCoreCLI@2
        displayName: '.NET Core Restore'
        inputs:
          command: restore 
          verbosityRestore: Normal
          feedsToUse: config
          nugetConfigPath: NexBase/aspnet-core/NuGet.Config
          projects: |
            NexBase/aspnet-core/**/*.csproj
            
      - task: DotNetCoreCLI@2
        displayName: '.NET Core Build'
        inputs:
          command: build
          projects: |
            NexBase/aspnet-core/src/NexBase.DbMigrator/NexBase.DbMigrator.csproj
            NexBase/aspnet-core/src/NexBase.HttpApi.Host/NexBase.HttpApi.Host.csproj
          arguments: '--configuration $(BuildConfiguration) --no-restore'

Can you please provide an example to get my build working or provide some feedback to get this working. I have googled the problem and I found this issue:

[https://github.com/dotnet/sourcelink/issues/166]

One of the comments suggests: "Could you try to remove SourceLink.Create.CommandLine 2.8.3? The only package reference you need to get SoruceLink working for Azure DevOps hosted repo is Microsoft.SourceLink.Vsts.Git. See https://github.com/dotnet/sourcelink#visual-studio-team-services".

Please advise on a way forward


9 Answer(s)
  • User Avatar
    0
    alper created
    Support Team Director

    Hi,

    As stated here https://github.com/dotnet/sourcelink#using-source-link-in-net-projects You need to change the package reference regarding the hosting provider. If you're using Azure DevOps, you can replace the package reference SourceLink.Create.CommandLine to Microsoft.SourceLink.AzureDevOpsServer.Git

    <ItemGroup>
      <PackageReference Include="Microsoft.SourceLink.AzureDevOpsServer.Git" Version="1.0.0" PrivateAssets="All"/>
    </ItemGroup>
    

    See the other providers usage:


    github.com and GitHub Enterprise

    For projects hosted by GitHub or GitHub Enterprise reference Microsoft.SourceLink.GitHub like so:

    <ItemGroup>
      <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
    </ItemGroup>
    

    Azure Repos (former Visual Studio Team Services)

    For projects hosted by Azure Repos in git repositories reference Microsoft.SourceLink.AzureRepos.Git:

    <ItemGroup>
      <PackageReference Include="Microsoft.SourceLink.AzureRepos.Git" Version="1.0.0" PrivateAssets="All"/>
    </ItemGroup>
    

    Azure DevOps Server (former Team Foundation Server)

    For projects hosted by on-prem Azure DevOps Server in git repositories reference Microsoft.SourceLink.AzureDevOpsServer.Git and add host configuration like so:

    <ItemGroup>
      <PackageReference Include="Microsoft.SourceLink.AzureDevOpsServer.Git" Version="1.0.0" PrivateAssets="All"/>
    </ItemGroup>
    

    If your server is configurated with non-empty IIS Virtual Directory, specify this directory in SourceLinkAzureDevOpsServerGitHost item like so:

    <ItemGroup>
      <SourceLinkAzureDevOpsServerGitHost Include="server-name" VirtualDirectory="tfs"/>
    </ItemGroup>
    

    The Include attribute specifies the domain and optionally the port of the server (e.g. server-name or server-name:8080).


    GitLab

    For projects hosted by GitLab reference Microsoft.SourceLink.GitLab package:

    <ItemGroup>
      <PackageReference Include="Microsoft.SourceLink.GitLab" Version="1.0.0" PrivateAssets="All"/>
    </ItemGroup>
    

    Bitbucket

    For projects in git repositories hosted on Bitbucket.org or hosted on an on-prem Bitbucket server reference Microsoft.SourceLink.Bitbucket.Git package:

    <ItemGroup>
      <PackageReference Include="Microsoft.SourceLink.Bitbucket.Git" Version="1.0.0" PrivateAssets="All"/>
    </ItemGroup>
    

    If your project is hosted by Bitbucket Server or Bitbucket Data Center older than version 4.7 you must specify SourceLinkBitbucketGitHost item group in addition to the package reference:

    <ItemGroup>
      <SourceLinkBitbucketGitHost Include="bitbucket.yourdomain.com" Version="4.5"/>
    </ItemGroup>
    

    The item group SourceLinkBitbucketGitHost specifies the domain of the Bitbucket host and the version of Bitbucket. The version is important since URL format for accessing files changes with version 4.7. By default Source Link assumes new format (version 4.7+).

  • User Avatar
    0
    wazbek created

    Hi alper

    I have tried what you suggested above but used Azure Repos (former Visual Studio Team Services) since we are not using the on prem version. I added the following entry into the "aspnet-core/common.props" file.

    <ItemGroup>
      <PackageReference Include="Microsoft.SourceLink.AzureRepos.Git" Version="1.0.0" PrivateAssets="All"/>
    </ItemGroup>
    

    I am still receiving an error though:

    (Restore target) -> 
    /opt/hostedtoolcache/dncs/3.1.101/x64/sdk/3.1.101/NuGet.targets(123,5): error : Failed to retrieve information about 'Microsoft.SourceLink.AzureRepos.Git' from remote source 'https://nuget.abp.io/{private abp commercial key}/v3/package/microsoft.sourcelink.azurerepos.git/index.json'. 		 
    /opt/hostedtoolcache/dncs/3.1.101/x64/sdk/3.1.101/NuGet.targets(123,5): error :   Response status code does not indicate success: 403 (Forbidden). 
    
    

    I have also tried different combinations of the source link packages "Microsoft.SourceLink.GitHub" and "SourceLink.Create.CommandLine" together with "Microsoft.SourceLink.AzureRepos.Git" but with no luck. It is recommended to use the Microsoft.SourceLink.* packages since SourceLink.Create.CommandLine is an old version.

    From the github repo https://github.com/dotnet/sourcelink it states: "If you distribute the library via a package published to NuGet.org, it is recommended to build a symbol package and publish it to NuGet.org as well. This will make the symbols available on NuGet.org symbol server, where the debugger can download it from when needed. Alternatively, you can include the symbols in the main package. However, doing so is not recommended as it increases the size of the package and thus restore time for projects that consume your package." Has this been done for abp and if so which of the sourcelink providers should I be using to get past the error above?

  • User Avatar
    0
    alper created
    Support Team Director

    The only difference for ABP is, there are commercial packages which are hosted on https://nuget.abp.io. ABP NuGet package source is written in your NuGet.Config file (at the root directory of the solution). Remove the package SourceLink.Create.CommandLine and try again.

  • User Avatar
    0
    wazbek created

    Hi alper

    "The only difference for ABP is, there are commercial packages which are hosted on https://nuget.abp.io." I am aware of this "ABP NuGet package source is written in your NuGet.Config file (at the root directory of the solution)." I am also aware of this "Remove the package SourceLink.Create.CommandLine and try again."

    That is exactly what I did. This is what the common.props file contains:

    <Project>
      <PropertyGroup>
        <LangVersion>latest</LangVersion>
        <Version>1.0.0</Version>
        <NoWarn>$(NoWarn);CS1591</NoWarn>
      </PropertyGroup>
      <ItemGroup>
        <PackageReference Include="Microsoft.SourceLink.AzureRepos.Git" Version="1.0.0" PrivateAssets="All"/>
      </ItemGroup>
    </Project>
    

    I am still getting the error in my above response.

  • User Avatar
    0
    alper created
    Support Team Director

    I mean remove all SourceLink facilities (Microsoft.SourceLink.AzureRepos.Git as well). We're trying to understand if there's an issue about SourceLink or something different .

  • User Avatar
    0
    wazbek created

    OK I have removed all entries in the common.props file and I get the following errors on the dotnet build step:

    ##[error]/home/vsts/.nuget/packages/sourcelink.create.commandline/2.8.3/build/SourceLink.Create.CommandLine.targets(30,5): Error : unable to convert OriginUrl: https://eohesa@dev.azure.com/eohesa/NextecBase/_git/NextecBase
    /home/vsts/.nuget/packages/sourcelink.create.commandline/2.8.3/build/SourceLink.Create.CommandLine.targets(30,5): error : unable to convert OriginUrl: https://eohesa@dev.azure.com/eohesa/NextecBase/_git/NextecBase [/home/vsts/work/1/s/NexBase/aspnet-core/Modules/NexModule.Samm/src/NexModule.Samm.Domain.Shared/NexModule.Samm.Domain.Shared.csproj]
    ##[warning]NexBase/aspnet-core/src/NexBase.Domain.Shared/NexBase.Domain.Shared.csproj(0,0): Warning NU1701: Package 'BouncyCastle 1.8.1' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.
    /home/vsts/work/1/s/NexBase/aspnet-core/src/NexBase.Domain.Shared/NexBase.Domain.Shared.csproj : warning NU1701: Package 'BouncyCastle 1.8.1' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.
    ##[error]NexBase/aspnet-core/src/NexBase.Domain.Shared/NexBaseDomainSharedModule.cs(7,16): Error CS0234: The type or namespace name 'LanguageManagement' does not exist in the namespace 'Volo.Abp' (are you missing an assembly reference?)
    NexBaseDomainSharedModule.cs(7,16): error CS0234: The type or namespace name 'LanguageManagement' does not exist in the namespace 'Volo.Abp' (are you missing an assembly reference?) [/home/vsts/work/1/s/NexBase/aspnet-core/src/NexBase.Domain.Shared/NexBase.Domain.Shared.csproj]
    ##[error]NexBase/aspnet-core/src/NexBase.Domain.Shared/NexBaseDomainSharedModule.cs(8,16): Error CS0234: The type or namespace name 'LeptonTheme' does not exist in the namespace 'Volo.Abp' (are you missing an assembly reference?)
    NexBaseDomainSharedModule.cs(8,16): error CS0234: The type or namespace name 'LeptonTheme' does not exist in the namespace 'Volo.Abp' (are you missing an assembly reference?) [/home/vsts/work/1/s/NexBase/aspnet-core/src/NexBase.Domain.Shared/NexBase.Domain.Shared.csproj]
    ##[error]NexBase/aspnet-core/src/NexBase.Domain.Shared/NexBaseDomainSharedModule.cs(15,12): Error CS0234: The type or namespace name 'Saas' does not exist in the namespace 'Volo' (are you missing an assembly reference?)
    NexBaseDomainSharedModule.cs(15,12): error CS0234: The type or namespace name 'Saas' does not exist in the namespace 'Volo' (are you missing an assembly reference?) [/home/vsts/work/1/s/NexBase/aspnet-core/src/NexBase.Domain.Shared/NexBase.Domain.Shared.csproj]
    ##[error]NexBase/aspnet-core/src/NexBase.Domain.Shared/NexBaseDomainSharedModule.cs(27,16): Error CS0246: The type or namespace name 'LanguageManagementDomainSharedModule' could not be found (are you missing a using directive or an assembly reference?)
    NexBaseDomainSharedModule.cs(27,16): error CS0246: The type or namespace name 'LanguageManagementDomainSharedModule' could not be found (are you missing a using directive or an assembly reference?) [/home/vsts/work/1/s/NexBase/aspnet-core/src/NexBase.Domain.Shared/NexBase.Domain.Shared.csproj]
    ##[error]NexBase/aspnet-core/src/NexBase.Domain.Shared/NexBaseDomainSharedModule.cs(28,16): Error CS0246: The type or namespace name 'SaasDomainSharedModule' could not be found (are you missing a using directive or an assembly reference?)
    NexBaseDomainSharedModule.cs(28,16): error CS0246: The type or namespace name 'SaasDomainSharedModule' could not be found (are you missing a using directive or an assembly reference?) [/home/vsts/work/1/s/NexBase/aspnet-core/src/NexBase.Domain.Shared/NexBase.Domain.Shared.csproj]
    ##[error]NexBase/aspnet-core/src/NexBase.Domain.Shared/NexBaseDomainSharedModule.cs(29,16): Error CS0246: The type or namespace name 'LeptonThemeManagementDomainSharedModule' could not be found (are you missing a using directive or an assembly reference?)
    
    

    I see the SourceLink.Create.CommandLine package is still referenced in one of my modules, should I remove the package reference too?

  • User Avatar
    0
    wazbek created

    With the SourceLink.Create.CommandLine package completely removed from all of my project files and all common.props files I still get the following errors:

    ##[error]NexBase/aspnet-core/src/NexBase.Domain.Shared/NexBaseDomainSharedModule.cs(7,16): Error CS0234: The type or namespace name 'LanguageManagement' does not exist in the namespace 'Volo.Abp' (are you missing an assembly reference?)
    NexBaseDomainSharedModule.cs(7,16): error CS0234: The type or namespace name 'LanguageManagement' does not exist in the namespace 'Volo.Abp' (are you missing an assembly reference?) [/home/vsts/work/1/s/NexBase/aspnet-core/src/NexBase.Domain.Shared/NexBase.Domain.Shared.csproj]
    ##[error]NexBase/aspnet-core/src/NexBase.Domain.Shared/NexBaseDomainSharedModule.cs(8,16): Error CS0234: The type or namespace name 'LeptonTheme' does not exist in the namespace 'Volo.Abp' (are you missing an assembly reference?)
    NexBaseDomainSharedModule.cs(8,16): error CS0234: The type or namespace name 'LeptonTheme' does not exist in the namespace 'Volo.Abp' (are you missing an assembly reference?) [/home/vsts/work/1/s/NexBase/aspnet-core/src/NexBase.Domain.Shared/NexBase.Domain.Shared.csproj]
    ##[error]NexBase/aspnet-core/src/NexBase.Domain.Shared/NexBaseDomainSharedModule.cs(15,12): Error CS0234: The type or namespace name 'Saas' does not exist in the namespace 'Volo' (are you missing an assembly reference?)
    NexBaseDomainSharedModule.cs(15,12): error CS0234: The type or namespace name 'Saas' does not exist in the namespace 'Volo' (are you missing an assembly reference?) [/home/vsts/work/1/s/NexBase/aspnet-core/src/NexBase.Domain.Shared/NexBase.Domain.Shared.csproj]
    ##[error]NexBase/aspnet-core/src/NexBase.Domain.Shared/NexBaseDomainSharedModule.cs(27,16): Error CS0246: The type or namespace name 'LanguageManagementDomainSharedModule' could not be found (are you missing a using directive or an assembly reference?)
    NexBaseDomainSharedModule.cs(27,16): error CS0246: The type or namespace name 'LanguageManagementDomainSharedModule' could not be found (are you missing a using directive or an assembly reference?) [/home/vsts/work/1/s/NexBase/aspnet-core/src/NexBase.Domain.Shared/NexBase.Domain.Shared.csproj]
    ##[error]NexBase/aspnet-core/src/NexBase.Domain.Shared/NexBaseDomainSharedModule.cs(28,16): Error CS0246: The type or namespace name 'SaasDomainSharedModule' could not be found (are you missing a using directive or an assembly reference?)
    NexBaseDomainSharedModule.cs(28,16): error CS0246: The type or namespace name 'SaasDomainSharedModule' could not be found (are you missing a using directive or an assembly reference?) [/home/vsts/work/1/s/NexBase/aspnet-core/src/NexBase.Domain.Shared/NexBase.Domain.Shared.csproj]
    ##[error]NexBase/aspnet-core/src/NexBase.Domain.Shared/NexBaseDomainSharedModule.cs(29,16): Error CS0246: The type or namespace name 'LeptonThemeManagementDomainSharedModule' could not be found (are you missing a using directive or an assembly reference?)
    NexBaseDomainSharedModule.cs(29,16): error CS0246: The type or namespace name 'LeptonThemeManagementDomainSharedModule' could not be found (are you missing a using directive or an assembly reference?) [/home/vsts/work/1/s/NexBase/aspnet-core/src/NexBase.Domain.Shared/NexBase.Domain.Shared.csproj]
    
    
  • User Avatar
    0
    wazbek created

    I have finally got my build step passing. I have removed the SourceLink.Create.CommandLine package from all of my project files and all common.props files. So SourceLink may still be an issue. Please keep me up to date on what you find with the SourceLink investigation.

    I also switched my vmImage in my yaml file to 'windows-latest'.

  • User Avatar
    0
    alper created
    Support Team Director

    Good to hear it passes somehow. I'm creating an internal issue about this problem. By the way SourceLink doesn't affect any functionality in your project. It's just a way to debug your live project. As long as you don't debug your project while it's running on production, it's better to cut off this package reference.

    To the ABP Team => Track from 1484

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09