A complete build suite for creating NuGet packages for miscellaneous CI build environments (think MyGet). How does it work? Simply include the myget.include.ps1
script in your build.ps1
on MyGet and use the provided functions.
Note these scripts will also work without a CI server, for example on your local computer.
Checkout the examples.
If you want myget.include.ps1
to work on you local computer you need to have msysgit installed.
You might want to add .buildtools
to your .gitignore.
.\powershelltests.ps1
.\examples\build.all.samples.ps1
.\myget.include.ps1 -updateSelf 1
The myget.include.ps1
script can be included by your build.ps1
script to make use of the following functions:
MyGet-Write-Diagnostic
- writes a diagnostic message to the standard outputMyGet-Build-Success
- report build successMyGet-Die
- report build failure
-
MyGet-Create-Folder
- create a new folder -
MyGet-Build-Clean
- recursive clean a folder -
MyGet-Grep
-grep-like function -
MyGet-Normalize-Path
normalize a file system path -
MyGet-Normalize-Paths
normalize an array of file system paths -
MyGet-EnvironmentVariable
returns value of an environment variable -
MyGet-Set-EnvironmentVariable
create / overwrite an existing environment variable value -
MyGet-BuildRunner
- returns the current build runner (empty if not run within MyGet Build Services) -
MyGet-Package-Version
- returns the package version under build (empty if not run within MyGet Build Services) -
MyGet-NunitExe-Path
- path to the NUnit test runner -
MyGet-XunitExe-Path
- path to the XUnit test runner -
MyGet-TargetFramework-To-Clr
Target framework version to clr (e.g v2.0 -> net20) -
MyGet-TargetFramework-To-Clr
Clr to target framework version (e.g net20 -> v2.0) -
```MyGet-AssemblyInfo```` Read miscellaneous information from a binary (e.g TargetFramework, Processor architecture ++)
MyGet-NugetExe-Path
- path to NuGetMyGet-NuGet-Get-PackagesPath
returns value ofrepositorypath
attribute innuget.config
for a given project folder
MyGet-Build-Bootstrap
- starts a build (including NuGet package restore)MyGet-Build-Solution
- starts a build of a solution fileMyGet-Build-Project
- starts a build of a project fileMyGet-Build-Nupkg
- creates a NuGet package based on a specified .nuspec file. The .nuspec can contain additional replacement tokens
MyGet-TestRunner-Nunit
- invoke NUnitMyGet-TestRunner-Xunit
- invoke XUnit
MyGet-CurlExe-Path
- path to Curl
MyGet-Squirrel-New-Release
- creates a new squirrel release
MyGet-Curl-Upload-File
- upload files using either scp or sftp (private/public key required)
** = Provided by MyGet
Variable | Description |
---|---|
|
bin\$version$\$platform$\$configuration$ -> bin\(x86|x64|AnyCpu)\1.0.0\(v2.0|v3.5|v4.0|v4.5|v4.5.1) |
|
x86|x64|AnyCpu |
|
Folder where nuspec resides in a project |
|
Debug|Release (You decide this value) |
The Assembly name | |
The assembly version as specified in the assembly’s AssemblyVersionAttribute. If the assembly’s AssemblyInformationalVersionAttribute is specified, that one is used instead. | |
The company as specified in the AssemblyCompanyAttribute. | |
The company as specified in the AssemblyCompanyAttribute. |
Parameter | Description |
---|---|
-packageVersion | Package version to build. If building using a CI server, $env:PackageVersion is used instead. |
-config | Debug, Release (Or custom build configuration name) |
-platforms | x86, x64, AnyCpu |
-targetFrameworks | v2.0, v3.5, v4.0, v4.5, v4.5.1 |
-target | Build, Rebuild |
-verbosity (MSBuild) | Quiet, Minimal, Normal, Detailed, Diagnostic |
-clean | Set clean to 0 if you wish to avoid gardening of all bin,obj,build folders |
The MIT License (MIT)
Copyright (c) 2013 Peter Rekdal Sunde
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.