9

I'm using some custom tasks from MSBuild Extension Pack (MEP). My projects are splitted among many files. In those files I import the MEP tasks using (twice or three times in two/three files). I receive the warning message when doing this like:

... warning MSB4011: "C:\Program Files\MSBuild\ExtensionPack\MSBuild.ExtensionPack.tasks" cannot be imported again. It was already imported at "D:...\Tasker.proj (5,3)". This is most likely a build authoring error. This subsequent import will be ignored.

Does anyone know how to get rid of this warning message? Please help!

Nam G VU
  • 33,193
  • 69
  • 233
  • 372

3 Answers3

12

The work-around of this question would be: Calling the import with condition to check the existence of a unique property defined in the considering project file. Hope this helps!

Nam G VU
  • 33,193
  • 69
  • 233
  • 372
  • 9
    Just to add a comment with a code snippet from where this question was asked elsewhere: `` where `Tasks.targets` has in it `true` – Chris Nov 13 '13 at 09:37
  • 2
    And if I really want to include smth twice? With different parameters maybe. C++ folks would do this a lot. – hypersw Mar 05 '14 at 19:11
  • 1
    Conditions also are not re-eavaluated when running build in VS: https://msdn.microsoft.com/en-us/library/92x05xfs.aspx – Ivan Oct 13 '17 at 09:23
0

That warning has happened to me when I have built my application from VS IDE and by MSBuild tool in parallel. I guess the same might happen when you work with more than one VS window on the same project

alrod999
  • 11
  • 1
-1

Delete the automatically generated file yourproject.nuget.props and the warning will go away.

Matti-Koopa
  • 258
  • 4
  • 7