Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Supply chain | Supply Chain Management, Commerce
Answered

How to have the version number automatically assign to Nuget packages after an upgrade

(0) ShareShare
ReportReport
Posted on by 1,439

Before the nuget packages were introduced I had my reference in the C# projects, set up similar to the CRT examples and I didn't have to update the version number after each standard version upgrade.

Then the Nuget packages were introduced and it all changed. My projects are still Class Library (.NET Framework) projects. I didn't change them all over to be .NET Standard class libraries.

Looking at the CRT examples, I see the projects use also a variable for the version number, same as before the Nuget package introduction, except this variable has a different name:

Version="$(ChannelRepoPackagesVersion)"

However the CRT sample examples are all .NET Standard class libraries.

If I add the "$(ChannelRepoPackagesVersion)" version number to my .NET Framework projects, on compilation it tells me that it downgrades the Framework package for example.


****


Warning NU1605 Detected package downgrade: Microsoft.Dynamics.Commerce.Runtime.Framework from 10.0.20344.2 to 10.0.20303.3. Reference the package directly from the project to select a different version.
TMCRoundUpDownCRT -> Microsoft.Dynamics.Commerce.Runtime.Services.Messages 9.24.20345.1 -> Microsoft.Dynamics.Commerce.Runtime.Framework (>= 10.0.20344.2)
TMCRoundUpDownCRT -> Microsoft.Dynamics.Commerce.Runtime.Framework (>= 9.24.0) TMCRoundUpDownCRT

****

Currently, every time I upgrade to the next version, I have to go into every single project and click on Manage Nuget Packages and update the version for each package in every project.

This is very time consuming.

Is there a way to use the same variable as the example samples for .NET Framework class libraries projects and not have it downgrade the packages?

Any help is much appreciated..

  • Retha Profile Picture
    1,439 on at
    RE: How to have the version number automatically assign to Nuget packages after an upgrade

    Thank you Todd

    I have added to the top of my projects the import line for :

    "Microsoft.Dynamics.RetailSdk.Build.props"

    And to be sure it always uses the correct framework version, I added the following line to all the CRT projects:

    <PackageReference Include="Microsoft.Dynamics.Commerce.Runtime.Framework" Version="$(FrameworkRepoPackagesVersion)" />

    The retail server projects that uses Hosting.Contracts, is already from Version="$(FrameworkRepoPackagesVersion)"

    And then I added Version="$(ChannelRepoPackagesVersion)" to all the package references that the project uses.. I made sure that I used the correct variable by comparing what the sampleExtensions are using for the same package reference.

    All the projects built their DLLs without any errors.

    Thanks for your help.

  • Verified answer
    ToddB Profile Picture
    on at
    RE: How to have the version number automatically assign to Nuget packages after an upgrade

    Hi Retha,

    Here is what I have been able to find out.

    _______________________________

    It appears that somewhere they are using the wrong version number; and that is why the warning message is coming up.

    If you do not want to go and update all the projects individually for each version, you can have one build prop file and update the version number there.

    Ex: In our SDK we have the Directory.Build.props, where all the version numbers are maintained, for each release they just have to update this file, by default this file will have the latest version number they downloaded.

    In the extension project, use these variables for the package version:

    pastedimage1610137214051v2.png

    Please let me know if this answers your question.

  • Retha Profile Picture
    1,439 on at
    RE: How to have the version number automatically assign to Nuget packages after an upgrade

    Thanks Todd.

    Just keep in mind, because we use class library (.Net Framework) and not .Net Standard, we do not have a Dependencies node in our C# projects, we have a References-node.

    If I use the floating version numbering, then I can only add the asterisk on the 3rd number. So the moment the 1st or 2nd number changes on the next upgrade, I have to manually change all of the nuget package versions manually again.

    So for the v10.0.14 we are currently on, the actual version number is 9.24.20345.1

    The previous hotfix version of v10.0.14 was 9.24.20340.1

    So a floating version number of 9.24.* builds the project correctly without errors.

    However I have no idea if it picks up the correct version because if I right-click on the References-node in my project and choose Manage Nuget Packages, I see the following:

    pastedimage1609951112416v1.png

    So, is it downgrading to v9.24.0 when it builds the project or is it actually building with v9.24.20345.1? It doesn't give me a downgrading message, but  looking at the Nuget Package Manager I also cannot trust that it uses the latest version.

    So being able to use the variable that is in the Microsoft CRT examples, would be nice because I assume it has the variable set up somewhere with the latest version number.

  • ToddB Profile Picture
    on at
    RE: How to have the version number automatically assign to Nuget packages after an upgrade

    Hi Retha,

    I am researching this; and will let you know what I find out.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,112 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,893 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans