none
"dotnet pack" how to add PackageReferences to nuspec without target framework RRS feed

  • Question

  • Hi!

    I'm using dotnet pack cli command to create nuget package for .NETStandard1.3 csproj. I have few PackageReferences in my csproj file. The dependencies part in generated nuspec file has all dependencies under targetFramework=".NETStandard1.3" group (see below). When using this new nupckg with .Net45, Xamarin, etc i'm not getting dependant packages restored because they are not .NETStandard1.3 target. Please help me to fix this issue

    <group targetFramework=".NETStandard1.3">
    <dependency id="Newtonsoft.Json" version="10.0.3" exclude="Build,Analyzers" />

    Monday, October 30, 2017 9:08 PM

Answers

  • Hi StLouiss266,

    You can generate the package in your local, then upload the package to CI server. Since you don't want to modify it on the Client server, I'm afraid currently there isn't other appropriate approach for this. 

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by StLouiss266 Wednesday, November 1, 2017 12:12 PM
    Wednesday, November 1, 2017 2:09 AM
    Moderator

All replies

  • Hi StLouiss266,

    Thank you for posting in MSDN forum.

    You can use NuGet command line to create the .nuspec file for .NETStandard1.3 csproj which including the group targetFramework=".net45" or move all dependencies out of group targetFramework=".NETStandard1.3".

    Then pack the .nuspec file. See the Create .NET Standard packages
    with Visual Studio 2015
    for details.

    Besides, I would like provide you a simple way to fix this issue, please follow below steps:

    1. Download the NuGet Package Explorer and install it, https://npe.codeplex.com/downloads/get/clickOnce/NuGetPackageExplorer.application
    2. Open the package with NuGet Package Explorer, select Edit->Edit Metadata->Edit Dependencies, rename the target framework.

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.



    Tuesday, October 31, 2017 5:38 AM
    Moderator
  • Thanks you for your reply!

    I cannot use package explorer since I'm building on CI server.  Is there any way to do that without separate nuspec file? I want to avoid duplication.

    Thank you, Ostap.

    Tuesday, October 31, 2017 10:02 AM
  • Hi StLouiss266,

    You can generate the package in your local, then upload the package to CI server. Since you don't want to modify it on the Client server, I'm afraid currently there isn't other appropriate approach for this. 

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by StLouiss266 Wednesday, November 1, 2017 12:12 PM
    Wednesday, November 1, 2017 2:09 AM
    Moderator