Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 840
Luke Bethay Avatar asked Feb 21 '18 03:02

Luke Bethay


People also ask

How do I add a reference to Microsoft VisualBasic DLL?

Right click your References in the Solution Explorer click Add Reference ,then search for Microsoft. VisualBasic and add it to your references.

Can I reference .NET framework from .NET standard?

NET standard, being a specification, is like an interface. Whenever you add a reference to a . NET standard library, as long as the reference meets the specification definition, then the library doesn't care what type it is. Implementation is separate from specification.

How do you cite a library in C#?

To use the library, you would have to reference the library. To do this: On the Menu bar, you would click Project -> Add Reference or In the Solution Explorer, you would right-click References and click Add Reference. You can click the Browse tab, locate the folder where the library resides and select it.

Can I use .NET standard library in .NET framework?

NET Standard 2.0. . NET Standard 2.0 is supported by all modern platforms and is the recommended way to support multiple platforms with one target.


1 Answers

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.

like image 127
Lex Li Avatar answered Oct 11 '22 20:10

Lex Li