开发者

MSBuild project won't load if Import fails?

开发者 https://www.devze.com 2023-02-14 14:58 出处:网络
I created a build target in a project file (App.Tests.csproj) that imports a project: <Import Project =\"$(Location)\\Special.Tasks\"/>

I created a build target in a project file (App.Tests.csproj) that imports a project:

 <Import Project ="$(Location)\Special.Tasks"/>

These tasks only exist on our build server, that location does not exist on our developers work station. The build target will ever only be run from the build server.

My problem is that when I try to open the sln (containing the project with the build target) on a workstation without the Special.Tasks the project won't load.

I don't want to distribute the Special.Tasks to each wor开发者_运维问答kstation.

Is there any way to tell MSBuild or Visual Studio to load even if an import fails?


Just add condition to the Import target

<Import Project ="$(Location)\Special.Tasks"
        Condition="Exists('$(Location)\Special.Tasks')"/>
0

精彩评论

暂无评论...
验证码 换一张
取 消