SwapTasks 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package SwapTasks --version 1.0.0                
NuGet\Install-Package SwapTasks -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="SwapTasks" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SwapTasks --version 1.0.0                
#r "nuget: SwapTasks, 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 SwapTasks as a Cake Addin
#addin nuget:?package=SwapTasks&version=1.0.0

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

SwapTasks

MSBuild Custom Tasks for .NETCore

Supported Platform

  • .NETStandard 2.0
  • .NET Framework (FullClr)

Current Tasks

SwapFile

Description

Swap file with source and destination.

Example
  <Target Name="SwapTask" BeforeTargets="Build">
    <SwapFile Trigger="$(Trigger)" Fallback="Development" Configuration="$(Configuration)" FileName="app" Extension="config" SourceDir="$(MSBuildThisFileDirectory)" DestinationDir="$(MSBuildThisFileDirectory)" />
  </Target>
Equivalent
    <Target Name="SwapTask">
      <PropertyGroup>
        <CopyConfigMessage>Trigger build parameter missing! Skipping $(SwapFileName).$(SwapExtension) swap task.</CopyConfigMessage>
        <CopyConfigDestination>$([System.IO.Path]::Combine($(SwapDestinationDir), $(SwapFileName).$(SwapExtension)))</CopyConfigDestination>
      </PropertyGroup>
      <PropertyGroup Condition="'$(Trigger)' != '' AND Exists('$(MSBuildThisFileDirectory)$(SwapFileName).$(Trigger).$(SwapExtension)')">
        
        <CopyConfigMessage>Detected Trigger parameter, Copy $(SwapFileName).$(Trigger).$(SwapExtension) to $(SwapFileName).$(SwapExtension)</CopyConfigMessage>
        <CopyConfigSource>$(MSBuildThisFileDirectory)$(SwapFileName).$(Trigger).$(SwapExtension)</CopyConfigSource>
      </PropertyGroup>
      <PropertyGroup Condition="'$(Trigger)' != '' AND !Exists('$(MSBuildThisFileDirectory)$(SwapFileName).$(Trigger).$(SwapExtension)')">
        
        <Fallback>Development</Fallback>
        <CopyConfigMessage>Detected Trigger parameter, $(SwapFileName).$(Trigger).$(SwapExtension) missing! Copy $(SwapFileName).$(Fallback).$(SwapExtension) to $(SwapFileName).$(SwapExtension)</CopyConfigMessage>
        <CopyConfigSource>$(MSBuildThisFileDirectory)$(SwapFileName).$(Fallback).$(SwapExtension)</CopyConfigSource>
      </PropertyGroup>
      <PropertyGroup Condition="'$(Trigger)' == '' AND Exists('$(MSBuildThisFileDirectory)$(SwapFileName).$(Configuration).$(SwapExtension)')">
        
        <CopyConfigMessage>Missing Trigger parameter! Copy $(SwapFileName).$(Configuration).$(SwapExtension) to $(SwapFileName).$(SwapExtension)</CopyConfigMessage>
        <CopyConfigSource>$(MSBuildThisFileDirectory)$(SwapFileName).$(Configuration).$(SwapExtension)</CopyConfigSource>
      </PropertyGroup>
      <Message Importance="High" Text="@SwapConfig@ [$(SwapFileName).$(SwapExtension)] $(CopyConfigMessage)" />
      <Message Importance="High" Text="* CopyConfigSource           : $(CopyConfigSource)" />
      <Message Importance="High" Text="* CopyConfigDestination      : $(CopyConfigDestination)" />
      <Copy SourceFiles="$(CopyConfigSource)" DestinationFiles="$(CopyConfigDestination)" />
    </Target>

CleanPublishArtifact

clean publish directory for dotnet publish.

Example
  <Target Name="CleanPublish" AfterTargets="Build">
    <CleanPublishArtifact MSBuildThisFileDirectory="$(MSBuildThisFileDirectory)" PublishDir="$(PublishDir)"/>
  </Target>
Equivalent
    
    <Target Name="CleanPublishArtifact">
      <PropertyGroup>
        <CleanMessage>Clean up publish path before new publish execute.</CleanMessage>
        <CleanPath>$([System.IO.Path]::Combine($(MSBuildThisFileDirectory),$(PublishDir)))</CleanPath>
      </PropertyGroup>
      <Message Importance="High" Text="@CleanPublishArtifact@ $(CleanMessage)" />
      <Message Importance="High" Text="CleanPath : $(CleanPath)" />
      <RemoveDir Directories="$(CleanPath)" />
    </Target>

LICENSE

The MIT License (MIT)

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETFramework 4.7

    • No dependencies.
  • .NETStandard 2.0

    • 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.1.30 859 8/20/2018
1.0.0 1,003 2/18/2018

Initial release.