Search code examples
c#msbuildnugetmsbuild-4.0msbuildextensionpack

MS Build Extension Pack with nuget fails to get MSBuild.ExtensionPack.tasks


I'm trying to install MS Build Extension Pack in order to use the compression task.

I followed the instruction in the nuget web site --

i.e. I executed Install-Package MSBuild.Extension.Pack in the Package Manager Console.

It created the MSBuild.Extension.Pack.1.8.0 folder in my project's packages folder.

I used the example given in the official help site: msbuild extension pack web site and integrated it into my csproj file.

But I'm getting this error:

error MSB4019: The imported project "C:\Program Files (x86)\Jenkins\jobs\ABBYY-OCR\workspace\packages\MSBuild.Extension.Pack.1.8.0\tools\net40\MSBuild.ExtensionPack.tasks" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

Indeed the path C:\Program Files (x86)\Jenkins\jobs\ABBYY-OCR\workspace\packages\MSBuild.Extension.Pack.1.8.0\tools\net40 exists, but MSBuild.ExtensionPack.tasks does not (This is so both on the build server and on my machine), though the folder contains other files (mainly dll files).

Nuget seems to have downloaded only the Binaries folder.


Solution

  • You need to import the file MSBuild.Extension.Pack.targets in the build directory. It is the same as the .tasks file.

    This should work:

    <Import Project="..\packages\MSBuild.Extension.Pack.1.8.0\build\net40\MSBuild.Extension.Pack.targets"/>