3

I am using visual studio mac with latest .Net Core SDK on mac. In visual studio 2017 RC on windows everything is ok, but when i try to restore nuget packages on mac with visual studio mac it throws me error.

Package Microsoft.Composition 1.0.27 is not compatible with netcoreapp1.1 (.NETCoreApp,Version=v1.1). Package Microsoft.Composition 1.0.27 supports: portable-net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile259) One or more packages are incompatible with .NETCoreApp,Version=v1.1.

here is my *.csproj file

<Project Sdk="Microsoft.NET.Sdk.Web">

    <PropertyGroup>
        <Description>Some</Description>
        <Copyright>Some</Copyright>
        <AssemblyTitle>Some</AssemblyTitle>
        <TargetFramework>netcoreapp1.1</TargetFramework>
        <PreserveCompilationContext>true</PreserveCompilationContext>
        <AssemblyName>SharpCommerce</AssemblyName>
        <OutputType>Exe</OutputType>
        <PackageId>Some</PackageId>
        <UserSecretsId>aspnet-SharpCommerce-ecd1a4f7-1de0-468a-8065-ab902c7aae9b</UserSecretsId>
        <RuntimeFrameworkVersion>1.1.0</RuntimeFrameworkVersion>
        <PackageTargetFallback>$(PackageTargetFallback);dotnet5.6;portable-net45+win8;portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
        <GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
        <GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
        <GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
        <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
        <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
        <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
        <PreBuildEvent></PreBuildEvent>
    </PropertyGroup>

    <ItemGroup>
        <Content Update="wwwroot\**\*;**\*.cshtml;appsettings.json;web.config">
        <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
        </Content>
    </ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Routing" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.0">
  <PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.0.0-msbuild3-final">
  <PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink.Loader" Version="14.1.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration" Version="1.1.0-preview4-final" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="1.1.0-msbuild3-final">
  <PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor" Version="1.1.1" />
    <PackageReference Include="System.IO.FileSystem" Version="4.3.0" />
    <PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="1.1.0" />
    <PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="1.1.0" />
    <PackageReference Include="System.Reflection" Version="4.3.0" />
    <PackageReference Include="System.Runtime.Loader" Version="4.3.0" />
    <PackageReference Include="Microsoft.CodeAnalysis.Common" Version="1.3.2" />
</ItemGroup>

<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
    <Exec Command="bower install" />
    <Exec Command="dotnet bundle" />
</Target>


<ItemGroup>
    <ProjectReference Include="..\..\Some.Core.Contracts\Some.Core.Contracts.csproj" />
    <ProjectReference Include="..\..\Some.Core\Some.Core.csproj" />
</ItemGroup>

</Project>
  • Try to https://developercommunity.visualstudio.com/content/problem/10914/scaffolding-net-core-with-entity-framework.html. – Ha Hoang Mar 02 '17 at 07:26

3 Answers3

4

If this package is a true PCL (not using bait&switch), you should be able to reference it using target fallback. Try to add

    <PropertyGroup>
        <PackageTargetFallback>dnxcore50;portable-net45+win8+wp8+wpa81</PackageTargetFallback>
    </PropertyGroup>

to your project. There is no guarantee that it won't crash at runtime through.

kekekeks
  • 3,193
  • 19
  • 16
0

Package Microsoft.Composition 1.0.27 supporting only .NET Framework 4.5, Windows 8, Windows Phone 8.1, Windows Phone Silverlight 8, Portable Class Libraries (PCL Profile 259) so its not compatible with .Net Core on Mac

Nuget information about package https://www.nuget.org/packages/Microsoft.Composition/1.0.27

J. Doe
  • 2,651
  • 1
  • 13
  • 31
  • Yes you are right, they wrote that it is not updated yet all packages. But one of the decisions was to upgrade "Microsoft.VisualStudio.Web.CodeGeneration" packet and add "imports" atribute to framework version. But how to do it in csproj files,i don't know. – user3803356 Feb 28 '17 at 17:06
0

Answer from support:

Thanks for reporting this. Visual Studio for Mac in preview 4 is ignoring the PackageTargetFallback information. So the project.assets.json file does not have any imports which prevents NuGet from installing NuGet packages when they should be allowed. This bug should be fixed in the next release.