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.

How do I force myProject Choose .NetStandard assembly instead of TargetFramework

See original GitHub issue

Today , There are Asp.Net (System.Web.HttpContext) and Asp.Net Core (Microsoft.AspNetCore.Http.HttpContext) in .net Framework , and there are a few packages use .net Framwork with System.Web.HttpContext and .net Core (.net standard) with Microsoft.AspNetCore.Http.HttpContext for sharing source , so when I use Asp.Net Core on .Net Framework , I just can not use that package because that package fouce me to use System.Web.HttpContext , but there is an available assembly in that package, How do I choose that ?

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:29
  • Comments:27 (5 by maintainers)

github_iconTop GitHub Comments

12reactions
John0Kingcommented, Nov 6, 2018

suggest to add 2 attributes on <PackageReference />

  • TargFramework choose which dll file to reference
  • Source restore from specified souce of Nuget.Config
12reactions
carlosrpgcommented, Oct 8, 2018

I Have the same problem here, I Have a net472 app that requires to be full framework, and I consume a nuget (netStandard2.0), this nuget have a reference for another nuget that provides both net45 and netstandard2.0. Now I’m stuck at using the net45 version cause I can’t control how the targetframework will be choosed. This would not be a problem using packages.config because I could just add a reference to this dependency and choose the targetframework for netstandard2.0 but now using PackageReference this is not possible.

This is definitely PackageReference bug or removed feature (that should have being disclaimed).

Read more comments on GitHub >

github_iconTop Results From Across the Web

NuGet: Force project to chose more specific target ...
NET Standard 1.3 build of my project, instead of the 1.6 build, which fails to restore due to the placeholder items in the...
Read more >
Forcing a Specific Target Platform With PackageReference
The short version is to right-click on packages.config and select Migrate Packages.config to PackageReference... . If you just started a new ...
Read more >
Targeted .NET Frameworks - Visual Studio (Windows)
In Solution Explorer, open the right-click context menu for the project that you want to change, and then choose Properties. · In the...
Read more >
Converting a big project to NET Standard without big bang
The very first step is converting all project files to new project format, leave all project to target full framework, then you can...
Read more >
Multi-targetting .Net Framework and .Net Core in a single project
1. Change TargetFramework to TargetFrameworks. Open your csproj file, either by right-clicking on it in Visual Studio, or in another Editor. The ...
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