Created
January 27, 2017 12:21
-
-
Save nzhul/4d3ca6cb5d4f77c3fdf8f68d73555711 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------- GenerateForumsSpamProtectionNuGetPackages.ps1 --------------- | |
[CmdletBinding()] | |
Param( | |
[alias("sln")] | |
$slnName = "Web.SitefinityModules.PublishingExtender", | |
[alias("slnDir")] | |
$slnDirectory = $null, | |
[alias("outDir")] | |
$outputDir = "C:\LEAN\local-nuget-repository", | |
[alias("projects")] | |
$nugetProjects = @( | |
"Web.SitefinityModules.Forums.SpamProtection\Web.SitefinityModules.Forums.SpamProtection.csproj", | |
"Web.SitefinityModules.Forums.Spam.Akismet\Web.SitefinityModules.Forums.SpamProtection.Akismet.csproj", | |
"Composition\Web.SitefinityModules.Forums.SpamProtection.Composition.csproj" | |
), | |
$buildSln = $false, | |
[alias("msbuildPath")] | |
$msbuild = "C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe", | |
[alias("msbuildOptions")] | |
$options = "/p:Configuration=Debug", | |
$properties = "Configuration=Debug" | |
) | |
Process | |
{ | |
$scriptPath = split-path $SCRIPT:MyInvocation.MyCommand.Path -parent | |
. (Join-Path $scriptPath "NuGetPackageGeneration.ps1") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!(Test-Path -path $outputDir)) {New-Item $outputDir -Type Directory} | |
if (!$slnDirectory) | |
{ | |
$scriptPath = split-path $SCRIPT:MyInvocation.MyCommand.Path -parent | |
$slnDirectory = (get-item $scriptPath).parent.FullName | |
} | |
"Parameters:" | |
"#slnName: " + $slnName | |
"#slnDirectory: " + $slnDirectory | |
"#outputDir: " + $outputDir | |
"#nugetProjects: " + $nugetProjects | |
"#msbuild: " + $msbuild | |
"#msbuildOptions: " + $options | |
"#buildSln: " + $buildSln | |
if($buildSln -eq $true) | |
{ | |
# create the build command and invoke it | |
$clean = $msbuild + " """+ $slnDirectory + "\"+ $slnName +""" "+ $options + " /t:Clean" | |
$build = $msbuild + " """+ $slnDirectory + "\"+ $slnName +""" "+ $options + " /t:Rebuild" | |
"Clean and Build " + $slnName | |
iex $clean | |
iex $build | |
} | |
foreach($nugetProject in $nugetProjects){ | |
$csprojFile = " """ + $slnDirectory + "\" + $nugetProject + """ " | |
$args = "pack" + $csprojFile + "-IncludeReferencedProjects -Verbosity detailed -OutputDirectory " + $outputDir + " -Properties " + $properties | |
$packCommand = """" + $scriptPath + "\nuget.exe" + """ " + $args | |
iex "& $packCommand" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment