Skip to content

Instantly share code, notes, and snippets.

@teyc
Created September 1, 2020 00:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save teyc/6a1d7c5e474d59da95b7c1c67ac8e7e4 to your computer and use it in GitHub Desktop.
Save teyc/6a1d7c5e474d59da95b7c1c67ac8e7e4 to your computer and use it in GitHub Desktop.
CI/CD
# Big idea - package following files by convention
# NuGetPackage/README.txt
# NuGetPackage/tools/install.ps1
$nuspec = @"
<?xml version="1.0"?>
<package >
<metadata>
<id>%project.name%</id>
<version>%PackageVersion%</version>
<title>%PackageTitle%</title>
<authors>$author</authors>
<owners>$owners</owners>
<description>%PackageDescription%</description>
</metadata>
</package>
"@
If (Test-Path -PathType Container %project.name%\NuGetPackage)
{
$nuspec = $nuspec -replace '</package>','<files><file src="NuGetPackage\**" target="" /></files></package>'
}
$nuspec | Out-File "%project.name%\%project.name%.nuspec"
If (-not (Get-Module VSSetup))
{
Install-Module VSSetup -Scope CurrentUser
}
$MSBuildPath = "$((Get-VSSetupInstance).InstallationPath)\MSBuild\Current\Bin\MSBuild.exe"
Function Invoke-MSBuild
{
param ($solution)
pushd (gi $solution).Directory.FullName
C:\Bin\nuget.exe restore
& $MSBuildPath $solution "-p:Configuration=Debug"
popd
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment