New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dotnet restore fails: Microsoft.Composition 1.0.27 is not compatible with netcoreapp1.0 #17745
Comments
Hey @xatabhk, Microsoft.Composition is our old nuget package which was published before we came up with the "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 |
@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:
So how to fix this when "net452" used. |
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 This can be resolved by directly adding imports to the tools node which requires it like so:
(This is just an example, the imports would need to be added to whichever tool is bringing in There is an example of fsc using imports here: |
@brthor Yes. This workaround works. But I have another question: what is the different between the following two? "dependencies": { 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? |
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,
which brings in Is this a bad dependency in |
To answer your question @xatabhk packages in the 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 I'm not sure whether |
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. |
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" { "dependencies": { "tools": { }, "frameworks": { "buildOptions": { "runtimeOptions": { "publishOptions": { "scripts": { |
@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: |
@AlexGhiondea Not sure how to workaround 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 -> So you are saying that I cannot create ASP.NET MVC 6 netcoreapp1.1 right? |
Both packages "support" .NET Core 1.1, but the old package (Microsoft.Composition) requires that you use "imports" statements in your project file to install it, because of the way the package is authored. Ideally, downstream consumers will switch over to System.Composition because that is what we have named the package now. But it probably hasn't been at the top of the priority list because there aren't really any functional changes in the new package. |
@mellinoe I understand. I managed to import it using
however it would be nice to not use these kind of workarounds for that. |
@radenkozec To make the default template web site netcoreapp1.1 “pure” try this Type Then replace the project.json with the one in the attached project.zip dotnet restore PS Microsoft.VisualStudio.Web.CodeGeneration.Tools 1.1.0-preview4-final etc still appears dependent on Microsoft.Composition. Sigh. |
I am going to close this now. Please re-open if this is still an issue. |
And nowadays how could this workadound be applied to |
I believe the property that can be used in the csproj that case is |
I was having the same problem when creating a fresh Asp.Net Core project and referencing it from an xUnit project. My solution was to add the following node to the xUnit's .csproj file:
|
I have a All attempts using the above workarounds have failed, but maybe I'm not putting the |
All of the above are discussions on how to reference the old, obsolete package |
@mellinoe it's being pulled in by It appears I need to add that package as a |
i have almost same issue , trying to add reference of core1.1 app to xunit project , using VS 2017 RC .
is there any solution ...? |
This info helped me get codegen working with netcoreapp1.1 on my machine |
this is infuriating. |
When trying to add a WCF connected service in VS 2017, I get this in the output window.
and this in the WCF Service window
I tried adding MS.Composition 1.0.30 package to the aspnetcore proejct but still get the same error just with a different version. This all worked in VS 2015. |
Has anyone got this working with csproj and netcoreapp1.1? |
We realize this is frustrating and we are working on figuring out a way to fix this. |
You can edit csproj files and add this line:
The result should look like this:
This is how VS converter does it when it upgrades project.json to csproj. If you need other targets, you can play around converting your project.json files to csproj files and see the output. Hope this helps! |
@aunoum - This was never a project.json so I cant try to convert, but I only need this for the scaffolding and it seems easy enough. |
Thanks, I took all my hacks out and added the PackageTargetFallback and it didn't fail the New Scaffolding Item wizard, but it doesnt look like it puts things in the right places (controller was at the root of the project). Maybe its supposed to do that normally? (I really don't know because the few times I could use Asp.net mvc over the last 5+ years have all pretty much been abandoned at about this point) |
@aunoum - your suggestion solved it for me! |
Thanks @rubit0 for the solution! |
I have this issue too - I've got a .netcoreapp1.1 web project. When I add a new xunit test project, and then add a reference to my web project, I get:
if I remove the reference to the web project, all works. I've tried:
Both projects target netcoreapp1.1. and are csproj based. Any ideas? |
@mattwoberts could you try updating / adding a reference to Microsoft.Composition version 1.0.0.31? |
@AlexGhiondea Nice one, that seems to have solved it for me :) |
When compiling the Test project on Azure DevOps, an old issue .NET Core arises with the dependency called Microsoft.Composition 1.0.27. I followed this thread (dotnet/runtime#17745) and applied this fix(dotnet/runtime#17745 (comment))
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.
The text was updated successfully, but these errors were encountered: