Poor error with dotnet run and multi-frameworks
See original GitHub issueSteps to reproduce
Create exe targeting multiple frameworks e.g.
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>netcoreapp1.1;net451</TargetFrameworks>
</PropertyGroup>
then use dotnet run
to run it
Expected behavior
Error message along lines of
You are trying to run an executable project that targets multiple frameworks. Please select a single framework to run with the
-f
flag.
Actual behavior
Poor error message
Unable to run your project Please ensure you have a runnable project type and ensure ‘dotnet run’ supports this project. The current OutputType is ‘Exe’
Environment data
dotnet --info
output:
.NET Command Line Tools (2.0.0-preview1-005418)
Product Information: Version: 2.0.0-preview1-005418 Commit SHA-1 hash: 82c928e1ec
Runtime Environment: OS Name: Windows OS Version: 10.0.15061 OS Platform: Windows RID: win10-x64 Base Path: C:\Users\thund\AppData\Local\Microsoft\dotnet\sdk\2.0.0-preview1-005418\
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
@InsidiousForce - your issue is separate. Your TargetFramework is
netstandard1.6.1
, which is not a runnable framework.netstandard
is for building libraries that can run on any of the .NET platforms: .NET Framework on Windows, Mono, .NET Core, UWP, Xamarin, etc.If you want to run your project on .NET Core, please change your TargetFramework to
netcoreapp1.1
. After doing so, you can remove the PackageReferences toMicrosoft.NETCore.Runtime.CoreCLR
andMicrosoft.NETCore.DotNetHostPolicy
, since those will implicitly come through by targetingnetcoreapp1.1
.@InsidiousForce - See https://github.com/dotnet/standard/blob/master/docs/faq.md, which is the de facto source in my opinion.
netcoreapp
is not going away anytime soon, as far as I know. It is the target framework for .NET Core applications. We are currently working onnetcoreapp2.0
, the next version after1.1
.