Need NetStandard 2.0 reference in LinqPad v5
I'm trying to use the
Azure.ResourceManager.Dns SDK (NuGet package) and I'm getting this error:
BC30652 Reference required to assembly 'netstandard, Version=126.96.36.199, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' containing the type 'Object'. Add one to your project.
I'm using the sample code found here; the precompiler error shows up on the
armClient call here:
Dim subscription As SubscriptionResource = Await armClient.GetDefaultSubscriptionAsync()
Am I going to be able to do this without upgrading to v7?
The following query works for me in LINQPad 5:
This works in C#:
....but this doesn't work in VB.NET:
An exact conversion.
Could this be a bug?
This is a common problem related to how VB and C# differ underneath. The other side is LINQPad and how it loads assemblies and from where.
You need to add this for VB to work:
Not the case in C#.
FYI, these settings may need adjusting it some cases, to fix other issues when working with VB.
@InteXX - yes, there's a bug - LINQPad 5 is designed to automatically reference netstandard when required, but this doesn't work with VB. There will be a fix in the next build. In the meantime, adding an explicit reference to netstandard.dll, as stephensmitchell suggests, should be a valid workaround.
@JoeAlbahari it does automatically reference the library in VB, I never add it manually.
That works, thanks. I added the netstandard reference and the code compiled.
Once I set
Automatically add missing referencesto
Truein my Preferences, I didn't need to explicitly add the reference for new projects.
FYI I'll be upgrading soon... just not quite yet.