0

I've been having a lot of trouble lately with Visual Studio 2017 and differing framework versions between .NET Framework projects, .NET Standard projects, and libraries that build for one or both of those.

One of the issues was that the .NET Standard libraries targeted "net45;net46" while a project targeted 4.6.1 or 4.6.2. There were build problems with this, so I changed the project to target "4.6" instead, which worked.

My question is, does this actually mean 4.6.0, or 4.6.x (latest or oldest?) or "4.6" verbatim somehow?

Josh
  • 6,944
  • 8
  • 41
  • 64
  • 1
    If they target `net45;net46` they aren't Standard libraries. They are full framework libraries that use the new csproj format. A Standard library would target `netstandard2.00` – Panagiotis Kanavos Mar 19 '18 at 10:48
  • 1
    Verbatim. .NET 4.6.2 would be net462. – Stephen Kennedy Mar 19 '18 at 10:51
  • 1
    Compile your class libraries with netstandard2.0 and your projects with .Net Framework 4.6.1 or 4.7.1. In my experience this works fine. – JRB Mar 19 '18 at 10:51
  • What were the build problems, apart from the fact that the library *wasn't* a Standard library? – Panagiotis Kanavos Mar 19 '18 at 10:51
  • 4.6.1 and 4.6.2 are maintenance releases that fix bugs that are too impactful to be released as a 4.6 update. They don't make any major api changes so should not affect building at all. But we can't guess what "build problems" could possibly mean. – Hans Passant Mar 19 '18 at 11:28
  • We aren't buying what you are selling. `net45` and `net46` ain't `netstandard1.3` or `netstandard2.0`. We have no idea if said "build problems" are because of a target of yours, a target of your dependencies, missing dependencies, incompatible dependencies, and so on. The onus is on you to [ask a question](https://stackoverflow.com/help/on-topic) with [enough info in it](https://stackoverflow.com/help/mcve) so that can be answered. Please read [the perfect question](https://codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question/) and make some much-needed edits. Happy to help once fixed. – NightOwl888 Mar 19 '18 at 13:25
  • When I have a library project targeting netstandard2.0 referenced by one targeting net46, I get the error: 'Foo.csproj' targets 'netstandard2.0'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.6'. Changing the referencing project to target net461 or net462 seems to have fixed that case. – Josh Mar 20 '18 at 13:39

0 Answers0