diff --git a/BuildAndPackage.ps1 b/BuildAndPackage.ps1 new file mode 100644 index 0000000..e43e648 --- /dev/null +++ b/BuildAndPackage.ps1 @@ -0,0 +1,57 @@ +$CurrentPath = $(Get-Location) +$NuSpecPath = Join-Path $CurrentPath "NuSpec" +$BinariesPath = Join-Path $CurrentPath "Binaries\Release" +$PackagePath = Join-Path $BinariesPath "Package" +$ToolsPath = Join-Path $PackagePath "tools" +$AnalyzersPath = Join-Path $ToolsPath "analyzers" +$NuGet = Join-Path $CurrentPath "Tools\NuGet\NuGet.exe" +$Solution = Join-Path $CurrentPath "CSharpEssentials.sln" +$NuSpec = Join-Path $NuSpecPath "CSharpEssentials.nuspec" +$DllName = "CSharpEssentials.dll" +$DllPath = Join-Path $BinariesPath "CSharpEssentials" +$DllPath = Join-Path $DllPath $DllName + +# Perform NuGet package restore +Invoke-Expression "$NuGet restore $Solution" +"" + +# Build solution with MSBuild in Release +Invoke-Expression "msbuild.exe /m $Solution /p:Configuration=Release" +"" + +# Create the package path. If it already exists, delete the old package path first. +"Preparing files for packaging..." + +if ((Test-Path $PackagePath) -eq $True) +{ + Remove-Item -Recurse -Force $PackagePath +} + +New-Item $PackagePath -Type Directory | Out-Null + +" * Created `"Package`" directory" + +New-Item $ToolsPath -Type Directory | Out-Null + +" * Created `"tools`" directory" + +New-Item $AnalyzersPath -Type Directory | Out-Null + +" * Created `"tools\analyzers`" directory" + +Copy-Item -Path $DllPath -Destination (Join-Path $AnalyzersPath $DllName) + +" * Copied `"$DllName`" to `"tools\analyzers`" directory" + +Copy-Item -Path (Join-Path $NuSpecPath "install.ps1") -Destination (Join-Path $ToolsPath "install.ps1") + +" * Copied `"install.ps1`" to `"tools`" directory" + +Copy-Item -Path (Join-Path $NuSpecPath "uninstall.ps1") -Destination (Join-Path $ToolsPath "uninstall.ps1") + +" * Copied `"uninstall.ps1`" to `"tools`" directory" + +"" + +# Package NuGet +Invoke-Expression "$NuGet pack $NuSpec -BasePath $PackagePath -OutputDirectory $PackagePath" \ No newline at end of file diff --git a/NuSpec/CSharpEssentials.nuspec b/NuSpec/CSharpEssentials.nuspec new file mode 100644 index 0000000..698d744 --- /dev/null +++ b/NuSpec/CSharpEssentials.nuspec @@ -0,0 +1,16 @@ + + + + CSharpEssentials + 1.0.5 + Dustin Campbell + Dustin Campbell + https://raw.githubusercontent.com/DustinCampbell/CSharpEssentials/master/License.txt + http://github.com/DustinCampbell/CSharpEssentials + false + C# Essentials is a collection of Roslyn diagnostic analyzers, code fixes and refactorings that make it easy to work with C# language features. + Copyright 2015 by Dustin Campbell + en-US + refactoring productivity C# refactor roslyn essentials + + \ No newline at end of file diff --git a/NuSpec/install.ps1 b/NuSpec/install.ps1 new file mode 100644 index 0000000..efb48d5 --- /dev/null +++ b/NuSpec/install.ps1 @@ -0,0 +1,6 @@ +param($installPath, $toolsPath, $package, $project) + +$analyzerPath = join-path $toolsPath "analyzers" +$analyzerFilePath = join-path $analyzerPath "CSharpEssentials.dll" + +$project.Object.AnalyzerReferences.Add("$analyzerFilePath") \ No newline at end of file diff --git a/NuSpec/uninstall.ps1 b/NuSpec/uninstall.ps1 new file mode 100644 index 0000000..e34e44d --- /dev/null +++ b/NuSpec/uninstall.ps1 @@ -0,0 +1,6 @@ +param($installPath, $toolsPath, $package, $project) + +$analyzerPath = join-path $toolsPath "analyzers" +$analyzerFilePath = join-path $analyzerPath "CSharpEssentials.dll" + +$project.Object.AnalyzerReferences.Remove("$analyzerFilePath") \ No newline at end of file