Skip to content
This repository has been archived by the owner on Nov 21, 2018. It is now read-only.

Microsoft.AspNetCore.All can be installed into net461 project without error #142

Closed
analogrelay opened this issue Jun 5, 2017 · 5 comments
Assignees
Milestone

Comments

@analogrelay
Copy link
Contributor

Repro Steps:

  1. Create new .NET Console Core app
  2. Change target framework to net461
  3. Add reference to Microsoft.AspNetCore.All
  4. Restore

Expected behavior: Error of some kind

Actual behavior: It references the package "successfully" but silently fails to bring in any types.

We have a build\PublishWithAspNetCoreTargetManifest.targets file, which means NuGet thinks the package is supported by all frameworks (with a special targets file for netcoreapp2.0). We should put that file in build\netcoreapp2.0 so NuGet will see that there are no assets for any other framework.

Also, we need to verify that NuGet does actually disallow installing it in that circumstance. It's possible it won't disallow it, just won't reference the targets files. In that case, we could put a fallback targets file with an error message.

@analogrelay
Copy link
Contributor Author

/cc @muratg - We can probably wait until preview 3 for this, but we really need to make sure this package can't be installed into non-netcoreapp2.0 projects.

@muratg muratg added this to the 2.0.0-preview3 milestone Jun 5, 2017
@JunTaoLuo
Copy link
Contributor

Seems like simply moving the targets file to netcoreapp2.0 does not prevent the package from being referenced from an app targeting net461. We will likely need to add a default target that gives an error of some kind.

@muratg
Copy link

muratg commented Jun 27, 2017

@natemcmaster If we can't get to this in 2.0.0, it's OK to punt.

@natemcmaster
Copy link
Contributor

Actually, the build target layout is not the problem. The real issue is that there was no lib asset. Therefore NuGet will install it into anything.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants