dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.24k stars 4.73k forks source link

Missing version in framework reference leads to misleading error #3743

Open vitek-karas opened 5 years ago

vitek-karas commented 5 years ago

New console app with framework reference to Microsoft.NETCore.App, remove the version property from .runtimeconfig.json, run the app:

Fails with:

It was not possible to find any compatible framework version
The specified framework 'Microsoft.NETCore.App' was not found.
  - The following frameworks were found:
    <list of frameworks on the machine>

Running this on a Debug build causes an assert in fx_resolver.

We should explicitly check for this and fail with a meaningful error message. It's not valid to have a framework reference without version.

vitek-karas commented 5 years ago

Once implemented, this should work for both framework references and "included frameworks" (in self-contained apps). All cases should have tests as well.