Skip to content

Conversation

0xced
Copy link
Contributor

@0xced 0xced commented Apr 28, 2021

By specifying everything in the csproj file it becomes easy to create the nupkg file with this command:

dotnet pack --configuration Release src/Mongo2Go/Mongo2Go.csproj -p:ContinuousIntegrationBuild=true

Key differences:

  • No empty netstandard2.1 directory
  • Correct dependencies
  • Embedded icon (matches current NuGet recommendation)
  • License + repository information
  • Valid SourceLink
  • No unneeded .DS_Store nor README.md nor Mongo2Go.deps.json files

Here's a before/after screenshot of the analysis of the NuGet package with NuGetPackageExplorer:
Screenshot 2021-04-29 at 00 07 45

0xced added 2 commits April 28, 2021 23:53
Create the NuGet package simply like this:
> dotnet pack --configuration Release src/Mongo2Go/Mongo2Go.csproj
@JohannesHoppe
Copy link
Member

Excellent! The old nuget.exe was very inconvenient. v3.1.3 is coming this evening! 👍

@JohannesHoppe JohannesHoppe merged commit b45e00b into Mongo2Go:master Apr 29, 2021
@JohannesHoppe
Copy link
Member

JohannesHoppe commented Apr 29, 2021

Screen Shot 2021-04-30 at 00 46 39

Unfortunately, that didn't work out. 😞
First of all, the Mongo2Go.xml file is missing. But most importantly, the tools folder with the binaries is also missing.

@JohannesHoppe
Copy link
Member

I first cleaned the Release folder for this. Then I tried the command shown above. The content of the .nuget/.zip file corresponds to the screenshot.

@0xced 0xced deleted the nupkg branch April 29, 2021 23:55
@0xced
Copy link
Contributor Author

0xced commented Apr 30, 2021

Glad to hear it worked. Also, good job on deprecating version 3.1.2 on NuGet. 👍🏻

Next step is considering building and publishing the package on a continuous integration system such as GitHub Actions. 😉
You can take inspiration from my continuous-integration.yml if you want. Don't hesitate to ask if you have questions.

@JohannesHoppe
Copy link
Member

No, sorry. It did not worked. The final zip file does not contain the MongoDb binaries. The nuget.exe adds the tools folder by default. Do you know how to fix that with the dotnet pack command?! Many thanks for your continuous support! 👍👍

@0xced
Copy link
Contributor Author

0xced commented Apr 30, 2021

What version of the .NET SDK are you using? I'm on version 5.0.202 (running on macOS 10.15.7).

Here's what I did:

  1. Clean the repository to make sure we are in the same state
$ git clean -fdx  
Removing src/Mongo2Go/bin/
Removing src/Mongo2Go/obj/
Removing src/Mongo2GoTests/bin/
Removing src/Mongo2GoTests/obj/
Removing src/MongoDownloader/bin/
Removing src/MongoDownloader/obj/
  1. Make sure we are on the exact same revision
$ git show --summary
commit b45e00b21baa0e8b054bcf92a73c185fff87735d (HEAD -> master, origin/master, origin/HEAD)
Author: Cédric Luthi <cedric.luthi@gmail.com>
Date:   Fri Apr 30 00:36:29 2021 +0200

    Improve creating the nupkg file (#121)
    
    * Use the Mongo2Go.csproj for generating the nupkg file
    
    Create the NuGet package simply like this:
    > dotnet pack --configuration Release src/Mongo2Go/Mongo2Go.csproj
    
    * Enable SourceLink

 delete mode 100644 Mongo2Go.nuspec
 delete mode 100644 package_create.cmd
  1. Make sure the tools are there
$ ls -1 tools   
README.md
mongodb-linux-4.4.4-database-tools-100.3.1
mongodb-macos-4.4.4-database-tools-100.3.1
mongodb-windows-4.4.4-database-tools-100.3.1
  1. Check the .NET SDK version
$ dotnet --version
5.0.202
  1. Create the NuGet package from the root of the repository (takes ~15 seconds on my machine)
$ dotnet pack --configuration Release src/Mongo2Go/Mongo2Go.csproj -p:ContinuousIntegrationBuild=true
Microsoft (R) Build Engine version 16.9.0+57a23d249 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  Restored ~/Projects/Mongo2Go/src/Mongo2Go/Mongo2Go.csproj (in 173 ms).
  [… Many warnings about missing XML comments …]
  Mongo2Go -> ~/Projects/Mongo2Go/src/Mongo2Go/bin/Release/netstandard2.0/Mongo2Go.dll
  Successfully created package '~/Projects/Mongo2Go/src/Mongo2Go/bin/Release/Mongo2Go.3.1.2.nupkg'.
  1. Check that the NuGet package file was properly generated
$ zipinfo src/Mongo2Go/bin/Release/Mongo2Go.3.1.2.nupkg
Archive:  src/Mongo2Go/bin/Release/Mongo2Go.3.1.2.nupkg
Zip file size: 120466394 bytes, number of entries: 37
?---------  2.0 unx      498 b- defN 21-Apr-30 09:10 _rels/.rels
?---------  2.0 unx     1717 b- defN 21-Apr-30 09:10 Mongo2Go.nuspec
?---------  2.0 unx    43520 b- defN 21-Apr-30 07:10 lib/netstandard2.0/Mongo2Go.dll
?---------  2.0 unx    10840 b- defN 21-Apr-30 07:10 lib/netstandard2.0/Mongo2Go.xml
?---------  2.0 unx    21563 b- defN 21-Jan-19 09:25 icon.png
?---------  2.0 unx 82390040 b- defN 21-Apr-28 13:07 tools/mongodb-linux-4.4.4-database-tools-100.3.1/bin/mongod
?---------  2.0 unx 19897008 b- defN 21-Apr-28 13:07 tools/mongodb-linux-4.4.4-database-tools-100.3.1/bin/mongoexport
?---------  2.0 unx 20057832 b- defN 21-Apr-28 13:07 tools/mongodb-linux-4.4.4-database-tools-100.3.1/bin/mongoimport
?---------  2.0 unx    30608 b- defN 21-Apr-28 13:07 tools/mongodb-linux-4.4.4-database-tools-100.3.1/community-server/LICENSE-Community.txt
?---------  2.0 unx    16726 b- defN 21-Apr-28 13:07 tools/mongodb-linux-4.4.4-database-tools-100.3.1/community-server/MPL-2
?---------  2.0 unx     1977 b- defN 21-Apr-28 13:07 tools/mongodb-linux-4.4.4-database-tools-100.3.1/community-server/README
?---------  2.0 unx    75685 b- defN 21-Apr-28 13:07 tools/mongodb-linux-4.4.4-database-tools-100.3.1/community-server/THIRD-PARTY-NOTICES
?---------  2.0 unx      554 b- defN 21-Apr-28 13:07 tools/mongodb-linux-4.4.4-database-tools-100.3.1/database-tools/LICENSE.md
?---------  2.0 unx     3120 b- defN 21-Apr-28 13:07 tools/mongodb-linux-4.4.4-database-tools-100.3.1/database-tools/README.md
?---------  2.0 unx   179068 b- defN 21-Apr-28 13:07 tools/mongodb-linux-4.4.4-database-tools-100.3.1/database-tools/THIRD-PARTY-NOTICES
?---------  2.0 unx 68793192 b- defN 21-Apr-28 13:07 tools/mongodb-macos-4.4.4-database-tools-100.3.1/bin/mongod
?---------  2.0 unx 20125520 b- defN 21-Apr-28 13:07 tools/mongodb-macos-4.4.4-database-tools-100.3.1/bin/mongoexport
?---------  2.0 unx 20285792 b- defN 21-Apr-28 13:07 tools/mongodb-macos-4.4.4-database-tools-100.3.1/bin/mongoimport
?---------  2.0 unx    30608 b- defN 21-Apr-28 13:07 tools/mongodb-macos-4.4.4-database-tools-100.3.1/community-server/LICENSE-Community.txt
?---------  2.0 unx    16726 b- defN 21-Apr-28 13:07 tools/mongodb-macos-4.4.4-database-tools-100.3.1/community-server/MPL-2
?---------  2.0 unx     1977 b- defN 21-Apr-28 13:07 tools/mongodb-macos-4.4.4-database-tools-100.3.1/community-server/README
?---------  2.0 unx    75685 b- defN 21-Apr-28 13:07 tools/mongodb-macos-4.4.4-database-tools-100.3.1/community-server/THIRD-PARTY-NOTICES
?---------  2.0 unx      554 b- defN 21-Apr-28 13:07 tools/mongodb-macos-4.4.4-database-tools-100.3.1/database-tools/LICENSE.md
?---------  2.0 unx     3120 b- defN 21-Apr-28 13:07 tools/mongodb-macos-4.4.4-database-tools-100.3.1/database-tools/README.md
?---------  2.0 unx   179068 b- defN 21-Apr-28 13:07 tools/mongodb-macos-4.4.4-database-tools-100.3.1/database-tools/THIRD-PARTY-NOTICES
?---------  2.0 unx 38379008 b- defN 21-Apr-28 13:07 tools/mongodb-windows-4.4.4-database-tools-100.3.1/bin/mongod.exe
?---------  2.0 unx 27094761 b- defN 21-Apr-28 13:07 tools/mongodb-windows-4.4.4-database-tools-100.3.1/bin/mongoexport.exe
?---------  2.0 unx 27281966 b- defN 21-Apr-28 13:07 tools/mongodb-windows-4.4.4-database-tools-100.3.1/bin/mongoimport.exe
?---------  2.0 unx    30608 b- defN 21-Apr-28 13:07 tools/mongodb-windows-4.4.4-database-tools-100.3.1/community-server/LICENSE-Community.txt
?---------  2.0 unx    16726 b- defN 21-Apr-28 13:07 tools/mongodb-windows-4.4.4-database-tools-100.3.1/community-server/MPL-2
?---------  2.0 unx     1977 b- defN 21-Apr-28 13:07 tools/mongodb-windows-4.4.4-database-tools-100.3.1/community-server/README
?---------  2.0 unx    75685 b- defN 21-Apr-28 13:07 tools/mongodb-windows-4.4.4-database-tools-100.3.1/community-server/THIRD-PARTY-NOTICES
?---------  2.0 unx      554 b- defN 21-Apr-28 13:07 tools/mongodb-windows-4.4.4-database-tools-100.3.1/database-tools/LICENSE.md
?---------  2.0 unx     3120 b- defN 21-Apr-28 13:07 tools/mongodb-windows-4.4.4-database-tools-100.3.1/database-tools/README.md
?---------  2.0 unx   179068 b- defN 21-Apr-28 13:07 tools/mongodb-windows-4.4.4-database-tools-100.3.1/database-tools/THIRD-PARTY-NOTICES
?---------  2.0 unx     3163 b- defN 21-Apr-30 09:10 [Content_Types].xml
?---------  2.0 unx     1099 b- defN 21-Apr-30 09:10 package/services/metadata/core-properties/c51b723fe0e24d8083acd72171a392c6.psmdcp
37 files, 325310733 bytes uncompressed, 120458712 bytes compressed:  63.0%

I hope this helps.

@JohannesHoppe
Copy link
Member

JohannesHoppe commented Apr 30, 2021

Your commitment is awesome! 👍

Summary of the issue: After 10h working and kids, I tried to create the package after midnight.
(I forgot to pull first... 🙈)

@JohannesHoppe
Copy link
Member

Regarding your Github Actions workflow:

It looks to me like you put a bigger amount of time into this. There is definitely a lot of stuff in there (build matrix, tests, publish a tag) that would make Mongo2Go more fun, too.

If I invite you to the project as a maintainer, could it be possible for you to set this up again here?!

😇


NUGET_API_KEY is already added as a repo secret! 😉

@0xced
Copy link
Contributor Author

0xced commented Apr 30, 2021

It looks to me like you put a bigger amount of time into this.

I did put quite a lot of time into it, indeed. 😄

If I invite you to the project as a maintainer, could it be possible for you to set this up again here?!

Sure, I can help you setting this up. Eventually, all you'll have to do to publish a new version is add an annotated tag and push that tag.

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