8

(Question subtitle: Are resources not supported in .netstandard 1.3 or is my project file just messed up?)

I just created an example portable class library in Visual Studio 2015 Update 3 and added a sample resource file. Initially, the file project.json looks like this:

{
  "supports": {
    "net46.app": {},
    "uwp.10.0.app": {},
    "dnxcore50.app": {}
  },
  "dependencies": {
    "Microsoft.NETCore": "5.0.0",
    "Microsoft.NETCore.Portable.Compatibility": "1.0.0"
  },
  "frameworks": {
    "dotnet": {
      "imports": "portable-net452+win81"
    }
  }
}

Fine: No compile errors!

After that, I used the project properties to target .NETStandard 1.3.

portable class library target

Now project.json looks like this:

{
  "supports": {},
  "dependencies": {
    "Microsoft.NETCore.Portable.Compatibility": "1.0.1",
    "NETStandard.Library": "1.6.0"
  },
  "frameworks": {
    "netstandard1.3": {}
  }
}

Now I get the following build error - which means basically the the build action EmbeddedRessource is not supported:

german error

I'm really no expert with project.json, but for me the things look inconsistent - and I have no idea, where the problem is.

  • in the first project.json: if I support net46, why is it importing net452?
  • in the second project.json: if I use netstandard1.3, why is there a dependency to the library in version 1.6?
  • and finally, what is .NETPortable, Version=v5.0? The renaming of .NET Core has taken place early this year - why are we still referencing version 5.0? Even MSDN doesn't know <TargetFrameworkVersion>5.0</TargetFrameworkVersion> which is specified in the csproj

For me, this seems like netstandard isn't only about the available libraries, tooling seems involved, too. But that does not explain, why it worked for dnxcore50.

ventiseis
  • 3,029
  • 11
  • 32
  • 49
  • I suspect that this has something to do with the fact that universal windows applications don't use `resx` files. But: universal windows apps are compatible with `netstandard 1.4` and higher... – ventiseis Jun 30 '16 at 20:24
  • you're right about resx part, but UWPs are actually compatible with `netstandard1.4` and lower not higher. – nawfal Jul 21 '16 at 14:58
  • 1
    You are right, I looked at [the matrix](https://github.com/dotnet/corefx/blob/master/Documentation/architecture/net-platform-standard.md) and misunderstood the arrows. But it is even written there: _If a library targets .NET Platform Standard version 1.3, it can only run on .NET Framework 4.6 or later, .NET Core, Universal Windows Platform 10 (UWP), and Mono/Xamarin platforms._ – ventiseis Jul 21 '16 at 22:41
  • 1
    @ventiseis You mean [The Most Unreadable and Awful Chart Ever Created In The History Of Mankind](https://github.com/dotnet/standard/blob/master/docs/versions.md)? – Dagrooms Apr 17 '17 at 14:13

1 Answers1

9

You need Diagnostics.Tools and Resources.ResourceManager.

I got this working (for .NET Standard 1.4 though) by installing the pre versions, at this time:

  • "System.Diagnostics.Tools": "4.3.0-preview1-24530-04"
  • "System.Resources.ResourceManager": "4.3.0-preview1-24530-04"
Crono
  • 10,211
  • 6
  • 43
  • 75
Thomas Hagström
  • 4,371
  • 1
  • 21
  • 27
  • If I tries this again in an clean, new, up-to-date VS 2015 project, it actually works, after I installed the package `System.Reflection.Emit.ILGeneration` in the UWP app. But I'll mark your answer because you gave me the hint to install missing packages. – ventiseis Oct 30 '16 at 20:54
  • 1
    It seems Microsoft has created a new jungle of compatible and not-so-compatible packages, version numbers and dependencies which is not very easy to understand and manage if you're not a wizard of the new `.NET`-world. I hope this will be cleaned up and stabilized in the future. – ventiseis Oct 30 '16 at 20:57
  • 2
    I'm sure it will and glad u figured it out – Thomas Hagström Oct 30 '16 at 20:59