dotnet cli - "detected package downgrade" - asp.net-core

I have finally managed to get a project's dependencies downloaded with dotnet restore, after going through the process of clearing all nuget cache, dnx cache, and updating the cli using the beta channel.
But using the project.json below, I get an error;
warn : Detected package downgrade: Microsoft.Dnx.Compilation.CSharp.Abstractions from 1.0.0-rc2-16553 to 1.0.0-rc2-16552
I'm not sure what this means, or how to fix it. The things still download, but this concerns me.
I am using the following;
dotnet/cli
.NET Command Line Tools (1.0.0-beta-001540)
Product Information:
Version: 1.0.0-beta-001540
Commit Sha: 6aeed1f52d
Runtime Environment:
OS Name: Windows
OS Version: 10.0.10586
OS Platform: Windows
Runtime Id: win10-x64
dnvm list
Active Version Runtime Architecture OperatingSystem Alias
------ ------- ------- ------------ --------------- -----
1.0.0-rc1-update1 clr x64 win
1.0.0-rc1-update1 clr x86 win
1.0.0-rc1-update1 coreclr x64 win
1.0.0-rc1-update1 coreclr x86 win
1.0.0-rc2-16551 clr x86 win
* 1.0.0-rc2-16551 coreclr x64 win default
1.0.0-rc2-16551 coreclr x86 win
nuget.config
<packageSources>
<add key="aspnet-core" value="https://www.myget.org/F/aspnetcidev/api/v3/index.json" />
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
</packageSources>
project.json
{
"webroot": "wwwroot",
"version": "1.0.0-*",
"dependencies": {
"Microsoft.NETCore.Platforms": "1.0.1-*",
"Microsoft.AspNetCore.Diagnostics": "1.0.0-*",
"Microsoft.AspNetCore.IISPlatformHandler": "1.0.0-*",
"Microsoft.AspNetCore.Mvc": "1.0.0-*",
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.0-*",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*",
"Microsoft.AspNetCore.StaticFiles": "1.0.0-*",
"Microsoft.Extensions.Configuration.Json": "1.0.0-*",
"Microsoft.Extensions.Logging.Console": "1.0.0-*",
"Microsoft.AspNetCore.Identity": "1.0.0-*",
},
"frameworks": {
"dnx451": {
"dependencies": {
"Microsoft.AspNetCore.Mvc.Dnx": "1.0.0-*"
}
},
"net451": { },
"dnxcore50": {
"imports": "portable-net451+win7+win8",
"dependencies": {
"NETStandard.Library": "1.0.0-*"
}
}
},
"publishExclude": [
"node_modules",
"bower_components",
"**.xproj",
"**.user",
"**.vspscc"
],
"exclude": [
"wwwroot",
"node_modules",
"bower_components"
]
}

One of the libraries explicitly require 1.0.0-rc2-16552 version, that's why you get the warning. Once the library u[grade to supports higher version warnings will disappear.
This is an old post so not sure which library is doing this at the time of your post, but for people with same warning, go through your libraries and look which one has version dependency.
Basically, remove the library or stay on downgraded version until the library updates and supports the new version.

Related

Asp.net Core EF in VS 2015

I follow ASP.NET Core - New Database to use EF in Asp.net Core under VS 2015. But got below error after installing the packages.
Startup project 'src\CoreMVCWebAPI' is an ASP.NET Core or .NET Core
project for Visual Studio 2015. This version of the Entity Framework
Core Package Manager Console Tools doesn't support these types of
projects.
In the document, it says, it need VS 2017 RC, I am wondering whether it is available under VS 2015, or is there any workaround that I could use EF in Asp.net Core, or Ado.net to retrive Data from SQL DataBase.
PM> Add-Migration MyFirstMigration
Invalid object passed in, ':' or '}' expected. (339): {
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.1",
"type": "platform"
},
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.Extensions.Logging.Console": "1.0.0",
//Dependence for MVC
"Microsoft.AspNetCore.Mvc": "1.1.1",
"Microsoft.AspNetCore.StaticFiles": "1.1.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
//Dependence for EF
"Microsoft.EntityFrameworkCore":"1.1.0",
"Microsoft.EntityFrameworkCore.InMemory": "1.1.0",
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
"Microsoft.EntityFrameworkCore.Tools":"1.1.0-preview4-final"
//Dependence for EF with SQL, this is avalible under VS 2017 RC
//"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
//Entity Framework commands to maintain the database
//"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview4-final"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
//used for Razor pages which are compiled at runtime,and the compiler needs access to reference assemblies,
//to make sure it compiles correctly
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"web.config"
]
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
Source Code:https://github.com/Edward-Zhou/DotNetCore
You cant use MSBuild (Visual Studio 2017) packages in CSproj (Visual Studio 2015) project. If you will change Microsoft.EntityFrameworkCore.Tools version from 1.1.0-msbuild3-final to for example 1.1.0-preview4-final it should work
Also comments were not allowed in project.json to comply strictly with JSON format. See this announcement github.com/aspnet/Announcements/issues/24 and linked issue for more information/discussion.
You need a reference to EntityFrameWorkCore.Tools.DotNet in the Tools Section as below
"Microsoft.EntityFrameworkCore.Tools.DotNet": "1.0.0"
For more info, look at my answer here.
The term "Add-Migration" is not recognized
You must install an earlier version of EF Core, due to compatibility of .NET Core 2.0 with Visual Studio 2015.
I selected EF Core 1.1.5 version and got the message: "Successfully installed 'Microsoft.EntityFrameworkCore.Tools 1.1.5'"
Greetings, Andres!

Why can't my Core 1 library be seen in my ASP.NET Core 1.0 (MVC6) project?

I have a little class library (Core 1), separate so that other apps may also use it, and all those reasons. It has only POCO model classes and a DbContext derivative. Its project file looks as follows:
{
"version": "1.0.0-*",
"dependencies": {
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.0",
"NETStandard.Library": "1.5.0-rc2-24027",
"System.ComponentModel.Annotations": "4.1.0"
},
"frameworks": {
"netstandard1.5": {
"imports": "dnxcore50"
}
}
}
Then I have an ASP.NET Core Web Application (.NET Core) that I wish to use the class library in. Nearly everywhere I look, and I've looked, says to just add the library to the main project's dependencies section of its project file. There it is, right at the top:
"dependencies": {
"WideWorld.Filing": "1.0.0.0",
"Microsoft.NETCore.App": {
"version": "1.0.0-rc2-3002702",
"type": "platform"
},
"Microsoft.ApplicationInsights.AspNetCore": "1.0.0-rc2-final",
I can't even see the library namespace WideWorld.Filing in the main project, where I can, obviously, see its namespace, WideWorld.Office. I am very, very new to Core 1, and have only build monolith web applications before, so please excuse my ignorance if I'm missing something obvious.
If I do a package restore on the main project, I get three warnings in the log (and other stuff that looks harmless):
warn : Detected package downgrade: Microsoft.EntityFrameworkCore.SqlServer from 1.0.0 to 1.0.0-rc2-final
warn : WideWorld.Office (>= 1.0.0) -> WideWorld.Filing (>= 1.0.0) -> Microsoft.EntityFrameworkCore.SqlServer (>= 1.0.0)
warn : WideWorld.Office (>= 1.0.0) -> Microsoft.EntityFrameworkCore.SqlServer (>= 1.0.0-rc2-final)
The issue is that you're mixing packages versions. For example the RTM and RC2 packages are not compatible. You should either target everything as RC2 (which I'd advise against) or take the more preferred approach and upgrade all package references to RTM, targeting version 1.0.0.
More details here:
Note, I have omitted the "import": "dnxcore50"
{
"version": "1.0.0-*",
"dependencies": {
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.0",
"NETStandard.Library": "1.6.0",
"System.ComponentModel.Annotations": "4.1.0"
},
"frameworks": {
"netstandard1.5": { }
}
}
Likewise, in the other project.json do this:
"dependencies": {
"WideWorld.Filing": "1.0.0.0",
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
},
"Microsoft.ApplicationInsights.AspNetCore": "1.0.0"
Additional details on packages.

ASPNET Core pre-RC2 dependency ambiguity

I am using:
.NET Command Line Tools (1.0.0-rc2-002439)
Product Information:
Version: 1.0.0-rc2-002439
Commit Sha: ef0c3b2cee
Runtime Environment:
OS Name: Windows
OS Version: 10.0.10586
OS Platform: Windows
RID: win10-x64
and getting:
error CS0121: The call is ambiguous between the following methods or properties: 'Microsoft.Extensions.DependencyInjection.OptionsServiceCollectionExtensions.Configure(Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Action)' and 'Microsoft.Extensions.DependencyInjection.OptionsServiceCollectionExtensions.Configure(Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Action)'
I suspect there are multiple OptionsModel assemblies (different versions) included on "dotnet restore".
The proof may be here:
The second suggestion with different parameter name:
Project.lock.json file has few interesting lines ("Infrastructure" is a referenced assembly):
"Infrastructure/1.0.0": {
"type": "project",
"framework": ".NETFramework,Version=v4.6.1",
"dependencies": {
"Domain": "1.0.0",
"Microsoft.Extensions.Caching.Abstractions": "1.0.0",
"Microsoft.Extensions.OptionsModel": "1.0.0",
"Newtonsoft.Json": "8.0.3",
"WindowsAzure.Storage": "6.2.1"
},
"compile": {
"net461/Infrastructure.dll": {}
},
"runtime": {
"net461/Infrastructure.dll": {}
}
}
while the web application uses Microsoft.Extensions.OptionsModel/1.0.0-rc2-15914
Here is the configuration section of Infrastructure assembly:
"dependencies": {
"Domain": "1.0.0-*",
"Microsoft.Extensions.Caching.Abstractions": "1.0.0-*",
"Microsoft.Extensions.OptionsModel": "1.0.0-*",
"Newtonsoft.Json": "8.0.3",
"WindowsAzure.Storage": "6.2.1-*"
}
The question is: why different versions (1.0.0 and 1.0.0-rc2-15914) are chosen while executing "dotnet restore"?
UPDATE: I tried changing project.json of Infrastructure project to "Microsoft.Extensions.OptionsModel": "1.0.0-rc2-15914" but I am still can't compile because of ambiguity displayed in screenshots. Are any assemblies cached somewhere on my computer?
The solution is:
Microsoft.Extensions.Options instead of Microsoft.Extensions.OptionsModel package had to be used in a referenced project.

dotnet restore - "not compatible with win7"

I am attempting to use dotnet restore on a dotnet core project, and it seems to work fine until the very end, when I suddenly get this weird message.
error: System.IO.IsolatedStorage 4.0.1-beta-23516 provides a
compile-time reference assembly for System.IO.IsolatedStorage on
DNXCore,Version=v5.0, but there is no run-time assembly compatible
with win7-x64.
error: System.IO.IsolatedStorage 4.0.1-beta-23516 provides a
compile-time reference assembly for System.IO.IsolatedStorage on
DNXCore,Version=v5.0, but there is no run-time assembly compatible
with win7-x86.
I have searched high and low for answers to this, but I'm totally lost. I've posted my project.json below for reference, as well as my nuget.config feeds.
nuget.config feeds
<packageSources>
<add key="aspnet-core" value="https://www.myget.org/F/aspnetcidev/api/v3/index.json" />
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
</packageSources>
project.json
{
"webroot": "wwwroot",
"version": "1.0.0-*",
"dependencies": {
"Microsoft.NETCore.Platforms": "1.0.1-*",
"Microsoft.AspNetCore.Diagnostics": "1.0.0-*",
"Microsoft.AspNetCore.IISPlatformHandler": "1.0.0-*",
"Microsoft.AspNetCore.Mvc": "1.0.0-*",
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.0-*",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*",
"Microsoft.AspNetCore.StaticFiles": "1.0.0-*",
"Microsoft.Extensions.Configuration.Json": "1.0.0-*",
"Microsoft.Extensions.Logging.Console": "1.0.0-*",
"Microsoft.AspNetCore.Identity": "1.0.0-*"
},
"frameworks": {
"dnx451": {
"dependencies": {
"Microsoft.AspNetCore.Mvc.Dnx": "1.0.0-*"
}
},
"net451": { },
"dnxcore50": {
"imports": "portable-net451+win7+win8",
"dependencies": {
"NETStandard.Library": "1.0.0-*"
}
}
},
"publishExclude": [
"node_modules",
"bower_components",
"**.xproj",
"**.user",
"**.vspscc"
],
"exclude": [
"wwwroot",
"node_modules",
"bower_components"
]
}
Update
I have cleared the following directories;
%userprofile%\.nuget
%userprofile%\.dnx\packages
%localappdata%\NuGet\v3-cache
Then I ran the updater at /scripts/obtain/ from the dotnet/cli/ repository with the following command...
.\install.ps1 -channel beta
Then I went back and did dotnet restore on my project, it does say that it worked, but I get the following warning.
warn : Detected package downgrade: Microsoft.Dnx.Compilation.CSharp.Abstractions from 1.0.0-rc2-16553 to 1.0.0-rc2-16552
Is there anything I can do about that?
Your project looks totally fine and it restores without errors:
log : Restore completed in 69790ms.
NuGet Config files used:
D:\Temp\tempmvc\NuGet.Config
C:\Users\victor\AppData\Roaming\NuGet\NuGet.Config
Feeds used:
https://www.myget.org/F/aspnetcidev/api/v3/index.json
https://api.nuget.org/v3/index.json
https://www.nuget.org/api/v2/
Installed:
279 package(s) to D:\Temp\tempmvc\project.json
You might have some newer packages from other feeds in the packages caches or you might be using the wrong version of dotnet cli. Make sure you install the CLI from the beta channel.
To clear the caches delete:
%userprofile%\.nuget
%localappdata%\NuGet\v3-cache
To install the CLI from the beta feed, run the script from here:
install.ps1 -channel beta
The above answer is no longer valid with respect to the install.ps1 statement, but I cannot comment there:
The script name is now dotnet-install.ps1 and the parameters for channel are now: future, preview, and production with production being the most stable.
i.e.
dotnet-install.ps1 -channel production
EDIT: well for the moment -channel beta does still work and production does not exist yet, despite being listed in the source code :) the joys of pre-release software...

VS2015 ASP.NET 5 beta7 dependency could not be resolved

This is a follow-up to this question. I started with an Empty ASP.NET project in VS2015 community, tried to add a couple packages based on a tutorial, and haven't gotten it to actually work yet. The initial problem in the linked question was due to some project dependencies using beta5 and some using beta7. Matching those up solved that, but now I get this error when I try to run the project in IIS Express:
Could not load file or assembly 'Microsoft.Dnx.Host.Clr' or one of its dependencies.
I think the problem is still version related--like the previous web.config assembly reference issues--but I don't know how to deal with it yet. I tried modifying global.json based on a similar issue I found on GitHub, but now it doesn't build. It looks like it can't find the newer version of the CLR I guess. From the Error List in VS2015:
The dependency Microsoft.AspNet.Mvc >= 6.0.0-beta7 could not be resolved.
The dependency Microsoft.AspNet.Server.IIS >= 1.0.0-beta7 could not be resolved.
The dependency Microsoft.AspNet.Server.WebListener >= 1.0.0-beta7 could not be resolved.
global.json:
{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-beta7",
"runtime": "clr",
"architecture": "x86"
}
}
My project's References tree has yellow error indicators but looking in the NuGet package manager for my project doesn't show any upgrades (or anything installed at all, as far as I can tell).
dnvm list:
1.0.0-beta5 clr x64
1.0.0-beta5 clr x86
1.0.0-beta5 coreclr x64
1.0.0-beta5 coreclr x86
* 1.0.0-beta7 clr x86 default
1.0.0-beta8-15585 clr x86
dnu list:
Microsoft .NET Development Utility CLR-x86-1.0.0-beta7-15532
I've restart VS but that didn't help. Changing back to beta5 in my global.json makes it compule successfully but then I get the IIS error.
project.json:
{
"webroot": "public",
"version": "1.0.0-*",
"dependencies": {
"Microsoft.AspNet.Mvc": "6.0.0-beta7",
"Microsoft.AspNet.Server.IIS": "1.0.0-beta7",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta7"
},
"commands": {
"web": "Microsoft.AspNet.Hosting --config hosting.ini"
},
"frameworks": {
"dnx451": { },
"dnxcore50": { }
},
"publishExclude": [
"node_modules",
"bower_components",
"**.xproj",
"**.user",
"**.vspscc"
],
"exclude": [
"public",
"node_modules",
"bower_components"
]
}
package.json:
{
"version": "1.0.0",
"name": "ASP.NET",
"private": true,
"devDependencies": {
"angular2": "2.0.0-alpha.36",
"gulp": "3.9.0"
}
}
"To use ASP.NET 5 beta7 with Visual Studio 2015, you will need to download and install the beta7 version (14.0.60831.0) of ASP.NET and Web Tools 2015."
http://go.microsoft.com/fwlink/?LinkId=623894
https://github.com/aspnet/Home/releases