Are you seeing the NU1107 error in Visual Studio when you restore or build a .NET project? The error means that NuGet has detected a version conflict between packages and cannot determine a compatible dependency version automatically.

In this guide, you'll learn what NU1107 means, why it happens, how to identify the conflicting packages, and several practical ways to fix the problem in Visual Studio.


๐Ÿ“Œ What Is NU1107?

NU1107 is a NuGet dependency conflict error. It occurs when two or more packages require incompatible versions of the same dependency.

For example, imagine your project references two packages:

PackageA โ†’ requires DependencyX 5.0.0
PackageB โ†’ requires DependencyX 6.0.0

If NuGet cannot resolve a version of DependencyX that satisfies both requirements, it reports a version conflict.

You may see an error similar to:

error NU1107: Version conflict detected for DependencyX.
Install/reference DependencyX directly from the project
to resolve this issue.

The actual package names and versions in your error message will depend on your project.


๐Ÿ” Why Does NU1107 Happen?

NU1107 usually occurs because different NuGet packages have incompatible dependency requirements.

Consider this dependency tree:

YourProject
โ”‚
โ”œโ”€โ”€ PackageA
โ”‚   โ””โ”€โ”€ DependencyX 5.x
โ”‚
โ””โ”€โ”€ PackageB
    โ””โ”€โ”€ DependencyX 6.x

Your project depends on both PackageA and PackageB.

However, the two packages require different versions of DependencyX.

If NuGet cannot select a compatible version, the restore operation fails with NU1107.


๐Ÿงช A Simple NU1107 Example

Suppose your project contains these package references:

<ItemGroup>
    <PackageReference Include="PackageA" Version="2.0.0" />
    <PackageReference Include="PackageB" Version="3.0.0" />
</ItemGroup>

Now imagine that their dependencies are:

PackageA 2.0.0
    โ†’ DependencyX 5.x

PackageB 3.0.0
    โ†’ DependencyX 6.x

NuGet may be unable to satisfy both dependency requirements and produce NU1107.


๐Ÿ”Ž How to Find the Conflicting Package

The first step is to read the complete NU1107 message in the Visual Studio Error List.

The error normally tells you which packages are involved in the conflict and which versions are being requested.

For example, you might see a dependency chain similar to:

PackageA
    โ†’ DependencyX (โ‰ฅ 5.0.0)

PackageB
    โ†’ DependencyX (โ‰ฅ 6.0.0)

NU1107: Version conflict detected for DependencyX

In this example, DependencyX is the package you need to investigate.


๐Ÿ› ๏ธ Fix 1: Update the Packages Causing the Conflict

The easiest solution is often to update the packages involved in the conflict.

In Visual Studio:

  1. Right-click your project.
  2. Select Manage NuGet Packages.
  3. Open the Updates tab.
  4. Look for newer versions of the packages involved in NU1107.
  5. Update compatible packages.
  6. Restore and rebuild the project.

A newer version of one package may change its dependency requirements and remove the conflict.


๐Ÿ› ๏ธ Fix 2: Reference the Conflicting Package Directly

The NU1107 message may recommend installing or referencing the conflicting package directly from your project.

For example, if the conflicting dependency is DependencyX, you can add an explicit package reference:

<ItemGroup>
    <PackageReference Include="DependencyX" Version="6.0.0" />
</ItemGroup>

This gives your project an explicit dependency on the selected version.

However, don't choose a version randomly. Check the requirements of the packages involved in the conflict and select a version that is compatible with your project.


๐Ÿ› ๏ธ Fix 3: Check the .csproj File

SDK-style .NET projects normally store NuGet package references inside the .csproj file.

Open your project file and look for package references related to the NU1107 error.

For example:

<ItemGroup>
    <PackageReference Include="PackageA" Version="2.0.0" />
    <PackageReference Include="PackageB" Version="3.0.0" />
    <PackageReference Include="DependencyX" Version="6.0.0" />
</ItemGroup>

Compare the versions with the dependency requirements shown in the NU1107 error.


๐Ÿ”— Direct vs Transitive Dependencies

Understanding the difference between direct and transitive dependencies makes NU1107 much easier to troubleshoot.

๐Ÿ“ฆ Direct Dependency

A direct dependency is a package that your project explicitly references.

YourProject
    โ†“
PackageA

๐Ÿ“ฆ Transitive Dependency

A transitive dependency is brought into your project through another package.

YourProject
    โ†“
PackageA
    โ†“
DependencyX

You may therefore encounter a dependency conflict involving a package that you never explicitly installed.

This is why reading the complete NU1107 dependency chain is important.


๐Ÿงฐ Check Installed NuGet Packages in Visual Studio

You can inspect your project's installed packages through Visual Studio.

Open:

Right-click Project
โ†’ Manage NuGet Packages
โ†’ Installed

Check the versions of the packages involved in the NU1107 message.

If one of the packages is outdated, check whether a newer compatible version is available.


๐Ÿงน Clean and Restore the Project

After changing package references, restore the project and rebuild it.

In Visual Studio, you can use:

Build
โ†’ Clean Solution

Build
โ†’ Rebuild Solution

You can also restore packages using the .NET CLI:

dotnet restore

If the conflict continues after changing the package references, close Visual Studio and remove the project's bin and obj folders.

Then restore the packages again and rebuild the project.


๐Ÿ› ๏ธ Use the .NET CLI to Investigate Dependencies

For SDK-style projects, the .NET CLI can help you inspect the dependency graph.

From the project directory, run:

dotnet list package

This displays the packages referenced by the project and can help you identify direct and transitive dependencies.

On newer .NET SDK versions, you can also use:

dotnet list package --include-transitive

This is particularly useful when the conflicting package is not directly listed in your project file.


โš ๏ธ Don't Just Pick a Random Package Version

One common mistake when fixing NU1107 is changing package versions until the error disappears.

That may make the restore succeed while introducing compatibility problems elsewhere in the application.

Instead, identify the dependency chain first and choose a version that is supported by the packages you're using.


๐Ÿ’ก Recommended Way to Fix NU1107

When you encounter NU1107, follow this order:

  1. Read the complete NU1107 error message.
  2. Identify the conflicting dependency.
  3. Identify the packages requiring different versions.
  4. Check whether newer versions of those packages are available.
  5. Update compatible packages where possible.
  6. Reference the conflicting dependency directly when appropriate.
  7. Restore the NuGet packages.
  8. Clean and rebuild the project.
  9. Test the application after resolving the conflict.

๐Ÿ”„ NU1107 vs NU1605

NU1107 and NU1605 are both related to NuGet dependency versions, but they are not exactly the same problem.

NU1107 indicates a version conflict that NuGet cannot resolve automatically.

NU1605 reports a detected package downgrade, where a dependency is resolved to a lower version than another dependency expects.

If you're dealing with a package downgrade, see:

๐Ÿ‘‰ NuGet Package Downgrade Detected: How to Fix NU1605 in Visual Studio


๐Ÿ”— More NuGet Package Version Troubleshooting

NU1107 is one of several package dependency problems you can encounter in Visual Studio and .NET projects.

For a broader explanation of package version conflicts, see our main guide:

๐Ÿ‘‰ How to Fix NuGet Package Version Conflicts in Visual Studio


๐ŸŽฏ Conclusion

NU1107 occurs when NuGet detects incompatible dependency version requirements and cannot resolve the conflict automatically.

The best approach is to identify the conflicting dependency, inspect the packages that require it, update compatible packages, and explicitly reference a suitable version when necessary.

Don't simply choose a package version at random. Understanding the dependency chain helps you fix NU1107 without introducing new compatibility problems.

๐Ÿ“š More NuGet & Visual Studio Tutorials

Having another NuGet dependency problem? Read the complete NuGet Package Version Conflicts guide โ†’

๐Ÿค– AlgoLassi Assistant Have a question about this tutorial?

Ask AlgoLassi and get an answer plus the tutorials worth studying next.

Ask a question

๐Ÿ’ฌ Comments

Sign in with Google to publish immediately, or comment anonymously and wait for approval.

Comments will appear here when available.