Builds fine locally but getting following error on VSTS build server. Issue is clear but not able to resolve it.
018-07-18T19:41:24.6993903Z ##[error]The nuget command failed with exit code(1) and error(NU1107: Version conflict detected for Microsoft.AspNetCore.Http.Abstractions. Reference the package directly from the project to resolve this issue.
webapi.admin -> Microsoft.AspNetCore.Cors 2.1.1 -> Microsoft.AspNetCore.Http.Extensions 2.1.1 -> Microsoft.AspNetCore.Http.Abstractions (>= 2.1.1)
webapi.admin -> Microsoft.AspNetCore.App 2.1.0 -> Microsoft.AspNetCore.Http.Abstractions (= 2.1.0).
Can you upgrade Microsoft.AspNetCore.App to version 2.1.1?
Or just upgrade all your nuget references to the latest version? (2.1.2 for these)
As for building locally working, try cleaning, or create a fresh clone of the source control repo and see if that works.
Explicitly setting the version attribute resolved it, changed:
<PackageReference Include="Microsoft.AspNetCore.App" />
to
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.1" />
More details here: https://github.com/aspnet/Universe/issues/1180#issuecomment-392180608
I was dealing with these issues too but it was because I simply copied a deployment YAML file from somewhere else and did not use the proper tooling. After following this tutorial, it worked like a charm:
https://learn.microsoft.com/en-us/azure/devops/pipelines/languages/dotnet-core?view=azure-devops
More specifically, I think using the dotnet restore to restore your packages might fix it:
steps:
- script: dotnet restore
Make sure to install the correct .NET Core SDK, too.
steps:
- task: DotNetCoreInstaller#0
inputs:
version: '2.1.300' # replace this value with the version that you need for your project
Related
I have ported a .net application to .netcore and want to publish it as a self-contained application. Unfortunately, this does not work:
dotnet publish -r win-x64
Microsoft (R) Build Engine version 16.4.0+e901037fe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
<Path>\IPLauncher.csproj : error NU1100: Unable to resolve 'Microsoft.NETCore.App.Runtime.win-x64 (= 3.1.2)' for '.NETCoreApp,Version=v3.1'.
<Path>\IPLauncher.csproj : error NU1100: Unable to resolve 'Microsoft.WindowsDesktop.App.Runtime.win-x64 (= 3.1.2)' for '.NETCoreApp,Version=v3.1'.
<Path>\IPLauncher.csproj : error NU1100: Unable to resolve 'Microsoft.AspNetCore.App.Runtime.win-x64 (= 3.1.2)' for '.NETCoreApp,Version=v3.1'.
Restore failed in 179,65 ms for <Path>\IPLauncher.csproj.
In case it is important, my csproj-file looks like this:
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
</Project>
Edited to add: The weirdest part is that my colleague can publish a self-contained exe for the same project with identical configuration - so it seems to be some problem with my configuration.
It seems like nuget restore command for your application can't restore some packages.
There are many reasons for that, but you can do basic research for determine why it's heppens. Here some tips:
Clear all NuGet caches dotnet nuget locals all --clear
Check if NuGet packages you trying to restore accessible from nuget.org website. Official nuget package manager website has different API's (v2/v3) so you must check you use latest version of API.
If you use NuGet package not from official portal - verify that NuGet server you use for restoring nuget packages is accessible.
These settings placed in default nuget.config file here: %appdata%\NuGet\NuGet.config
Note that if you using custom nuget.config for your project/solution it's overrides default nuget settings. This file can contains some settings that breaks restore command. So check it out first.
I'm using Xamarin.Forms.Maps and Microsoft.AppCenter.Push in my PCL project. Lately I tried to update my Push to latest version, but it's clashing with the Maps because different version of Xamarin.GooglePlayServices.Base is expected.
Severity Code Description Project File Line Suppression State Error
NU1107 Version conflict detected for Xamarin.GooglePlayServices.Base.
Install/reference Xamarin.GooglePlayServices.Base 71.1610.0 directly
to project XXX.Android to resolve this issue.
XXX.Android -> Microsoft.AppCenter.Push 2.5.0 ->
Xamarin.Firebase.Messaging 71.1740.0 -> Xamarin.Firebase.Iid 71.1710.0
-> Xamarin.Firebase.Iid.Interop 71.1601.0 -> Xamarin.GooglePlayServices.Base (>= 71.1610.0)
XXX.Android -> Xamarin.Forms.Maps 4.3.0.947036 ->
Xamarin.GooglePlayServices.Maps 60.1142.1 ->
Xamarin.GooglePlayServices.Base (= 60.1142.1).
Push is expecting version 71 while Maps is expecting version 60. May I know how to resolve this and I'm curious why cannot the Maps use the later version? Is it not backward compatible?
Thank you.
Yes, I have reproduce this problem as you said.
Accoriding to the error log, we know that the problem is that though the Xamarin.Forms.Maps Nuget have been updated to a newer version, but the package (Xamarin.GooglePlayServices.Base) in this nuget hasn't been updated synchronously to the later version( 71.1610.0). It should be an issue of this Nuget. And we can report it as a bug here: https://github.com/xamarin/Xamarin.Forms/issues
For now, in order to keep the code working properly,what we can do is keep the two Nuget versions in sync.
Just install nuget Microsoft.AppCenter.Push 2.1.1 and nuget Xamarin.Forms.Maps 4.3.0.947036.
EDITED
If you read the comments, there is one saying that you can install dependencies manually.
In this case, by visiting the NuGet repo for Xamarin.Forms.Maps you can see in the dependencies list that it requires Xamarin.GooglePlayServices.Maps.
Just make sure you already have dependencies installed, or simply add them to your Android solution (I added also Xamarin.Android.Support.v7.AppCompat).
By following these steps, I'm able to run both Xamarin.Forms.Maps (v4.4.0.991477) and Microsoft.AppCenter.Push (v2.6.4).
There is an issue on the GitHub relate repo and seems to be fixed.
Refer to following link please
NuGet version conflict between Xamarin.Froms.Maps and Microsoft.AppCenter.Push
You can check the whole evolution of the issue.
I updated a project from netcoreapp2.2 to netcoreapp3.0 and use Preview8 SDK as well as Microsoft.EntityFrameworkCore.SqlServer, tools, and design.
I can build and run my projects locally just find (VS 2019). But when I try to deploy with Azure DevOps, the Nuget restore gives this error:
NU1202: Package Microsoft.EntityFrameworkCore.SqlServer 3.0.0-preview8.19405.11 is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0). Package Microsoft.EntityFrameworkCore.SqlServer 3.0.0-preview8.19405.11 supports: netstandard2.1 (.NETStandard,Version=v2.1)
Every reference to an EntityFrameworkCore package will result in that error.
I'm setting the .Net Core SDK in the pipeline to Preview8 via a global.json.
I have a NuGet tool installer task, bringing in the latest version, and a Nuget Restore task command running against my solution.
My problem was that I was using the Nuget Restore. Changing it to dotnet restore made the trick.
This problem is caused by an obsolete version of NuGet agent.
Use NuGet Install Tool task (a.k.a. Use NuGet) and setup the agent to the v5.x.
This is a low profile solution.
EDIT: Yay, I have enough rep to comment now.
It turns out the easier fix is to updatethe NuGet package version to the latest (5.3.0) in the "Use NuGet" task.
Not enough rep to comment on Fernando's response but it worked for me.
Edit the pipeline's Agent tasks:
add .NET Core, Display name: dotnet restore, Command: restore
set up other properties pretty much the same as the existing NuGet Restore
remove NuGet restore
Pipeline Nuget restore failing on .Net Core 3.0 Preview 8 project (NU1202)
If you are using the host agent, you should make sure you have install the netcoreapp3.0 on the agent. You could use the task Use .NET Core to install it:
Note check the option Include Preview Versions.
Note: Since netcoreapp3.0 supported by Visual Studio 2019, so, you need to make sure your agent is Hosted Windows 2019 with VS2019.
Hope this helps.
I am using
Microsoft.EntityFrameworkCore.Sqlite version 2.2.4
Microsoft.EntityFrameworkCore version 2.2.4
nuget packages on my .net core class library.
When adding my class library to Console application I am getting the following exception:
FileNotFoundException: Could not load file or assembly 'SQLitePCLRaw.core, Version=1.1.12.351, Culture=neutral, PublicKeyToken=1488e028ca7ab535'. The system cannot find the file specified.
My code is running on windows but will also run on Linux.
Is there any solution?
I saw a recommendation for adding
Microsoft.EntityFrameworkCore.Sqlite nuget to my console application.
but I prefer avoiding this solution.
i just faced same problem and doing these steps solve it
remove obj and bin folder
run dotnet restore --force
Just had this issue - something had set AutoGenerateBindingRedirects to false in my .csproj file. Reverting it back to true fixed it.
I had to Downgrade to a lower version.
<PackageReference Include="sqlite-net-pcl" Version="1.6.292" />
<!--<PackageReference Include="sqlite-net-pcl" Version="1.8.116" />-->
I'm getting
Unable to resolve 'NETStandard.Library (>= 1.6.1)' for '.NETStandard,Version=v2.0'.
in VSTS build using Hosted2017 build agent after I upgraded my aspnetcore app to netcoreapp2.0 and my libraries to use netstandard2.0.
Works fine locally.
I've edited my build definition to use .net core build task v2.* preview:
here is the build log:
Current agent version: '2.120.2'
Download all required tasks.
Downloading task: DotNetCoreCLI
Starting: Get Sources
Syncing repository: Liero/vyvojari-sk (GitHub)
...details ommited
HEAD is now at e448a25... Upgraded to .NET Core 2.0
Finishing: Get Sources
Starting: Restore
==============================================================================
Task : .NET Core
Description : Build, test, package, or publish a dotnet application, or run a custom dotnet command. For package commands, supports NuGet.org and authenticated feeds like Package Management and MyGet.
Version : 2.0.5
Author : Microsoft Corporation
Help : [More Information](https://go.microsoft.com/fwlink/?linkid=832194)
==============================================================================
SYSTEMVSSCONNECTION exists true
Downloading: https://dist.nuget.org/win-x86-commandline/v4.0.0/nuget.exe
Caching tool: NuGet 4.0.0 x64
Using version: 4.0.0
Found tool in cache: NuGet 4.0.0 x64
Saving NuGet.config to a temporary config file.
Can\'t find loc string for key: NGCommon_NoSourcesFoundInConfig
NGCommon_NoSourcesFoundInConfig d:\a\1\Nuget\tempNuGet_734.config
"C:\Program Files\dotnet\dotnet.exe" restore d:\a\1\s\src\CommandStack\CommandStack.csproj --configfile d:\a\1\Nuget\tempNuGet_734.config --verbosity Detailed
Restoring packages for d:\a\1\s\src\CommandStack\CommandStack.csproj...
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): error : Unable to resolve 'NETStandard.Library (>= 1.6.1)' for '.NETStandard,Version=v2.0'. [d:\a\1\s\src\CommandStack\CommandStack.csproj]
Generating MSBuild file d:\a\1\s\src\CommandStack\obj\CommandStack.csproj.nuget.g.props.
Generating MSBuild file d:\a\1\s\src\CommandStack\obj\CommandStack.csproj.nuget.g.targets.
Writing lock file to disk. Path: d:\a\1\s\src\CommandStack\obj\project.assets.json
Restore failed in 115.64 ms for d:\a\1\s\src\CommandStack\CommandStack.csproj.
Errors in d:\a\1\s\src\CommandStack\CommandStack.csproj
Unable to resolve 'NETStandard.Library (>= 1.6.1)' for '.NETStandard,Version=v2.0'.
NuGet Config files used:
d:\a\1\Nuget\tempNuGet_734.config
Error: C:\Program Files\dotnet\dotnet.exe failed with return code: 1
Packages failed to restore
******************************************************************************
Finishing: Restore
******************************************************************************
and here is the source code: https://github.com/Liero/vyvojari-sk/tree/e448a25fb8c481704e9102aaaeb8b84b9aee7b02
Update 18/09/2017
Step 2 is no longer needed. I've left it in the solution though as it may still help some people. Thanks, #Liero for point this out.
Original Answer
I've just experienced this problem too and solved it by doing three things:
Use the .NET Core SDK(! - not runtime!) version 2.0.0:
Use the latest NuGet feed (4.3.0):
Restore your packages:
Update
It's worth mentioning here that you should specify where you get your NuGet packages from. Most applications will probably just use the NuGet.org feed, as per the screenshot (see small checkbox), but you may have your custom feeds specified in a NuGet.config file. In that case, tick 'Feeds in my NuGet.config' and then specify the path to that file.
To illustrate the order, this is my working queue:
I hope this helps you and anyone else who has come up against this problem. If you have any questions, let me know. :)
You should select Feed(s) I select here for Feeds to use option. If you leave Use packages from this VSTS/TFS feed empty, packages will be downloaded from https://dist.nuget.org/.
Else, if you want to use Feeds in my NuGet.config as Feeds to use, you should specify the path for your NuGet.config file.
I have received a similar error after generating a project using dotnet new angular which created a project relying on netcoreapp2.0. Inspection of project properties revealed that version 2.0 was not properly recognized (did not appear in the installed framework list).
Solution was to update Visual Studio 2017, as the minimum version required to support netcoreapp2.0 projects seems to be 15.3.1.
What worked for me was installing .NET Core SDK 2.0 and making the following changes:
in .csproj:
change
<TargetFramework>netcoreapp1.1.0</TargetFramework>
to
<TargetFramework>netcoreapp2.0</TargetFramework>
and in global.json:
"sdk": { "version": "1.1.0" }
to
"sdk": { "version": "2.0.0" }
I didn't know how to use Chris Paton' solution
Updating the Visual Studio 2017 to latest 15.4.1 version resolved the problem for me.