postmark-dotnet
postmark-dotnet copied to clipboard
Native .NET Framework build
With System.Net.Http being messed up in netstandard2.0 vs. .NET Framework would you consider providing a native .NET Framework built nuget?
e.g.
https://github.com/heikomilke/postmark-dotnet/tree/master/src/PostmarkNETFramework
The issue explained. Right now if you add a package reference from a .NET Framework assembly (I tried 4.7.1 and 4.8) to Postmark 4.3 you end up with some messy assembly references.
I started with clean class library and this is the result (excerpt):
<Reference Include="System.IO, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>..\packages\System.IO.4.3.0\lib\net462\System.IO.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Net.Http, Version=4.1.1.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>..\packages\System.Net.Http.4.3.3\lib\net46\System.Net.Http.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Runtime, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>..\packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net463\System.Security.Cryptography.Algorithms.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
<Private>True</Private>
</Reference>
<packages>
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net471" />
<package id="Postmark" version="4.3.0" targetFramework="net471" />
<package id="System.IO" version="4.3.0" targetFramework="net471" />
<package id="System.Net.Http" version="4.3.3" targetFramework="net471" />
<package id="System.Runtime" version="4.3.0" targetFramework="net471" />
<package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net471" />
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net471" />
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net471" />
<package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net471" />
</packages>
... when all it should do is a plain reference to System.Net.Http.
Building the nuget for .NET Framework directly solves that issue.
Postmark-dotnet
is currently built only for .NET Standard (2.0). As mentioned above, .NET Core has great support for .NET Standard, but it's a little bit messy for .NET Framework, generally adding a non-trivial amount of assembly dependencies and assembly redirects.
Additionally, there are buggy compatibility issues with older (but netstandard2.0
-compliant) versions of .NET Framework (4.6.1-4.7.1
) which Microsoft has been addressing in .NET Framework 4.7.2+.
We had at least one customer a few months back having trouble using Postmark-dotnet
from (4.6.1-4.7.1
) projects due to dependency issues.
Taking the additional maintenance into account, I believe this is OK to add. @atheken what are your thoughts on providing a native .NET Framework built nuget (or alternatively, additional net461
and net472
build targets to the current one) to improve the experience of .NET Framework users? (especially on older versions: 4.6.1-4.7.1
)
Old issue, I know, but what about providing a multi-targeted package?
https://github.com/wildbit/postmark-dotnet/blob/1e315301d1edb9d55c3ea01cc5e121c3d7310d86/src/Postmark/Postmark.csproj#L3
Would change to
<TargetFrameworks>net471;net6.0;net5.0;netcoreapp3.1</TargetFrameworks>
Then add conditional references
<ItemGroup Condition=" '$(TargetFramework)' == 'net471' ">
<Reference Include="mscorlib" />
<Reference Include="System.Web" />
<Reference Include="System.Net.Http" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
Then pretty much any new project could use it natively. And in this configuration a reference to the System.Net.Http NuGet package would be completely unnecessary.
https://github.com/wildbit/postmark-dotnet/blob/1e315301d1edb9d55c3ea01cc5e121c3d7310d86/src/Postmark/Postmark.csproj#L16
Would be completely removed.