Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 712
Barak BN Avatar asked Jan 07 '16 08:01

Barak BN


People also ask

What is MSBuild Extension Pack?

The MSBuild Extension Pack provides a collection of over 480 MSBuild Tasks, MSBuild Loggers and MSBuild TaskFactories.


2 Answers

This method worked for me:

  1. Open Visual Studio as Admin
  2. Create a new project
  3. Import these dependences from nuget in this new project: MSBuild.Extension.Pack and MSBuild.ExtensionPack.Task
  4. After import these dependences, get all files from packages\MSBuild.ExtensionPack.Task.1.0.3\tools folder and copy to path C:\Program Files (x86)\Microsoft Visual Studio\2019\Profession\MSBuild\ExtensionPack\4.0. If this folder doesn't exists, you must create.
  5. After, copy the entire packages\MSBuild.Extension.Pack.1.9.1\tools folder to C:\Program Files (x86)\Microsoft Visual Studio\2019\Profession\MSBuild path
  6. Close and reopen your project in Visual Studio.
like image 76
Rafael Cabral Avatar answered Sep 28 '22 06:09

Rafael Cabral


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"/>
like image 22
Fabian Avatar answered Sep 28 '22 08:09

Fabian