Mdelu
Mdelu

Reputation: 11

How to make sure Application takes latest change in Nuget package on each build?

I am using continuous integration to build my nuget project.It builds my application and drops nuget package to Artifactory. The nuget package is then referenced by other applications. Each time I make changes to nuget package and Jenkins builds it, How do I make sure the client application’s Jenkins build is referring latest change from the source nuget package.

Upvotes: 1

Views: 131

Answers (1)

Baurito
Baurito

Reputation: 121

You need to choose appropriate strategy for dependency resolution. Please, kindly inspect this article from MSFT. It explains in great details what options are. In your case you might be satisfied with having highest major version for your dependency to make sure you have Jenkins build to pull the latest dependencies. Overall, everything depends on multiple things like what your versioning schema is, what kind of manifest you use (csproj file, packages.config or custom manifest), how many Nuget feeds your have, how do you want to protect other projects from breaking changes and so on...

If you use csproj file to control your dependencies, you can specify version constraints via PackageReference property:

<ItemGroup>
    <!-- ... -->
    <PackageReference Include="Contoso.Utility.UsefulStuff" Version="3.6.*" />
    <!-- ... -->
</ItemGroup>

If you use Nuget to install dependency for your projects, you can specify how you want to resolve the version. For example, to pull the latest version for package myPackage, you can do this:

nuget install myPackage -DependencyVersion Highest

Upvotes: 1

Related Questions