runtime icon indicating copy to clipboard operation
runtime copied to clipboard

Package 'Microsoft.Composition 1.0.27 on .NET Core 2

Open ConClavi opened this issue 9 years ago • 13 comments

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!

  1. Deleting Nuget.Config
  2. I added $(PackageTargetFallback);dotnet
  3. restore packages via dotnet restore
  4. Clear Nuget Cache (from Tools>NuGet>Package Manager Settings)

How can I resolve this conflict?

Click here please for the project file and a snapshot from my screen

ConClavi avatar Aug 06 '17 07:08 ConClavi

Looks similar to dotnet/runtime#21132.

@AlexGhiondea what is the story of Microsoft.Composition? Does it live in CoreFX repo or somewhere else?

karelz avatar Aug 06 '17 12:08 karelz

the conflict goes under, <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.0-preview2-final" PrivateAssets="All" />

ConClavi avatar Aug 06 '17 20:08 ConClavi

I did a another installation on another computer and I m getting the same warnings and errors

ConClavi avatar Aug 07 '17 00:08 ConClavi

@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

ConClavi avatar Aug 07 '17 01:08 ConClavi

Are you able to install Microsoft.Composition?

AlexGhiondea avatar Aug 07 '17 03:08 AlexGhiondea

@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";

ConClavi avatar Aug 07 '17 04:08 ConClavi

@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 avatar Aug 07 '17 18:08 AlexGhiondea

@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......

ConClavi avatar Aug 08 '17 02:08 ConClavi

Sounds like the package restore works now.

@divega would if that API has moved?

AlexGhiondea avatar Aug 08 '17 17:08 AlexGhiondea

@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.

divega avatar Aug 12 '17 16:08 divega

Excuse my ignorance, what do you mean by repro (reproduction)? I submitted the code earlier. Please close if off topic.

ConClavi avatar Aug 14 '17 01:08 ConClavi

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).

AlexGhiondea avatar Aug 14 '17 04:08 AlexGhiondea

Yeah the IdentityOptions.Cookies were moved in 2.0

options.Cookies.ApplicationCookie becomes services.ConfigureApplicationCookie in 2.0

HaoK avatar Aug 14 '17 07:08 HaoK