Skip to content

Instantly share code, notes, and snippets.

@jesmaail
Last active November 19, 2019 11:02
Show Gist options
  • Save jesmaail/c8ffcbdd38faf3d78a369fbe80f04002 to your computer and use it in GitHub Desktop.
Save jesmaail/c8ffcbdd38faf3d78a369fbe80f04002 to your computer and use it in GitHub Desktop.
Rough local nuget dev script
{
"PackagesDirectory" : "",
"ProjectPath" : "",
"LocalNugetPath" : ""
}
# Script to copy .nupkg files to local nuget repo and clear the associated packages folder
$ConfigFilePath = "localnugetupdate.json";
function GetConfigValuesFromFile($path)
{
$Config = Get-Content -Path $path -Raw| ConvertFrom-Json
$global:PackagesDirectory = $Config.PackagesDirectory
$global:ProjectPath = $Config.ProjectPath;
$global:LocalNugetPath = $Config.LocalNugetPath;
}
function CopyPackagesToFolder($source, $destination)
{
# This needs refactoring
$ExclusionList = @("netstandard2.0")
$SourceFiles = $source + '/*';
Copy-Item -Force $SourceFiles -Destination $destination -Exclude $ExclusionList
}
function DeleteFolder($path)
{
Remove-Item -path $path -recurse
}
# Perform Steps
GetConfigValuesFromFile -path $ConfigFilePath
CopyPackagesToFolder -source $global:ProjectPath -destination $global:LocalNugetPath
DeleteFolder -path $global:PackagesDirectory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment