Dotnet restore fails: Microsoft.Composition 1.0.27 is not compatible with netcoreapp1.0
Errors in C:\downloads\web\projects\ZaxiTechCore\src\ZaxiTechCore\project.json Package Microsoft.Composition 1.0.27 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). 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.0.
Hey @xatabhk,
Microsoft.Composition is our old nuget package which was published before we came up with the netstandard and netcoreapp concepts. So the nuget package doesn't explicitly support those frameworks. However, the assemblies in the package are all PCL assemblies, so you can reference them without trouble. To get NuGet to allow you to install the package into your project, add an "imports" statement, like this:
"frameworks": {
"netcoreapp1.0": {
"imports": [ "portable-net45+win8+wp8+wpa81" ]
}
},
Recently, we also published an updated version of the nuget package which has explicit support for netstandard (and therefore netcoreapp1.0). Right now it is only on our nightly dev feed as a beta version. That package is called "System.Composition" and has version v1.0.31-beta-24230-04. You can use it if you add this feed to your sources. I would recommend just adding the "imports" statement for now.
@mellinoe It is targeting "net452" instead of "netcoreapp1.0"; so there should no issue with the PCL assembly I think. Also only when "Microsoft.VisualStudio.Web.CodeGeneration.Tools" is referenced, I get this problem.
Here is my settings:
"frameworks": {
"net452": {}
},
"tools": {
"BundlerMinifier.Core": "2.1.258",
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview3-21486",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview3-21486",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview3-21486",
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": "1.0.0-preview3-21486"
},
"dependencies": {
"Microsoft.EntityFrameworkCore.Design": {
"version": "1.0.0-*",
"type": "build"
},
"Microsoft.EntityFrameworkCore.SqlServer.Design": {
"version": "1.1.0-*",
"type": "build"
},
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-*",
"type": "build"
},
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.0.0-*",
"type": "build"
},
"Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
"version": "1.0.0-*",
"type": "build"
},
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0-*",
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.1.0-*",
"Microsoft.AspNetCore.Diagnostics": "1.1.0-*",
"Microsoft.AspNetCore.Mvc": "1.1.0-*",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0-*",
...
}
So how to fix this when "net452" used.
@piotrpMSFT , @brthor This one seems like it may be a CLI bug to me. I'm not too familiar with how tool dependencies are handled, but @ericstj posited that we might be merging tool and project dependencies badly here, resulting in this error. Possible?
Each tool under the tools node has it's own dependency graph. It is independent from the project and from other tools. This is why putting the imports under the frameworks node did not work here, as that only affects the project's dependency graph.
Tools are also always restored for netcoreapp1.0 because they are expected to be portable. It looks like the library Microsoft.Composition 1.0.27 doesn't support netcoreapp1.0.
This can be resolved by directly adding imports to the tools node which requires it like so:
"BundlerMinifier.Core": { "version": "2.1.258", "imports": [ "portable-net45+win8+wp8+wpa81" ] }
(This is just an example, the imports would need to be added to whichever tool is bringing in Microsoft.Composition)
There is an example of fsc using imports here: https://github.com/dotnet/cli/blob/rel/1.0.0/TestAssets/TestProjects/FSharpTestProjects/TestLibrary/project.json#L8
@brthor Yes. This workaround works. But I have another question: what is the different between the following two? "tools" { "Microsoft.VisualStudio.Web.CodeGeneration.Tools": { "version": "1.0.0-*", "imports": [ "portable-net45+win8+wp8+wpa81" ] }
"dependencies": { "Microsoft.VisualStudio.Web.CodeGenerators.Mvc": { "version": "1.0.0-*", "type": "build" }, }
Also updating package in IDE will get "tools"::"Microsoft.VisualStudio.Web.CodeGeneration.Tools" removed. Is "tools"::"Microsoft.VisualStudio.Web.CodeGeneration.Tools" not required for anything?
whichever tool is bringing in Microsoft.Composition
That's the bug @brthor, the tool doesn't bring it in. It's somehow leaking into the tool graph from the project's graph...
I'm confused here. Why does it seem that the tool dependency is leaking into the project graph?
Taking a look at the dependency graph for the tool, "Microsoft.VisualStudio.Web.CodeGeneration.Tools" it brings in
"Microsoft.CodeAnalysis.Workspaces.Common/1.3.0"
which brings in "Microsoft.Composition": "1.0.27"
Is this a bad dependency in "Microsoft.CodeAnalysis.Workspaces.Common/1.3.0" ?
To answer your question @xatabhk packages in the tools node are not linked up as dependencies of your project (so you couldn't do things like reference a dll inside a tool from your project).
Instead each tool is restored independently, and can provide commands available through the dotnet cli in the directory of that project.
For example, a tool package can have a file named dotnet-dostuff.dll which makes available the command dotnet dostuff in the directory of that project.
I'm not sure whether Microsoft.VisualStudio.Web.CodeGeneration.Tools is needed in your case because I am not familiar with that tool.
The RC2 to 1.0 migration docs indicate that we can drop the imports statements in the tools. Everyone works except Microsoft.VisualStudio.Web.CodeGeneration.Tools.
Is that normal or is it supposed to work without the imports? The error is the same on indicated in this thread. The weird part is that in about 5 tools this is the only one with problems
I'm also interested in the answer to the question raised by @PEsteves8.
@mellinoe
When "System.Composition v1.0.31" released in official nuget ? I need it for my .NET Core project.
@weshaggard , @ericstj Is it feasible to mark this single package as stable so that folks can use it?
Are you saying all Tools, ALWAYS, REQUIRE the use of Microsoft.Composition as a dependency for import?
@mellinoe I don't know of any reason we cannot. We should probably do it as part of our 1.1 release however instead of doing it one-off, as we should not mark it stable in master.
I had problem with scaffolding in Visual Studio it looks like you need to include "Microsoft.VisualStudio.Web.CodeGeneration.Tools": "1.0.0-preview2-final" under dependencies and tools, it works ok now :)
{ "userSecretsId": "aspnet-*_SHIT_",
"dependencies": { "Microsoft.AspNetCore.Authentication.Cookies": "1.0.0", "Microsoft.AspNetCore.Diagnostics": "1.0.0", "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0", "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0", "Microsoft.AspNetCore.Razor.Tools": { "version": "1.0.0-preview2-final", "type": "build" }, "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", "Microsoft.AspNetCore.StaticFiles": "1.0.0", "Microsoft.EntityFrameworkCore.SqlServer": "1.0.1", "Microsoft.EntityFrameworkCore.SqlServer.Design": "1.0.1", "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0", "Microsoft.Extensions.Configuration.Json": "1.0.0", "Microsoft.Extensions.Configuration.UserSecrets": "1.0.0", "Microsoft.Extensions.Logging": "1.0.0", "Microsoft.Extensions.Logging.Console": "1.0.0", "Microsoft.Extensions.Logging.Debug": "1.0.0", "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0", "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0", "BundlerMinifier.Core": "2.2.281", "Microsoft.AspNetCore.Mvc": "1.0.1", "Microsoft.AspNetCore.Server.Kestrel": "1.0.1", "Microsoft.NETCore.App": { "version": "1.0.1", "type": "platform" }, "Microsoft.ApplicationInsights.AspNetCore": "1.0.2", "Microsoft.EntityFrameworkCore": "1.0.1", "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final", "Microsoft.VisualStudio.Web.CodeGenerators.Mvc": "1.0.0-preview2-update1", "Microsoft.EntityFrameworkCore.Tools.Core": "1.0.0-rc2-final", "Microsoft.EntityFrameworkCore.Tools.Cli": "1.0.0-preview1-final", "Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore": "1.0.0-preview2-update1", "Microsoft.VisualStudio.Web.CodeGeneration.Utils": "1.0.0-preview2-update1", "Microsoft.VisualStudio.Web.CodeGeneration.Core": "1.0.0-preview2-update1", "Microsoft.VisualStudio.Web.CodeGeneration": "1.0.0-preview2-update1", "Microsoft.VisualStudio.Web.CodeGeneration.Templating": "1.0.0-preview2-update1", "Microsoft.VisualStudio.Web.CodeGeneration.Tools": "1.0.0-preview2-final" },
"tools": { "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final", "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final", "Microsoft.Extensions.SecretManager.Tools": "1.0.0-preview2-final", "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final", "Microsoft.VisualStudio.Web.CodeGeneration.Tools": { "version": "1.0.0-preview2-final", "imports": [ "portable-net45+win8+wp8+wpa81" ] }
},
"frameworks": { "netcoreapp1.0": { "imports": [ "dotnet5.6", "portable-net45+win8" ] } },
"buildOptions": { "emitEntryPoint": true, "preserveCompilationContext": true },
"runtimeOptions": { "configProperties": { "System.GC.Server": true } },
"publishOptions": { "include": [ "wwwroot", "Views", "Areas/**/Views", "appsettings.json", "web.config" ] },
"scripts": { "prepublish": [ "bower install", "dotnet bundle" ], "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ] } }
@macakmujo if I understand right, you have figure out a workaround for this? Can you confirm?
The other issue on the thread was around marking the package as stable. I will follow-up on it and will file a separate issue to address it if necessary.
The package 'System.Composition' is now marked as stable: https://github.com/ericstj/corefx/blob/master/pkg/Microsoft.Private.PackageBaseline/packageIndex.json#L2880
@AlexGhiondea Not sure how to workaround this.
I am now receiving this error:
The dependency Microsoft.Composition 1.0.27 does not support framework .NETCoreApp,Version=v1.1.
Tried all above none did not worked.
Microsoft.VisualStudio.Web.CodeGeneration.Tools and Microsoft.VisualStudio.Web.CodeGenerators.Mvc
are using this
@radenkozec I don't believe Microsoft.Composition supports netcoreapp1.1.
@weshaggard @twsouthwick any plans to make that package support 1.1?
@AlexGhiondea @weshaggard @twsouthwick If that is true -> Microsoft.Composition does not support netcoreapp1.1 this means -> Microsoft.VisualStudio.Web.CodeGeneration.Tools, Microsoft.VisualStudio.Web.CodeGenerators.Mvc does not support netcoreapp1.1 which means that ASP.NET MVC 6 and ASP.NET 5 project does not support netcoreapp1.1
So you are saying that I cannot create ASP.NET MVC 6 netcoreapp1.1 right?