blog
Ottorino Bruni  

Fluent Assertions Licensing Changes: How to Lock NuGet to Version 7.0.0 for .NET Developers

Introduction

Yesterday, the .NET development community was hit with unexpected news Fluent Assertions, the popular library for writing cleaner and more expressive assertions in unit tests, has changed its licensing model starting from version 8.0. This marks a significant shift from the Apache 2.0 open-source license to a new Standard License.

With this change, users now require a paid license for commercial use. A single-user license starts at $129.95, and it includes additional features like priority support and a 60-day guarantee. While this may make sense for some teams, it has caused upheaval among developers, especially in smaller teams or organizations with limited budgets, as developers were accustomed to using Fluent Assertions freely under the original license.

For those who want to avoid the licensing costs but still benefit from Fluent Assertions’ powerful features, the solution is simple: lock your project’s dependency to version 7.0 of Fluent Assertions (the last version under the Apache 2.0 license). In this article, I’ll show you how to configure NuGet to prevent updates to version 8 and beyond, so you can continue using Fluent Assertions safely within the boundaries of the older license.

Locking NuGet to Version 7 of Fluent Assertions

In light of the recent licensing changes, it’s crucial for developers who want to continue using Fluent Assertions under the original Apache license to prevent any accidental updates to version 8.0 and beyond. Fortunately, this process is quite simple and involves a minimal change to your project file.

To lock your project’s dependency to version 7.0.0 of Fluent Assertions, you need to modify your NuGet package reference in your project file (typically the .csproj file). Just locate the reference for Fluent Assertions and update it to the following:

<PackageReference Include="FluentAssertions" Version="[7.0.0]" />

This modification ensures that your project will always use version 7.0.0 of Fluent Assertions, effectively preventing any unintended upgrades. The brackets [ ] in the version specification indicate that your project should only allow version 7.0.0, barring any future updates to 8.0 or higher.

Here’s a quick breakdown of how to implement this:

  1. Open your project file: Locate the .csproj file for your project.
  2. Find the package reference: Look for the <PackageReference> tag for Fluent Assertions.
  3. Update the version: Change the version to [7.0.0] as shown above.
  4. Save and restore packages: Save the changes and run the command dotnet restore from your terminal, or restore the packages through Visual Studio.

By following these steps, you’ll safeguard your project against any licensing issues while continuing to leverage the powerful features of Fluent Assertions.

Fluent Assertions Licensing Changes: How to Lock NuGet to Version 7 for .NET Developers

Conclusion

In summary, the recent licensing change for Fluent Assertions has raised important considerations for .NET developers. By following the simple step of locking your NuGet package reference to version 7.0.0, you can continue using this valuable library without worrying about unexpected licensing costs.

For more information on configuring NuGet package references, check out the official documentation: NuGet Package Version Reference | Microsoft Learn

Stay up to date with these changes, and ensure you’re making informed decisions for your projects!

🚀 Discover CodeSwissKnife, your all-in-one, offline toolkit for developers!

Click to explore CodeSwissKnife 👉

Leave A Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.