Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Target netstandard1.6 and net45 #10

Merged
merged 2 commits into from
Oct 17, 2018

Conversation

kkm000
Copy link
Contributor

@kkm000 kkm000 commented Oct 17, 2018

Hit a couple snags, of course.

Targeting F# core package 4.2.3, since 4.2.* is the lowest version supporting netstandard.

I also resurrected generation of XML doc files, they were in the 0.3.1 package.

Tests out good:

c:\projects\FParsec-Pipes>dotnet test FParsec-Pipes-Test -f netcoreapp2.0
Microsoft (R) Build Engine version 15.8.169+g1ccb72aefa for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restoring packages for c:\projects\FParsec-Pipes\FParsec-Pipes\FParsec-Pipes.fsproj...
  Restoring packages for c:\projects\FParsec-Pipes\FParsec-Pipes-Test\FParsec-Pipes-Test.fsproj...
  Generating MSBuild file c:\projects\FParsec-Pipes\FParsec-Pipes\obj\FParsec-Pipes.fsproj.nuget.g.props.
  Generating MSBuild file c:\projects\FParsec-Pipes\FParsec-Pipes\obj\FParsec-Pipes.fsproj.nuget.g.targets.
  Restore completed in 637.35 ms for c:\projects\FParsec-Pipes\FParsec-Pipes\FParsec-Pipes.fsproj.
  Generating MSBuild file c:\projects\FParsec-Pipes\FParsec-Pipes-Test\obj\FParsec-Pipes-Test.fsproj.nuget.g.props.
  Generating MSBuild file c:\projects\FParsec-Pipes\FParsec-Pipes-Test\obj\FParsec-Pipes-Test.fsproj.nuget.g.targets.
  Restore completed in 866.43 ms for c:\projects\FParsec-Pipes\FParsec-Pipes-Test\FParsec-Pipes-Test.fsproj.
Build started, please wait...
Build completed.

Test run for c:\projects\FParsec-Pipes\FParsec-Pipes-Test\bin\Debug\netcoreapp2.0\FParsec-Pipes-Test.dll(.NETCoreApp,Version=v2.0)
Microsoft (R) Test Execution Command Line Tool Version 15.8.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...

Total tests: 47. Passed: 47. Failed: 0. Skipped: 0.
Test Run Successful.
Test execution time: 0.9635 Seconds
c:\projects\FParsec-Pipes>dotnet test FParsec-Pipes-Test -f net45
Microsoft (R) Build Engine version 15.8.169+g1ccb72aefa for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 33.81 ms for c:\projects\FParsec-Pipes\FParsec-Pipes\FParsec-Pipes.fsproj.
  Restore completed in 31.35 ms for c:\projects\FParsec-Pipes\FParsec-Pipes-Test\FParsec-Pipes-Test.fsproj.
Build started, please wait...
Build completed.

Test run for c:\projects\FParsec-Pipes\FParsec-Pipes-Test\bin\Debug\net45\FParsec-Pipes-Test.exe(.NETFramework,Version=v4.5)
Microsoft (R) Test Execution Command Line Tool Version 15.8.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...

Total tests: 47. Passed: 47. Failed: 0. Skipped: 0.
Test Run Successful.
Test execution time: 1.2194 Seconds
c:\projects\FParsec-Pipes>dotnet test Examples.SQLite
Build started, please wait...
Build completed.

Test run for c:\projects\FParsec-Pipes\Examples.SQLite\bin\Debug\netcoreapp2.0\Examples.SQLite.dll(.NETCoreApp,Version=v2.0)
Microsoft (R) Test Execution Command Line Tool Version 15.8.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
Skipped  TestSqlFiles

Total tests: 11. Passed: 10. Failed: 0. Skipped: 1.
Test Run Successful.
Test execution time: 1.6925 Seconds

Release packaging (requires the SNK file)

c:\projects\FParsec-Pipes>sn -k ..\robert.peele.snk

Microsoft (R) .NET Framework Strong Name Utility  Version 4.0.30319.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Key pair written to ..\robert.peele.snk

c:\projects\FParsec-Pipes>dotnet pack FParsec-Pipes -c Release
Microsoft (R) Build Engine version 15.8.169+g1ccb72aefa for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 29.78 ms for c:\projects\FParsec-Pipes\FParsec-Pipes\FParsec-Pipes.fsproj.
  FParsec-Pipes -> c:\projects\FParsec-Pipes\FParsec-Pipes\bin\Release\net45\FParsec-Pipes.dll
  FParsec-Pipes -> c:\projects\FParsec-Pipes\FParsec-Pipes\bin\Release\netstandard1.6\FParsec-Pipes.dll
  Successfully created package 'c:\projects\FParsec-Pipes\FParsec-Pipes\bin\Release\FParsec-Pipes.1.1.0.nupkg'.

Make sure the right FSharp.Core version 4.2.3 is really used.

c:\projects\FParsec-Pipes>dotnet build FParsec-Pipes-Test -c Release -bl:build.binlog -v:n | grep 'FSharp.Core'
         -r:C:\Users\kkm\.nuget\packages\fsharp.core\4.2.3\lib\net45\FSharp.Core.dll
         -r:C:\Users\kkm\.nuget\packages\fsharp.core\4.2.3\lib\netstandard1.6\FSharp.Core.dll
         -r:C:\Users\kkm\.nuget\packages\fsharp.core\4.2.3\lib\net45\FSharp.Core.dll
         -r:C:\Users\kkm\.nuget\packages\fsharp.core\4.2.3\lib\netstandard1.6\FSharp.Core.dll

Package contents and dependencies look reasonable, too.

c:\projects\FParsec-Pipes>unzip -l FParsec-Pipes\bin\Release\FParsec-Pipes.1.1.0.nupkg
Archive:  FParsec-Pipes\bin\Release\FParsec-Pipes.1.1.0.nupkg
  Length      Date    Time    Name
---------  ---------- -----   ----
      507  2018-10-16 20:13   _rels/.rels
     1578  2018-10-16 20:13   FParsec-Pipes.nuspec
   200704  2018-10-17 03:13   lib/net45/FParsec-Pipes.dll
    12028  2018-10-17 03:13   lib/net45/FParsec-Pipes.xml
   201216  2018-10-17 03:13   lib/netstandard1.6/FParsec-Pipes.dll
    12028  2018-10-17 03:13   lib/netstandard1.6/FParsec-Pipes.xml
      528  2018-10-16 20:13   [Content_Types].xml
      683  2018-10-16 20:13   package/services/metadata/core-properties/a079646db21a4b81837eb9bd62131c5f.psmdcp
---------                     -------
   429272                     8 files

c:\projects\FParsec-Pipes>unzip -p FParsec-Pipes\bin\Release\FParsec-Pipes.1.1.0.nupkg FParsec-Pipes.nuspec
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
  <metadata>
    <id>FParsec-Pipes</id>
    <version>1.1.0</version>
    <authors>Robert Peele</authors>
    <owners>Robert Peele</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <licenseUrl>https://opensource.org/licenses/MIT</licenseUrl>
    <projectUrl>https://github.com/rspeele/FParsec-Pipes</projectUrl>
    <description>Package Description</description>
    <releaseNotes>Target netstandard1.6 and net45</releaseNotes>
    <copyright>Copyright 2016 Robert Peele</copyright>
    <tags>parser combinator f# fsharp c# csharp parsec fparsec pipe pipes</tags>
    <repository url="https://github.com/rspeele/FParsec-Pipes" />
    <dependencies>
      <group targetFramework=".NETFramework4.5">
        <dependency id="FParsec" version="1.0.3" exclude="Build,Analyzers" />
        <dependency id="FSharp.Core" version="4.2.3" exclude="Build,Analyzers" />
        <dependency id="System.ValueTuple" version="4.4.0" exclude="Build,Analyzers" />
      </group>
      <group targetFramework=".NETStandard1.6">
        <dependency id="FParsec" version="1.0.3" exclude="Build,Analyzers" />
        <dependency id="FSharp.Core" version="4.2.3" exclude="Build,Analyzers" />
        <dependency id="NETStandard.Library" version="1.6.1" exclude="Build,Analyzers" />
        <dependency id="System.ValueTuple" version="4.4.0" exclude="Build,Analyzers" />
      </group>
    </dependencies>
  </metadata>
</package>

Closes #9

kkm added 2 commits October 16, 2018 20:36
@rspeele
Copy link
Owner

rspeele commented Oct 17, 2018

You are the man. Thank you so much for doing this and especially for including all the dotnet commands you used to test on both Framework and Core and to package. That made it so much easier for me to confirm on my own machine vs. wandering around in the dark not sure if what I'm doing matches current doctrine.

Also, this made me realize that I never backed up my own .snk and in fact had changed hard drives since the last time I did any open source work. The only drive with my .snk on it was sitting on my desk getting beverages spilled on it. So thanks for reminding me to pull that off of there!

@rspeele rspeele merged commit c0da3fc into rspeele:master Oct 17, 2018
@kkm000
Copy link
Contributor Author

kkm000 commented Oct 18, 2018

My pleasure! I learned something in the process, too, namely how to pin the FSharp.Core package version.

The current doctrine regarding the SNK is just create one per open-source project and check it in. The signature is no longer relied upon for security, but allows the DLL to have a strong name.:

Warning

Do not rely on strong names for security. They provide a unique identity only.

If you are an open-source developer and you want the identity benefits of a strong-named assembly, consider checking in the private key associated with an assembly into your source control system.

There are interesting effects of changing the key, but if it's gone, it's gone. Basically, new key means new "full name", which means the build cannot create a binding redirect to consolidate references to one single version of the assembly (it is considered an entirely different assembly), but the two fight for the same file name in the bin/ output. I do not think many people are using this particular library to experience major unification problems; compare this and that. And all this can happen only if A.EXE refers to both B.DLL and your library nuget e. g. ver. 0.3.1, and B.DLL is in turn built against ver. 42.0 with a different key, for some value of 42. We (meaning the users of it) will survive. :)

There is also this new PublicSign aka "fake sign" mechanism which, I believe, requires an SNK with a public key only. But I do not know much else except that it exists.

By the way, AssemblyInfo.{cs,vb,fs} is no longer necessary too (you still have version 0.4.0 there). If you do not set the version attributes, the build will generate one in a temp directory and compile it in, setting all 3 version fields to the package version from the <Version> property in .*proj. This is the right thing to do for simple cases like this library. Also sets author, description, copyright, all this stuff.

Love the compiler-abuse tag ob the repo, by the way. Very apt! :)

@kkm000 kkm000 deleted the multitarget-net45-std16 branch October 20, 2018 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants