Introducing CoolWhip

CoolWhip is a NuGet package aimed at making and deploying other NuGet packages easier. With CoolWhip, creating a Release in GitHub automatically pushes that release to NuGet.

GitGet

Once you’ve installed CoolWhip into your project it will create a nuspec file and AppVeyor configuration file.  These will work together to package your project and automatically upload it to NuGet.org.

Once setup, all you need to do to update your package on NuGet.org is create a release in GitHub.  CoolWhip will pull the version information directly from the release name and kick off a build in AppVeryor.  You have complete control over versioning your application.

To configure CoolWhip you need to

  1. Connect AppVeyor to your GitHub repo
  2. Install the NuGet package >Install-Package CoolWhip
  3. Update the generated nuspec file with your project’s information
  4. Add your authorization tokens to the AppVeyor.yml file
  5. Save/commit your changes

Once this is set up, all you’ll need to do in order to release (or update) your package on NuGet is create a GitHub release with the version number.

There is full step by step documentation in the wiki.

Happy Coding.

 

Source on GitHub

Package on NuGet

Treat Warnings as Errors In TeamCity

I’m OCD when it comes to my code.  I don’t like to have any warnings.  I wanted to configure my TeamCity builds to fail if there were any warnings in the projects. My first option is to tick the “Treat warnings as errors” box in the project settings.  This had a few problems

Problem 1.

I’d have to remember to do it for every project in my repo, including all the projects I make in the future.  Even worse, everyone on my team would have to remember to do that too.  That’s not something I could rely on.

Problem 2. 

While warnings are just errors that you’re ignoring, I will admit that it is convenient to be able to ignore some things some times.  I’m fine with debugging and running locally with some errors.  I really only wanted to stop people from committing code back to master with warnings.  I couldn’t care less about bad hygiene the have when working locally.

The Solution

In searching, I found David Gardiner’s blog post in which he creates a power shell script to edit the xml in each csproj file.  It looks simple enough so I removed the TFS bit and added it as a build step in my TeamCity flow. It runs right before compiling my code.

TreatWarningsAsErrors

Get-ChildItem -Recurse -Filter "*.*csproj" | % {
    Write-Host $_.Name
    
    $filename = $_.Fullname
    
    $proj =
( Get-Content $_.Fullname ) $xmlNameSpace = new-object System.Xml.XmlNamespaceManager($proj.NameTable) $xmlNameSpace.AddNamespace("p", "http://schemas.microsoft.com/developer/msbuild/2003") $nodes = $proj.SelectNodes("/p:Project/p:PropertyGroup[@Condition and not (p:TreatWarningsAsErrors)]", $xmlNameSpace) $touched = $false $nodes | ForEach-Object -Process { $e = $proj.CreateElement("TreatWarningsAsErrors", "http://schemas.microsoft.com/developer/msbuild/2003") $e.set_InnerText("true") $_.AppendChild($e) | Out-Null $touched = $true } if ($touched) { Write-Host "Checkout $filename" $proj.Save("$($filename)") | Out-Null } }