From 0a1f14e946402437190b9bd3af1ef343b54f1f8d Mon Sep 17 00:00:00 2001 From: MichaelGrafnetter Date: Tue, 23 Feb 2016 20:33:05 +0100 Subject: [PATCH] NuGet-Ready! --- Scripts/Build-Solution.ps1 | 10 +++++--- Scripts/Make.ps1 | 3 ++- ...GetPackages.ps1 => Pack-NuGetPackages.ps1} | 2 +- .../{Pack-Release.ps1 => Pack-PSModule.ps1} | 0 Scripts/Publish-NuGetPackages.ps1 | 23 +++++++++++++++++++ ...blish-Release.ps1 => Publish-PSModule.ps1} | 0 .../DSInternals.Common.nuspec | 3 ++- .../DSInternals.DataStore.nuspec | 3 ++- .../DSInternals.Replication.nuspec | 4 +++- Src/DSInternals.SAM/DSInternals.SAM.nuspec | 3 ++- Src/DSInternals.sln | 6 +++-- 11 files changed, 46 insertions(+), 11 deletions(-) rename Scripts/{Generate-NuGetPackages.ps1 => Pack-NuGetPackages.ps1} (90%) rename Scripts/{Pack-Release.ps1 => Pack-PSModule.ps1} (100%) create mode 100644 Scripts/Publish-NuGetPackages.ps1 rename Scripts/{Publish-Release.ps1 => Publish-PSModule.ps1} (100%) diff --git a/Scripts/Build-Solution.ps1 b/Scripts/Build-Solution.ps1 index e8aaac7..31ff57d 100644 --- a/Scripts/Build-Solution.ps1 +++ b/Scripts/Build-Solution.ps1 @@ -6,16 +6,20 @@ Compiles the binaries from source codes. $rootDir = Split-Path $PSScriptRoot -Parent $solutionFile = Join-Path $rootDir 'Src\DSInternals.sln' -$logRootDir = Join-Path $rootDir 'Build\log' +$buildDir = Join-Path $rootDir 'Build' +$logRootDir = Join-Path $buildDir 'log' # We need the Invoke-MSBuild module to always invoke the latest msbuild.exe. $modulePath = Join-Path $PSScriptRoot 'Modules\Invoke-MSBuild' Import-Module $modulePath -ErrorAction Stop -$targets = 'Clean','Build' -$configurations = 'Release','Debug' +$targets = 'Build' # 'Clean' +$configurations = 'Release' # 'Debug' $platforms = 'x86','x64' +# Delete the entire Build directory +del $buildDir -Recurse -Force + # Run all targets with all configurations and platforms foreach($target in $targets) { diff --git a/Scripts/Make.ps1 b/Scripts/Make.ps1 index 3c8606c..b5c4e89 100644 --- a/Scripts/Make.ps1 +++ b/Scripts/Make.ps1 @@ -6,4 +6,5 @@ Builds the solution from scratch and ZIPs the resulting module. .\Restore-ReferencedPackages .\Build-Solution .\Run-Tests -.\Pack-Release \ No newline at end of file +.\Pack-PSModule +.\Pack-NuGetPackages \ No newline at end of file diff --git a/Scripts/Generate-NuGetPackages.ps1 b/Scripts/Pack-NuGetPackages.ps1 similarity index 90% rename from Scripts/Generate-NuGetPackages.ps1 rename to Scripts/Pack-NuGetPackages.ps1 index 09b7951..5e83203 100644 --- a/Scripts/Generate-NuGetPackages.ps1 +++ b/Scripts/Pack-NuGetPackages.ps1 @@ -17,5 +17,5 @@ Get-ChildItem -Path $repoRoot -Filter *.nuspec -Recurse -File | ForEach-Object { $PSItem.FullName.Replace('.nuspec', '.csproj') } | ForEach-Object { $solutionFile = $PSItem - & $nuget pack $solutionFile -OutputDirectory $outputDir -IncludeReferencedProjects -Properties "Configuration=Release;Platform=x64;SolutionDir=$solutionDir" -Verbosity detailed + & $nuget pack $solutionFile -OutputDirectory $outputDir -IncludeReferencedProjects -Properties "Configuration=Release;Platform=x64;SolutionDir=$solutionDir" -Verbosity detailed -NonInteractive } \ No newline at end of file diff --git a/Scripts/Pack-Release.ps1 b/Scripts/Pack-PSModule.ps1 similarity index 100% rename from Scripts/Pack-Release.ps1 rename to Scripts/Pack-PSModule.ps1 diff --git a/Scripts/Publish-NuGetPackages.ps1 b/Scripts/Publish-NuGetPackages.ps1 new file mode 100644 index 0000000..19709f4 --- /dev/null +++ b/Scripts/Publish-NuGetPackages.ps1 @@ -0,0 +1,23 @@ +<# +.SYNOPSIS +Publishes NuGet packages to nuget.org. + +.DESCRIPTION +This script is intended to be used by project maintainers only. +Secret API key is required to publish the module. +#> +#Requires -Version 3 + +$repoRoot = Join-Path $PSScriptRoot '..\' +$nuget = Join-Path $repoRoot 'Scripts\Tools\nuget.exe' +$packagesDir = Join-Path $repoRoot 'Build\packages\' + +# Load the API key and exit on error +$apiKeyPath = Join-Path $repoRoot 'Keys\NuGet.key' +$apiKey = Get-Content $apiKeyPath -ErrorAction Stop + +Get-ChildItem -Path $packagesDir -Filter *.nupkg -Recurse -File | + ForEach-Object { + $packagePath = $PSItem.FullName + & $nuget push $packagePath -ApiKey $apiKey -NonInteractive -Verbosity detailed + } \ No newline at end of file diff --git a/Scripts/Publish-Release.ps1 b/Scripts/Publish-PSModule.ps1 similarity index 100% rename from Scripts/Publish-Release.ps1 rename to Scripts/Publish-PSModule.ps1 diff --git a/Src/DSInternals.Common/DSInternals.Common.nuspec b/Src/DSInternals.Common/DSInternals.Common.nuspec index 8461698..c8530fa 100644 --- a/Src/DSInternals.Common/DSInternals.Common.nuspec +++ b/Src/DSInternals.Common/DSInternals.Common.nuspec @@ -10,7 +10,8 @@ https://github.com/MichaelGrafnetter/DSInternals/ https://www.dsinternals.com/wp-content/uploads/ad.png false - DSInternals Common Library + This package is shared between all other DSInternals packages. It contains implementations of common hash functions used by Windows, including NT hash, LM hash and OrgId hash. It also contains methods for SysKey/BootKey retrieval. + This package is shared between all other DSInternals packages. Initial NuGet release. Copyright (c) 2015-2016 Michael Grafnetter. All rights reserved. ActiveDirectory Security diff --git a/Src/DSInternals.DataStore/DSInternals.DataStore.nuspec b/Src/DSInternals.DataStore/DSInternals.DataStore.nuspec index 82e780a..8eacd71 100644 --- a/Src/DSInternals.DataStore/DSInternals.DataStore.nuspec +++ b/Src/DSInternals.DataStore/DSInternals.DataStore.nuspec @@ -10,7 +10,8 @@ https://github.com/MichaelGrafnetter/DSInternals/ https://www.dsinternals.com/wp-content/uploads/ad.png false - DSInternals DataStore Library + DSInternals DataStore is an advanced framework for offline ntds.dit file manipulation. It can be used to extract password hashes from Active Directory backups or to modify the sIDHistory and primaryGroupId attributes. + DSInternals DataStore is an advanced framework for offline ntds.dit file manipulation. Initial NuGet release. Copyright (c) 2015-2016 Michael Grafnetter. All rights reserved. ActiveDirectory Security NTDS diff --git a/Src/DSInternals.Replication/DSInternals.Replication.nuspec b/Src/DSInternals.Replication/DSInternals.Replication.nuspec index 95fa933..23533ee 100644 --- a/Src/DSInternals.Replication/DSInternals.Replication.nuspec +++ b/Src/DSInternals.Replication/DSInternals.Replication.nuspec @@ -10,12 +10,14 @@ https://github.com/MichaelGrafnetter/DSInternals/ https://www.dsinternals.com/wp-content/uploads/ad.png false - DSInternals Replication Library + DSInternals Replication implements a client for the Active Directory Replication Service Remote Protocol (DRS-R). It can be used to remotely extract password hashes from domain controllers. + DSInternals Replication implements a client for the Active Directory Replication Service Remote Protocol (DRS-R). Initial NuGet release. Copyright (c) 2015-2016 Michael Grafnetter. All rights reserved. ActiveDirectory Security RPC DRSR + diff --git a/Src/DSInternals.SAM/DSInternals.SAM.nuspec b/Src/DSInternals.SAM/DSInternals.SAM.nuspec index 2ababcb..0fa7a38 100644 --- a/Src/DSInternals.SAM/DSInternals.SAM.nuspec +++ b/Src/DSInternals.SAM/DSInternals.SAM.nuspec @@ -10,7 +10,8 @@ https://github.com/MichaelGrafnetter/DSInternals/ https://www.dsinternals.com/wp-content/uploads/ad.png false - DSInternals Security Accounts Manager Library + DSInternals SAM implements a client for the Security Accounts Manager Remote Protocol (SAM-R). It can be used to import password hashes into Active Directory. + DSInternals SAM implements a client for the Security Accounts Manager Remote Protocol (SAM-R). Initial NuGet release. Copyright (c) 2015-2016 Michael Grafnetter. All rights reserved. ActiveDirectory Security RPC SAMR diff --git a/Src/DSInternals.sln b/Src/DSInternals.sln index d777739..411d1a1 100644 --- a/Src/DSInternals.sln +++ b/Src/DSInternals.sln @@ -49,8 +49,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Scripts", "Scripts", "{A6D9 ProjectSection(SolutionItems) = preProject ..\Scripts\Build-Solution.ps1 = ..\Scripts\Build-Solution.ps1 ..\Scripts\Make.ps1 = ..\Scripts\Make.ps1 - ..\Scripts\Pack-Release.ps1 = ..\Scripts\Pack-Release.ps1 - ..\Scripts\Publish-Release.ps1 = ..\Scripts\Publish-Release.ps1 + ..\Scripts\Pack-NuGetPackages.ps1 = ..\Scripts\Pack-NuGetPackages.ps1 + ..\Scripts\Pack-PSModule.ps1 = ..\Scripts\Pack-PSModule.ps1 + ..\Scripts\Publish-NuGetPackages.ps1 = ..\Scripts\Publish-NuGetPackages.ps1 + ..\Scripts\Publish-PSModule.ps1 = ..\Scripts\Publish-PSModule.ps1 ..\Scripts\Restore-ReferencedPackages.ps1 = ..\Scripts\Restore-ReferencedPackages.ps1 ..\Scripts\Run-Tests.ps1 = ..\Scripts\Run-Tests.ps1 ..\Scripts\Sign-ReferencedPackages.ps1 = ..\Scripts\Sign-ReferencedPackages.ps1