问题描述
我试图在 .Net Standard 2.0 类库(特别是 Financial.Rate
函数)中使用 Microsoft.VisualBasic
命名空间中的一些静态类.) 这是一个 C# 项目,该库包含各种财务函数和计算.我知道仅仅添加 using Microsoft.VisualBasic;
是不够的,因为我需要引用实际的 dll.但我不确定如何在 .net 标准类库中执行此操作.
I am attempting to utilize some of the static classes in the Microsoft.VisualBasic
name space in a .Net Standard 2.0 Class library (the Financial.Rate
function specifically.) This is a C# project and the library contains various financial functions and calculations. I know that simply adding the using Microsoft.VisualBasic;
is not enough since I need to reference the actual dll. But I am not sure how to do this in a .net Standard Class library.
我已尝试将 NuGet 包 Microsoft.VisualBasic
添加到库中,但这不允许我访问所需的静态类.我对 .Net 比较陌生,所以我对如何正确引用程序集感到困惑.我能找到的所有示例都涉及一些较旧的 .net Framework 库,而不是 .net Standard.下面是参考管理器屏幕截图的链接,解决方案资源管理器和 using 语句如下所示.
I have tried adding the NuGet Package Microsoft.VisualBasic
to the library but that would not allow me to access the static classes that I need. I am rather new to .Net so I am confused about how to properly reference the assembly. All examples that I can find involve some of the older .net Framework libraries and not .net Standard. Below is a link to a screen shot of the reference manager, Solution Explorer and using statements are shown below.
任何帮助或建议将不胜感激.
Any help or suggestions would be greatly appreciated.
推荐答案
通过 NuGet 包管理器添加 NuGet 包 Microsoft.VisualBasic
,
Add a NuGet package Microsoft.VisualBasic
via NuGet Package Manager,
https://www.nuget.org/packages/Microsoft.VisualBasic/
或者简单地修改项目文件以添加等效的PackageReference
.
Or simply modify the project file to add an equivalent PackageReference
.
这篇关于如何在 .Net 标准类库中引用 Microsoft.VisualBasic?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!