question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Poor error with dotnet run and multi-frameworks

See original GitHub issue

Steps 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:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
eerhardtcommented, Mar 21, 2017

@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 to Microsoft.NETCore.Runtime.CoreCLR and Microsoft.NETCore.DotNetHostPolicy, since those will implicitly come through by targeting netcoreapp1.1.

1reaction
eerhardtcommented, Mar 21, 2017

@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 on netcoreapp2.0, the next version after 1.1.

Read more comments on GitHub >

github_iconTop Results From Across the Web

dotnet core::Unable to run your project. Ensure you have a ...
When I try to run the project in the console (dotnet run), I get this error. Unable to run your project. Ensure you...
Read more >
NET SDK error list - .NET CLI
This is a complete list of the errors that you might get from the .NET SDK while developing .NET apps. If more info...
Read more >
Target Multiple Frameworks in .NET Core 2.x App
To run the application for specific framework, click on the run dropdown and select a targeted framework as shown below. Multi Frameworks Dependencies....
Read more >
Unable to locate the .NET SDK: The Reasons - Hamid Mosalla
First things first, removing some low hanging fruits. First wee need to see if the Sdk is actually installed. Navigate to C:\Program Files\ ......
Read more >
Where are .NET Errors Logged?
This simple guide explains where .NET logs are located, how to configure logging, and why error monitoring tools like Rollbar make debugging ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found