我有一个基于SpecFlow的测试项目。有时会出现这样的问题:工作源代码(在其他计算机和构建服务器上工作)无法在Visual 2015中加载解决方案资源管理器中的信息load failed,并在输出控制台上显示以下错误消息:
C:\Project\Tests.csproj : error : The imported project "C:\Project\packages\SpecFlow.2.1.0\tools\TechTalk.SpecFlow.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. C:\Project\Tests.csproj
项目用途:
发布于 2016-12-08 16:44:46
结果发现它是项目文件(csproj)的一个问题。它是用TechTalk.SpecFlow.targets手动扩展的,如下所示:
<Import Project="..\packages\SpecFlow.2.1.0\tools\TechTalk.SpecFlow.targets" />但是当目录被清理(例如,用git重置硬)时,没有包,所以无法加载项目来执行nuget还原。
解决方案是将Import扩展为一个条件Exists。
<Import Project="..\packages\SpecFlow.2.1.0\tools\TechTalk.SpecFlow.targets"
Condition="Exists('..\packages\SpecFlow.2.1.0\tools\TechTalk.SpecFlow.targets')" />https://stackoverflow.com/questions/41044571
复制相似问题