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=, 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?


  • Hmm, odd...

    This works in C#:

    public async Task GoAsync()
      ArmClient armClient = new ArmClient(new DefaultAzureCredential());
      var subscription = await armClient.GetDefaultSubscriptionAsync();
      string rgName = "myRgName";
      ResourceGroupResource resourceGroup = await subscription.GetResourceGroups().GetAsync(rgName);
      DnsZoneCollection dnsZoneCollection = resourceGroup.GetDnsZones();
      AsyncPageable<DnsZoneResource> response = dnsZoneCollection.GetAllAsync();

    ....but this doesn't work in VB.NET:

    Public Async Function GoAsync As Task
      Dim armClient As ArmClient = New ArmClient(New DefaultAzureCredential)
      Dim subscription As SubscriptionResource = Await armClient.GetDefaultSubscriptionAsync
      Dim rgName As String = "myRgName"
      Dim resourceGroup As ResourceGroupResource = Await subscription.GetResourceGroups.GetAsync(rgName)
      Dim dnsZoneCollection As DnsZoneCollection = resourceGroup.GetDnsZones
      Dim response As AsyncPageable(Of DnsZoneResource) = dnsZoneCollection.GetAllAsync
    End Function

    An exact conversion.

    Funny, that.

  • 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.

  • @stephensmitchell
    That works, thanks. I added the netstandard reference and the code compiled.

    Once I set Automatically add missing references to True in my Preferences, I didn't need to explicitly add the reference for new projects.

    FYI I'll be upgrading soon... just not quite yet.

Sign In or Register to comment.