通过 NuGet 包安装包和 vs2015 中 'Tools' 菜单中的 'extentions and updates' 选项有什么区别?

Whats the difference between installing a package via NuGet packages and the 'extentions and updates' option from the 'Tools' menu in vs2015?

我使用 specflow 创建了一个项目,所以我将一个新的功能文件保存为 class 库项目,当我尝试 运行 该项目时,我收到错误:'A project with an Output Type of Class Library cannot be started directly. In order to debug this project, add an executable project to this solution which references the library project. Set the executable project as the startup project'

我认为我向项目添加 n-unit 和 specflow 引用的方式有误。我注意到我可以通过 NuGet 包或扩展和更新来安装 specflow。那么这两种方式加包有什么区别呢?

它们是两个不同的东西。

Specflow 扩展扩展了 visual studio ide 以支持 specflow。具体来说:

  • 它添加了对 gherkin 语法的语法高亮支持
  • 它允许从 .feature 文件生成测试
  • 它将文件模板添加到文件类型中,以便您可以添加新功能 files/step 绑定
  • 它添加了额外的上下文菜单选项以允许生成步骤以及在功能文件中的步骤和代码中的步骤之间导航。
  • 它允许与 visual studio 单元测试集成 windows

可能还有一些我忘记提及的事情。如果不在 visual studio 中编写 specflow 测试将会更加困难,并且单元测试用例本身的生成将无法完成。

nuget 包允许单个项目使用 specflow。这会向项目添加必要的引用,以便您可以使用 specflow 使用的类型。如果不引用这些,尝试使用 specflow 的项目将无法编译。

至于您的问题,这与 specflow 没有任何关系。无法启动构建 dll 的项目,它需要托管一些东西才能使用任何库项目,如果将其设置为启动项目,无论是否使用 specflow 都会出现此错误。