Skip to content

Example "Pack the project using a .nuspec file" has issues #13281

Closed

Description

@tpeiffer

There are multiple issues with this example.

First, this example uses /p: instead of the -p: used everywhere else, which is misleading. It is valid syntax, but it is not consistent with the rest of the document, nor with the supporting document that it links to.

Second, the link that provides detail on how to pack the project using a .nuspec file says to use the following syntax for NuspecProperties:
-p:NuspecProperties=\"key1=value1;key2=value2\"

But the escape characters are not needed. In fact, if you use the escape character in an Azure DevOps pipeline it will not pass the properties to the .nuspec file and the task will fail.

Example that fails from an Azure DevOps .NET core task:
-p:NuspecProperties=\"version=$(build.buildNumber)\"

The following works correctly in Azure DevOps and when running from the command line (Win 10):
-p:NuspecProperties="version=$(build.buildNumber)"

Please add a valid example of NuspecProperties to the example on this page. It seems like this property would be used as much as NuspecBasePath.

Thank you!


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Activity

  1. mairaw commented on Aug 9, 2019

    @mairaw
    Contributor

    Thanks for your feedback @tpeiffer. @karann-msft @rohit21agrawal can you help with this request? Is the command we have for dotnet pack invalid here?

    Also, can you check that the article referenced here (https://docs.microsoft.com/nuget/reference/msbuild-targets#packing-using-a-nuspec) is correct when it comes to NuspecProperties?

    I'm taking care of the first issue, to make the option consistent by using -p.

  2. added
    waiting-on-feedback
    and removed
    ⌚ Not Triaged
    on Aug 9, 2019
  3. self-assigned this
    on Aug 9, 2019
  4. added this to the August 2019 milestone on Aug 9, 2019
  5. removed this from the August 2019 milestone on Dec 4, 2019
  6. removed their assignment
    on Feb 21, 2020
  7. mairaw commented on Feb 21, 2020

    @mairaw
    Contributor
  8. brcaswell commented on Mar 1, 2020

    @brcaswell
  9. 2 remaining items

  10. nkolev92 commented on Mar 2, 2020

    @nkolev92
    Contributor

    I don't think the escaping is necessary in the example.
    Beyond that it's msbuild's parsing that can be tricky. Not sure how to clarify the multi property passing further. Issues like htmlencoded chars affect all msbuild props.

  11. brcaswell commented on Mar 2, 2020

    @brcaswell
  12. brcaswell commented on Mar 2, 2020

    @brcaswell

    actually, my apologize.. I just realized this issue was related to the content of dotnet-pack command page.. my consideration was to msbuild-targets #packing using a nuspec the referenced link in these comments.

    sorry for the confusion.

  13. brcaswell commented on Mar 2, 2020

    @brcaswell

    in the following snippet on the page:

    dotnet pack ~/projects/app1/project.csproj -p:NuspecFile=~/projects/app1/project.nuspec -p:NuspecBasePath=~/projects/app1/nuget

    does -p:NuspecProperties="id=$(PackageId)" work?

    if unspecified (like the example does currently), does it use NuspecProperties in the csproj file?

    I think these are the considerations being raised in this issue, on this page.

  14. sfoslund commented on Apr 24, 2020

    @sfoslund
    Member

    @tdykstra it sounds like this issue should be transfered to msbuild-targets article, per this comment.

    As for this question, I don't know. @nkolev92 do you?

  15. nkolev92 commented on Apr 24, 2020

    @nkolev92
    Contributor

    As for this question, I don't know. @nkolev92 do you?

    @brcaswell Yeah, that's an msbuild thing.
    Things passed on the cmd when invoking msbuild are considered global properties and override the project values. https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-properties?view=vs-2019#global-properties

  16. removed
    waiting-on-feedback
    on Apr 28, 2020
  17. self-assigned this
    on May 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions