Whenever I start a .NET CORE 2 web App Project With Authentication (i.e. Individual Authentication) I get the following warning:
Package 'Microsoft.Composition 1.0.27' was restored using '.NETPortable,Version=v0.0,Profile=Profile259, .NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.0'. This package may not be fully compatible with your project.
The issue doesn't stop here, I am trying to install Microsoft.AspNetCore.Authentication.Cookies and I get the following error:
Package restore failed. Rolling back package changes for project
I tried the following, ALL Failed!
How can I resolve this conflict?
Click here please for the project file and a snapshot from my screen
Looks similar to dotnet/runtime#21132.
@AlexGhiondea what is the story of Microsoft.Composition? Does it live in CoreFX repo or somewhere else?
the conflict goes under,
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.0-preview2-final" PrivateAssets="All" />
I did a another installation on another computer and I m getting the same warnings and errors
@karelz , @AlexGhiondea
Adding and updating Microsoft.Composition version 1.0.0.31 solves the warning issue, yet I can not install other packages like Microsoft.AspNetCore.Authentication.Cookies
NuGet Error:
Package restore failed. Rolling back package changes for project
Are you able to install Microsoft.Composition?
@AlexGhiondea
yes, I have now Microsoft.Composition version 1.0.0.31
I managed to install Microsoft.AspNetCore.Authentication.Cookies by installing the pre-release of Microsoft.AspNetCore.Identity.EntityFrameworkCore first but afterwards the warning came back again on Microsoft.Composition version 1.0.0.31
Plus, I keep getting missing reference for cookies even after the installation of the package,
options.Cookies.ApplicationCookie.ExpireTimeSpan = TimeSpan.FromDays(150);
options.Cookies.ApplicationCookie.LoginPath = "/Account/LogIn";
options.Cookies.ApplicationCookie.LogoutPath = "/Account/LogOut";
@embryologist I am not sure what the issue is.. Is there a simple repro that I can try out myself and see what i happening? In particular, I want to know which packages you are referencing.
@AlexGhiondea
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<MvcRazorCompileOnPublish>true</MvcRazorCompileOnPublish>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<UserSecretsId>***********</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0-preview2-final" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="2.0.0-preview2-final" />
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.0.0-preview2-final" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="2.0.0-preview2-final" />
<PackageReference Include="Microsoft.Composition" Version="1.0.31" ExcludeAssets="All" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="2.0.0-preview2-final" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.0.0-preview2-final" />
<PackageReference Include="System.Composition" Version="1.1.0-preview2-25405-01" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0-preview2-final" PrivateAssets="All" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.0-preview2-final" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0-preview2-final" />
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="2.0.0-preview2-final" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0-preview2-final" />
</ItemGroup>
</Project>
The dependency issues have been resolved by adding
<PackageReference Include="Microsoft.Composition" Version="1.0.27" ExcludeAssets="All" />
<PackageReference Include="System.Composition" Version="1.0.31" />
But I still can't use cookies options like in this into
the error is:
identityOptions does not contain a definition for cookies......
Sounds like the package restore works now.
@divega would if that API has moved?
@haok does the error in the latest comment ring any bells? Could this be a known breaking change in ASP.NET Core Identity 2.0?
@embryologist since the original issue is resolved, it may be a good idea to close this issue and continue the conversation over at at https://github.com/aspnet/identity. A minimal repro would also help a lot as @AlexGhiondea said.
Excuse my ignorance, what do you mean by repro (reproduction)? I submitted the code earlier. Please close if off topic.
Hey @embryologist - by repro we mean a small application that quickly shows the issue. Thanks for sharing the code above. Having it in a small app would help us further investigate.
As to closing the issue -- your question is not off-topic! We simply prefer to have an issue per problem. That way we can track it more easily and it allows us to search for it in the future.
Since the original problem (of the package not restoring) is resolved, I believe @divega was suggesting to close this issue and create a new issue in the https://github.com/aspnet/identity repo (which maintains the code you are having issues with).
Yeah the IdentityOptions.Cookies were moved in 2.0
options.Cookies.ApplicationCookie becomes services.ConfigureApplicationCookie in 2.0
Most helpful comment
Hey @embryologist - by repro we mean a small application that quickly shows the issue. Thanks for sharing the code above. Having it in a small app would help us further investigate.
As to closing the issue -- your question is not off-topic! We simply prefer to have an issue per problem. That way we can track it more easily and it allows us to search for it in the future.
Since the original problem (of the package not restoring) is resolved, I believe @divega was suggesting to close this issue and create a new issue in the https://github.com/aspnet/identity repo (which maintains the code you are having issues with).