dknoodle / WUnderground.Net

WUnderground .Net Library (Also Weather.com)
MIT License
19 stars 13 forks source link

Add direct support for .NET Framework 4.5 #18

Open swirlywonder opened 6 years ago

swirlywonder commented 6 years ago

First of all thank you for a great library. It has saved me a great deal of time. There was, however, one area that prevented me from using your package directly from NuGet.

Only providing a target for .NET Standard, adds a significant number of project dependencies to .NET Framework projects. If you convert your project to be a multi-target framework project, this is easily remedied.

There would be very little change necessary to your code base to accomplish this.

For example, use this: <TargetFrameworks>net45;netstandard1.1</TargetFrameworks>

Instead of this: <TargetFramework>netstandard1.1</TargetFramework>

I'd also recommend removing explicit references like <DocumentationFile>bin\Release\netstandard1.1\CreativeGurus.Weather.Wunderground.xml</DocumentationFile> in favor of <GenerateDocumentationFile>true</GenerateDocumentationFile> that can do this automatically.

I also had to add the following block to the project.

  <ItemGroup Condition="'$(TargetFramework)' == 'net45'">
    <Reference Include="System.Net.Http" />
  </ItemGroup>

Once you do this, all targets build successfully at the same time and will be included automatically when building your NuGet package. (please see https://www.nuget.org/packages/Newtonsoft.Json/ as an example of including both .NET Framework and .NET Standard distributions)

Note: You will need to make adjustments to your "Sample" project as well.

Regards,

Ryan Christiansen