0

I am using the new netstandard1.5 target framework in my class library. Are you still able to use pre-processor directives to add additional functionality for the full .NET framework?

For example, I want to use System.ServiceModel.Syndication with netstandard1.5 and at the time of writing, this is only available on .NET 4.5. How can I achieve this?

Athari
  • 33,702
  • 16
  • 105
  • 146
Muhammad Rehan Saeed
  • 35,627
  • 39
  • 202
  • 311

1 Answers1

2

You can target multiple target frameworks at the same time within the same project.json. One could be netstandard1.5 while others could be net45.

  "frameworks": {
    "netstandard1.5": { },
    "net45": {
      "frameworkAssemblies": {
        ...
      }
    }
  }

In that case you could "pre-processor" directives for NET_45 and NETSTANDARD1_5. The result would be a nuget package with two implementations (one for net45 and one for netstandard1.5 of the same contract (if packed).

You cannot target solely netstandard1.5 and then use conditional programming to opt-in a net45 framework assembly.

Thomas
  • 5,080
  • 27
  • 42