.net – Is it possible to use MSBuild Extension Pack without installation

msbuildnet

Is there a way to use the MSBuild Extension Pack with a "local" reference that doesn't require you to run the installer? In other words, can you store the targets in a solution items folder so that every developer doesn't have to install it?

Best Answer

You have to declare the property, ExtensionTasksPath, before the import statment for the tasks. For example take a look at:

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <ExtensionTasksPath Condition="'$(ExtensionTasksPath)' == ''">E:\Data\Development\My Code\Community\MSBuild\ExtensionPack\</ExtensionTasksPath>
  </PropertyGroup>

  <Import Project="$(ExtensionTasksPath)MSBuild.ExtensionPack.tasks"/>

  <Target Name="Demo">
    <MSBuild.ExtensionPack.FileSystem.File TaskAction="GetTempFileName">
      <Output TaskParameter="Path" PropertyName="TempPath"/>
    </MSBuild.ExtensionPack.FileSystem.File>

    <Message Text="TempPath: $(TempPath)" />
  </Target>

</Project>

The MSBuild Community tasks is similar but the property is named MSBuildCommunityTasksLib. I think for SDC tasks its called TasksPath.