How to get import custom tasks more than once without warning message?

旧巷老猫 提交于 2019-12-08 16:10:31

问题


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!


回答1:


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!




回答2:


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




回答3:


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



来源:https://stackoverflow.com/questions/2544926/how-to-get-import-custom-tasks-more-than-once-without-warning-message

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!