Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Reference the package directly from the project to resolve this issue."

I'm trying to install a nuget package and I get the following error

Restoring packages for C:\git...MyProject.csproj... NU1107: Version conflict detected for Microsoft.Azure.WebJobs. Reference the package directly from the project to resolve this issue. MyProject -> Microsoft.Azure.WebJobs.Extensions.DurableTask 1.4.1 -> Microsoft.Azure.WebJobs (>= 2.2.0) MrProject -> Microsoft.NET.Sdk.Functions 1.0.6 -> Microsoft.Azure.WebJobs (= 2.1.0-beta4). Package restore failed. Rolling back package changes for 'MyProject'. Time Elapsed: 00:00:00.5872740 ========== Finished ==========

I understand the issue, but I don't understand what "Reference the package directly from the project" means. Can someone explain?

like image 701
Hiram Katz Avatar asked Jun 18 '18 00:06

Hiram Katz


People also ask

What is Package reference?

Package references, using <PackageReference> MSBuild items, specify NuGet package dependencies directly within project files, as opposed to having a separate packages. config file. Use of PackageReference doesn't affect other aspects of NuGet; for example, settings in NuGet.

How do I resolve a NuGet package?

Navigate to Tools > Options > NuGet Package Manager > General, and then select the Allow NuGet to download missing packages check box under Package Restore. Enabling Restore NuGet Packages. In Solution Explorer, right-click the solution, and then select Restore NuGet Packages. Selecting Restore NuGet Packages.

How do I add a reference to a NuGet package?

After you install a NuGet package, you can then make a reference to it in your code with the using <namespace> statement, where <namespace> is the name of package you're using. After you've made a reference, you can then call the package through its API.

How do I copy a package from one project to another?

Click on the target Package and use your preferred Import access method to open the 'Import Package from XML' dialog. Select the appropriate options and filename. Click on the Import button. The Package is copied from the source project to the destination project.


1 Answers

NU1107: Version conflict detected for Microsoft.Azure.WebJobs.

Just as you know, this is a dependencies conflict issue. The one of dependency of package Microsoft.NET.Sdk.Functions 1.0.6 is Microsoft.Azure.WebJobs (= 2.1.0-beta4), but the dependencies of package Microsoft.Azure.WebJobs.Extensions.DurableTask need Microsoft.Azure.WebJobs (>= 2.2.0). That is the version conflict.

but I don't understand what "Reference the package directly from the project" means. Can someone explain?

That means you can reference the dll file directly not using NuGet.

Details:

Download that nuget packages Microsoft.Azure.WebJobs.Extensions.DurableTask.nupkg from the nuget.org, rename the file name to .zip, then unzip it. On the Solution explorer, select Dependencies->Add Dependencies->Browse->Select the dll file from the local folder.

Besides, Error message provides a common method to resolve this issue, but the best way to resolve this issue is update the package Microsoft.NET.Sdk.Functions to 1.0.12 and above, which with a dependency Microsoft.Azure.WebJobs (>= 2.2.0 && < 2.3.0). This will compatible with package Microsoft.Azure.WebJobs.Extensions.DurableTask 1.4.1.

Hope this helps.

like image 96
Leo Liu-MSFT Avatar answered Oct 17 '22 15:10

Leo Liu-MSFT