1

I am trying to use MSBuildExtensionPack and read that I have to import the project by using:

$(MSBuildProjectDirectory)..\MSBuild.ExtensionPack.tasks $(MSBuildProjectDirectory)....\Common\MSBuild.ExtensionPack.tasks

It should not be necessary for you to include the above type of import in your usage of the tasks. If you have used the default installation path, simply use the following imports:

3.5 --- 4.0 ---

I have not installed the extension pack on the build server, rather I have copied the DLL into a specifc location and trying to access it by following code:

After trigerring the build using TeamCity, I get following error:

error MSB4019: The imported project "C:\Apps\Teamcity\buildAgent 1\work\vb82348r312dsd33\thirdparty\tools\MsBuildExtensions" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.

If I look into the build machine, I can find the folder and all the files in it. Not sure why I am getting this error.

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
         ToolsVersion="4.0"
         DefaultTargets="StopIT">

 <Import Project=".\thirdparty\tools\MsBuildExtensions"/>

<Target Name="StopIT">
        <MSBuild.ExtensionPack.Computer.WindowsService TaskAction="Stop" ServiceName="AppServices"  MachineName="MyMachineName"/>
  </Target>
</Project>

Please provide your suggestion

SharpCoder
  • 18,279
  • 43
  • 153
  • 249
  • Could you please provide the import step? From the error message it looks like you refer to a folder and not to the .tasks file as it would be necessary – MikeR May 31 '13 at 08:29
  • @MikeR: Thank you for the reply. i have added the build file. I am trying to stop a service by name AppServices on a remaote machine. – SharpCoder May 31 '13 at 08:43

1 Answers1

1

You need to change your import from

<Import Project=".\thirdparty\tools\MsBuildExtensions"/>

to

<Import Project=".\thirdparty\tools\MsBuildExtensions\MSBuild.ExtensionPack.tasks"/>

It is not enough to name the folder, you have to name every file (.proj, .target, .tasks) that should be imported, in your case the MSBuild.ExtensionPack.tasks

The tasks file contains some kind of mapping between task names and the assembly where to find them.

MikeR
  • 3,045
  • 25
  • 32