【发布时间】:2017-12-18 22:42:57
【问题描述】:
我有一个项目 A 的设置,它是 NetStandard 库项目。另一个项目 A.Frame 是带有通用类文件 Class1.cs 的 Net Framework Library 项目(Class1.cs 是两个项目中的链接文件)。 Class1.cs 有一个函数 FooA(),如果项目类型是 Netstandard,则返回“Netstandard”,如果项目类型是 NetFramework,则返回“NetFramework”。同一解决方案项目 B 中的另一个项目有一个函数 FooB(),它调用函数 FooA() 并返回结果。
我已经将整个设置打包在一个 Nuget 包中,这样 Bait 和 Switch 将允许 Netstandard 和 NetFramework 使用它们各自的 dll。
现在我在不同解决方案的不同项目中使用 Nuget 包,例如解决方案 B 的项目 C。项目 C 是一个 NetStandard 库项目,其函数 Bar() 从项目 B 调用函数 FooB()。当我尝试测试时这在使用项目 C 的项目依赖项的单元测试项目上我得到System.IO.FileNotFoundException: 'Could not load file or assembly 'ProjectB, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
当我在 NetFramework 库上使用 Nuget 包时,我得到了所需的输出。 有什么我遗漏的或者我需要对我的 Nuget 包设置做些什么。
【问题讨论】: