Distribute your code with NUget and build vNext
-
Upload
gian-maria-ricci -
Category
Presentations & Public Speaking
-
view
1.188 -
download
1
Transcript of Distribute your code with NUget and build vNext
![Page 1: Distribute your code with NUget and build vNext](https://reader036.fdocuments.us/reader036/viewer/2022062821/589ae2021a28abee708b52d1/html5/thumbnails/1.jpg)
Distribute your code with NUget and build vNext
Gian Maria Ricci
![Page 2: Distribute your code with NUget and build vNext](https://reader036.fdocuments.us/reader036/viewer/2022062821/589ae2021a28abee708b52d1/html5/thumbnails/2.jpg)
Semantic versioning in
• http://semver.org/• Version with three number, MAJOR, MINOR,
PATCH• It enforces a string behavior for Public API• It can be used with less stringent behavior for a
product without public API
![Page 3: Distribute your code with NUget and build vNext](https://reader036.fdocuments.us/reader036/viewer/2022062821/589ae2021a28abee708b52d1/html5/thumbnails/3.jpg)
MAJOR, MINOR, PATCH
• PATCH number is incremented only when there are bugfix or modification done maintaining full compatibility
• MINOR number is incremented when new functionalities are introduced in a backward compatible way
• MAJOR number is incremented when something about public API changes
![Page 4: Distribute your code with NUget and build vNext](https://reader036.fdocuments.us/reader036/viewer/2022062821/589ae2021a28abee708b52d1/html5/thumbnails/4.jpg)
GIT AND GITFLOWA successful branch model used with Git to simplify workflow
![Page 5: Distribute your code with NUget and build vNext](https://reader036.fdocuments.us/reader036/viewer/2022062821/589ae2021a28abee708b52d1/html5/thumbnails/5.jpg)
GitFlow basic
• CheatSheet here: http://danielkummer.github.io/git-flow-cheatsheet/
• Detailed explanation here: http://nvie.com/posts/a-successful-git-branching-model/
• There are two major branches– Master: is the stable and released branch– Develop: is the integration branch, represents stable branch
for development• And some “Support Branches”
– Features– Releases– Hotfixes
![Page 6: Distribute your code with NUget and build vNext](https://reader036.fdocuments.us/reader036/viewer/2022062821/589ae2021a28abee708b52d1/html5/thumbnails/6.jpg)
Support branches: Release
• Release: used to prepare new release– they allow for
stabilization before merge to master.
– Allow further development on develop without risk
– They start from develop and are merged to master and back to develop
![Page 7: Distribute your code with NUget and build vNext](https://reader036.fdocuments.us/reader036/viewer/2022062821/589ae2021a28abee708b52d1/html5/thumbnails/7.jpg)
Support branches: Hotfix
• Hotfix: fix severe bugs in production– Allow to quickly fix
production bugs– Starts from master and
merge back in master and develop
– Usually there is only a single hotfix branch at a given time
![Page 8: Distribute your code with NUget and build vNext](https://reader036.fdocuments.us/reader036/viewer/2022062821/589ae2021a28abee708b52d1/html5/thumbnails/8.jpg)
GitFlow + SemVer = Gitversion.exe
• Gitversion.exe is a simple tools that determine SemVer for a Git Repo
• It walks the history and gives names depending on branch name, commits, tag, etc
• Basically it is a much more evolved version of “git describe”
![Page 9: Distribute your code with NUget and build vNext](https://reader036.fdocuments.us/reader036/viewer/2022062821/589ae2021a28abee708b52d1/html5/thumbnails/9.jpg)
Build vNext
• Giversion.exe natively integrates with build vNext• I prefer using a PowerShell Script– Can be used by developer– Can be used in a “local build”– Better flexibility on how to use and parse semantic
versioning• Invoke a Gitversion.exe and grab SemVer to
versioning assemblies.
![Page 10: Distribute your code with NUget and build vNext](https://reader036.fdocuments.us/reader036/viewer/2022062821/589ae2021a28abee708b52d1/html5/thumbnails/10.jpg)
DEMO:
Gitversion.exe simple demo
![Page 11: Distribute your code with NUget and build vNext](https://reader036.fdocuments.us/reader036/viewer/2022062821/589ae2021a28abee708b52d1/html5/thumbnails/11.jpg)
SemVer for product / applications
• If you do not expose public API SemVer can be simple used to manage versions
• You decide how to handle MAJOR, MINOR, PATCH• GitVersion gives you high flexibility on how it
determine SemVer number
![Page 12: Distribute your code with NUget and build vNext](https://reader036.fdocuments.us/reader036/viewer/2022062821/589ae2021a28abee708b52d1/html5/thumbnails/12.jpg)
SemVer for NuGet
• A NuGet Package should implement SemVer• NuGet package allows also for “unstable or
prerelease” version• GitVersion natively supports this– You create stable package from master– You create Beta version from hotfixes or releases– You create Unstable version from develop
![Page 13: Distribute your code with NUget and build vNext](https://reader036.fdocuments.us/reader036/viewer/2022062821/589ae2021a28abee708b52d1/html5/thumbnails/13.jpg)
VSTS package management
• Extension of Visual Studio Team Services• Allows for creation of private NuGet feeds• Still in preview, it offers less management features
than NuGet or MyGet
![Page 14: Distribute your code with NUget and build vNext](https://reader036.fdocuments.us/reader036/viewer/2022062821/589ae2021a28abee708b52d1/html5/thumbnails/14.jpg)
Automate publishing with a build
• Determine version with GitVersion• Modify AssemblyInfo.cs and AssemblyInfo.vb with
new SemVer Number• Compile, run test• Create Nuget Packages• Publish Nuget Packages
![Page 15: Distribute your code with NUget and build vNext](https://reader036.fdocuments.us/reader036/viewer/2022062821/589ae2021a28abee708b52d1/html5/thumbnails/15.jpg)
DEMO:
Create build to Pack and Publish NuGet package
![Page 16: Distribute your code with NUget and build vNext](https://reader036.fdocuments.us/reader036/viewer/2022062821/589ae2021a28abee708b52d1/html5/thumbnails/16.jpg)
Use Chocolatey to distribute an application
• Chocolatey is a package manager for Windows based on NuGet
• It uses NuGet package to package an application• Installation is done with PowerShell scripts
![Page 17: Distribute your code with NUget and build vNext](https://reader036.fdocuments.us/reader036/viewer/2022062821/589ae2021a28abee708b52d1/html5/thumbnails/17.jpg)
Script preparation
• Carefully manage published artifacts– Pack everything with a script– Prefer uploading a zipped file containing
everything• Create Installer with PowerShell– PowerShell script will accept the zip artifacts as
input– Install your application with whatever you want
(imperative, DSC, etc)• Include zip and script in NuGet package and you’re
done
![Page 18: Distribute your code with NUget and build vNext](https://reader036.fdocuments.us/reader036/viewer/2022062821/589ae2021a28abee708b52d1/html5/thumbnails/18.jpg)
DEMO:
Create chocolatey package with build vNext