Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
432 views
in Technique[技术] by (71.8m points)

c# - How to Reference Microsoft.VisualBasic in a .Net Standard Class Library?

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.

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.

Reference Manager Screen Shot

Solution Explorer

Using Statements & Implementation

Any help or suggestions would be greatly appreciated.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Add a NuGet package Microsoft.VisualBasic via NuGet Package Manager,

https://www.nuget.org/packages/Microsoft.VisualBasic/

Or simply modify the project file to add an equivalent PackageReference.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...