Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions BuildAndPackage.ps1
Original file line number Diff line number Diff line change
@@ -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"
16 changes: 16 additions & 0 deletions NuSpec/CSharpEssentials.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<package >
<metadata>
<id>CSharpEssentials</id>
<version>1.0.5</version>
<authors>Dustin Campbell</authors>
<owners>Dustin Campbell</owners>
<licenseUrl>https://github.com/raw/DustinCampbell/CSharpEssentials/master/License.txt</licenseUrl>
<projectUrl>http://github.com/DustinCampbell/CSharpEssentials</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>C# Essentials is a collection of Roslyn diagnostic analyzers, code fixes and refactorings that make it easy to work with C# language features.</description>
<copyright>Copyright 2015 by Dustin Campbell</copyright>
<language>en-US</language>
<tags>refactoring productivity C# refactor roslyn essentials</tags>
</metadata>
</package>
6 changes: 6 additions & 0 deletions NuSpec/install.ps1
Original file line number Diff line number Diff line change
@@ -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")
6 changes: 6 additions & 0 deletions NuSpec/uninstall.ps1
Original file line number Diff line number Diff line change
@@ -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")