c a n d l a n d . n e t

Ensure Spark Views Are Marked As Content With Powershell

Dusty Candland | |

I kept publishing a website project only to find each time a couple of spark files didn’t make it because they were not set as content in the cs project file. In order to limit the wasted time, I added the code below to the build script.

Below I’m using the following to grab the project file as xml. Then foreach (|%) None element in Item group elements. Where (|?) the Include attribute is a spark file, add to the $notset collection. If any, then list and throw to stop the build. This was just added as a psake task. BTW, I’m really loving psake, you should really check it out if you need a build script on windows, for anything.

$basedir = Resolve-Path .
$proj = [xml] (get-content "$basedir\src\website\website.csproj")
$notset = $proj.Project.ItemGroup |% {$.None} |? {$.Include -like "*.spark"}

if ($notset.Count -gt 0) {
  $notset; throw "The above Spark files not set to content."
}

Webmentions

These are webmentions via the IndieWeb and webmention.io. Mention this post from your site: