Unicorn.MSBuild 1.0.0

dotnet add package Unicorn.MSBuild --version 1.0.0                
NuGet\Install-Package Unicorn.MSBuild -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Unicorn.MSBuild" Version="1.0.0">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Unicorn.MSBuild --version 1.0.0                
#r "nuget: Unicorn.MSBuild, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Unicorn.MSBuild as a Cake Addin
#addin nuget:?package=Unicorn.MSBuild&version=1.0.0

// Install Unicorn.MSBuild as a Cake Tool
#tool nuget:?package=Unicorn.MSBuild&version=1.0.0                

Unicorn.MSBuild

The extension adds SyncUnicorn target to your project that can be used by MSBuild.

Installation

Install the Unicorn.MSBuild NuGet package in the web root project.

Configuration

Add <ProjectName>.wpp.targets file to your project's directory with the following content:

<Project>
    <PropertyGroup>
        <UnicornControlPanelUrl>https://habitat.sc/unicorn.aspxa</UnicornControlPanelUrl>
        <UnicornSharedSecret>zUcdjtAKn21fEXIqFnrSzUcdjtAKn21fEXIqFnrSzUcdjtAKn21fEXIqFnrS</UnicornSharedSecret>
    </PropertyGroup>
</Project>

For example, if your project file is Website.csproj, create Website.wpp.targets file in the same directory and put the above content into the file. The Website.wpp.targets file will be loaded by msbuild automatically.

Usage

Visual Studio Extension

The easiest way to execute SyncUnicorn target is by installing Sync Unicorn extension. The extension adds Sync Unicorn button to Build menu and to right click context menu of your project.

Command line

You can also execute SyncUnicorn target from command line:

msbuild Website.csproj /t:SyncUnicorn /p:UnicornControlPanelUrl=https://habitat.sc/unicorn.aspx /p:UnicornSharedSecret=zUcdjtAKn21fEXIqFnrSzUcdjtAKn21fEXIqFnrSzUcdjtAKn21fEXIqFnrS

SyncUnicorn target requires two parameters: UnicornControlPanelUrl and UnicornSharedSecret. You can pass them directly in command line or use Website.wpp.targets file decribed above.

Visual Studio external tool

To add a new menu button without installing extension, go to Visual Studio, click Tools and select External Tools. Add a new external tool with following parameters:

  • Title: Sync Unicorn
  • Command: Path to msbuild.exe for example: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe
  • Arguments: The same arguments you add in command line, but in the following example we stored url and secret in publish profile $(ProjectFileName) /t:SyncUnicorn /p:PublishProfile=FileSystem
  • Initial Directory: $(ProjectDir)

Now you can select your Webroot project in Solution Explorer and go to Tools->Sync Unicorn

Build

To build nuget package you can use following command:

nuget.exe pack Unicorn.MSBuild.csproj -properties Configuration=Release -Tool

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 16,108 9/12/2018
1.0.0-beta 652 9/7/2018

SyncUnicorn target added for msbuild.