Setting a path in my azure pipeline for specific project folder

Darragh Martin 86 Reputation points
2023-12-06T17:15:18.5133333+00:00

I want to set a path for my nftimportexportscanner csproj file since i have 2 csproj files in this folder and everytime I run this it fails as its reading my other csproj file which I dont want as its a much older file but I dont want to delete it but want the pipeline to run to just run this csproj file. Can someone help me to set out the path in the donet restore, build and publish steps etc


pool:
  vmImage: 'ubuntu-latest'
trigger:
 branches:
   include:
     - dev
 paths:
   include:
     - NftImportExportScanner/*

variables:
  buildConfiguration: 'release'

steps:
- task: UseDotNet@2
  displayName: Set .NET Core to 6.x
  inputs:
    packageType: 'sdk'
    version: '6.x'
    installationPath: $(Agent.ToolsDirectory)/dotnet


- task: DotNetCoreCLI@2
  displayName: Run - dotnet restore
  inputs:
    command: restore
    feedsToUse: 'select'
    vstsFeed: '39b14414-e819-472c-a8c9-e1b150e85a52/1e69f816-5f54-4793-9746-2a8eed83160b'
    projects: '**/NftImportExportScanner/*.csproj'
    includeNuGetOrg: true


- task: DotNetCoreCLI@2
  displayName: Run - dotnet build
  inputs:
    command: 'build'
    projects: '**/NftImportExportScanner/*.csproj'     
    zipAfterPublish: true
    arguments: '--configuration $(buildConfiguration)'

- task: DotNetCoreCLI@2
  displayName: Run - dotnet publish
  inputs:
    command: publish
    arguments: '--configuration $(buildConfiguration) --output publish_output --no-restore'
    publishWebProjects: false
    modifyOutputPath: false
    zipAfterPublish: false
    workingDirectory: '$(System.DefaultWorkingDirectory)/NftImportExportScanner'

- task: ArchiveFiles@2
  displayName: "Archive files"
  inputs:
    rootFolderOrFile: "$(System.DefaultWorkingDirectory)/NftImportExportScanner/publish_output"
    includeRootFolder: false
    archiveFile: "$(System.DefaultWorkingDirectory)/build$(Build.BuildNumber).zip"
- task: PublishBuildArtifacts@1
  displayName: Export Artifacts
  inputs:
    PathtoPublish: '$(System.DefaultWorkingDirectory)/build$(Build.BuildNumber).zip'
    artifactName: 'drop_$(Build.BuildNumber)_$(Build.SourceBranchName)'

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
39,570 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. PRADEEPCHEEKATLA-MSFT 90,146 Reputation points Microsoft Employee
    2023-12-07T04:40:49.9333333+00:00

    @Darragh Martin - Thanks for the question and using MS Q&A platform.

    Azure DevOps is currently not supported in the Microsoft Q&A platform; the supported products are listed over here https://docs.microsoft.com/en-us/answers/products (more to be added later on).

    In order to assist best on your query, I would request you to post your query in SO => Azure Devops dedicated support. Additionally, adding the [Azure] tag on SO will increase visibility as it is a Microsoft Sponsored tag.

    https://stackoverflow.com/questions/tagged/azure-devops

    OR

    Report any Azure Devops problems on Developer Community.

    This will assist you with a faster reply to your query.


    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.

    0 comments No comments

  2. Hadrian Phillips 0 Reputation points
    2024-04-22T18:10:44.9033333+00:00

    You can exclude folders and files using the projects alternative syntax which allows you to specify the following order:

    • include all matching folders or files
    • exclude any matching folders or files (uses negation ! )
    projects: |
      **/NftImportExportScanner/*.csproj
      !**/NftImportExportScanner/my-bad-project.csproj
    
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.