6

In Azure devops I want to issue a nuget pack command that passes the option IncludeReferencedProjects. My repo is in TFVC so I do not believe I can use azure-pipelines.yml. I believe I must do this through the visual designer. I don't see an option to pass additional arguments to the nuget with the pack command type. This makes me think I have to use the custom command type for nuget. When I'm using the custom command type, I can specify -IncludeReferencedProjects but I do not seem to be able to specify **\*.csproj as the items to pack. If I do this the command fails with:

[command]C:\hostedtoolcache\windows\NuGet\4.1.0\x64\nuget.exe pack **\*.csproj -IncludeReferencedProjects -Symbols -Verbosity Detailed -NonInteractive
System.IO.IOException: The filename, directory name, or volume label syntax is incorrect.

How can I pack all csproj output with the IncludeReferencedProjects flag using the visual designer? Here's a picture of what I have in designer:

enter image description here

user2719430
  • 544
  • 1
  • 4
  • 15

2 Answers2

1

How can I pack all csproj output with the IncludeReferencedProjects flag using the visual designer?

I am afraid you could not pack all csproj output with the IncludeReferencedProjects flag.

That because pack command (NuGet CLI) does not support wildcard.

When you use nuget pack command line with wildcard, you will always get the error Unknown command: '**\*.csproj'. (This error also exists locally.)

To resolve this issue, we could add multiple nuget pack tasks to pack those projects.

Hope this helps.

Leo Liu
  • 71,098
  • 10
  • 114
  • 135
  • Okay, so it sounds like the devops visual designer is doing some magic for me when I use a nuget task with a command type of 'pack', as there I can specify **\\*.csproj and it works. It just doesn't give me the option to pass IncludeReferencedProjects. When I switch my nuget task to a command type of 'custom' I lose all the devops magic and that's why wildcards do not work. – user2719430 Apr 03 '19 at 12:18
  • this is really inconvenient. Pack should support extra option or custom should support path with wildcard – maxisam Nov 21 '19 at 22:26
0

For me, passing IncludeReferencedProjects=true worked.

- task: DotNetCoreCLI@2
  displayName: Pack Core.Shared
  inputs:
    command: 'pack'
    packagesToPack: '**/*.csproj'
    versioningScheme: 'byPrereleaseNumber'
    majorVersion: '1'
    minorVersion: '0'
    patchVersion: '0'
    buildProperties: 'IncludeReferencedProjects=true'
Balran Chavan
  • 155
  • 2
  • 12
  • Sadly this didn't work for me. – GuyB Apr 08 '22 at 12:12
  • Didn't work for me either. I read posts about the different workarounds, I decided it's not worth it and simply added a pipeline to publish the other project as an internal nuget package for our Azure DevOps team and used it it. – iBobb Nov 01 '22 at 15:46