Consuming preview builds of xSharePoint through PowerShellGet

PowerShellGet is a new module that is installed as part of PowerShell 5 (in Windows Management Framework 5.0) which allows you to easily connect to remote repositories to install PowerShell modules from. When you install WMF5 you'll get a repository configured to point to the PowerShell Gallery, where you can download the release versions of all of the PowerShell teamsĀ  DSC resources. However if you want to use the preview (in development but not yet released) builds, you have the option to connect to a secondary repository where the dev builds are created and install those directly to your machine.

Where are the dev builds for xSharePoint?

All of the DSC resources that are published by the PowerShell team on GitHub make use of AppVeyor to do the automated testing and build of the modules. For example, you can see the latest artifacts that have been built at https://ci.appveyor.com/project/PowerShell/xsharepoint/build/artifacts. AppVeyor can also publish these as a Nuget feed, which has been configured for xSharePoint, with the feed URL being https://ci.appveyor.com/nuget/xsharepoint.

Adding a new repository to your local machine

To consume the preview builds we need to first connect the local machine with WMF5 installed on it to our remote repository. That can easily be done through using the Register-PSRepository cmdlet. Once the repository has been added you can easily request a list of the versions that are available there using the Find-Module cmdlet. Here you can see I've requested all the available versions, but only want it to show the latest 10 versions it has found (keeping in mind that the preview branch here has many versions in it, so looking at the full list may be 100 or so, potentially more, versions).

The specific command that is being used here to register the repository is:

 Register-PSRepository -Name xSharePointDev -SourceLocation https://ci.appveyor.com/nuget/xsharepoint

The repository name can be whatever you like, you use this to uniquely identify the source. The URL though is the Nuget feed URL we mentioned earlier.

Installing from the preview build feed

Installing a specific version from the preview feed is very straightforward. After using the Find-Module cmdlet you can pipe a specific version to Install-Module to tell PowerShell to download and install that version. Below you can see the installation, and then I verify the version that is installed with Get-Module.

Updating to a newer version

After you have installed a specific version, you can install a new version in exactly the same way as when you installed the previous version. If you don't specify a version it will automatically get the latest build available. Here you can see the upgrade taking place, noting that if you do not use the "-Force" switch on the install cmdlet you will be presented an error. Once you do this you will now have two versions installed, the latest version as well as the previously installed version.

That's all there is to it! Now the same processes can be used if you want to stick to the released versions instead of the developer builds, you just don't need to connect to the custom repository as the PowerShell gallery has these builds and that is automatically configured. But if you want the latest and greatest which may come with a few bugs from time to time, then you can use this to get these builds just as easily.

As always, for more information about xSharePoint or to raise issues or changes with it head over to the xSharePoint repository on GitHub.