title: Could not load file or assembly 'Microsoft.ReportViewer.WinForms .net core calling framework vb
body: <p>I have the following code working in VB framework 4.7.2</p>
  <pre><code>Using adapter As SqlDataAdapter = New SqlDataAdapter(cmd)
      Dim ds As DataSet = New DataSet()
      adapter.Fill(ds, TableName)
      Dim rds As ReportDataSource = New ReportDataSource(&quot;DataSource1&quot;, ds.Tables(TableName))  
      Dim local As LocalReport = New Microsoft.Reporting.WinForms.LocalReport()
      local.ReportPath = reportFilename
      ' needed for pics
      local.EnableExternalImages = True
      local.DataSources.Add(rds)
      Dim warnings As Warning() = Nothing
      Dim streamids As String() = Nothing
      Dim mimeType As String = Nothing
      Dim encoding As String = Nothing
      Dim extension As String = Nothing
      Dim bytes As Byte()
      bytes = local.Render(RenderType, Nothing, mimeType, encoding, extension, streamids, warnings)
      If My.Computer.FileSystem.FileExists(outputFilename) Then
          My.Computer.FileSystem.DeleteFile(outputFilename)
      End If
      File.WriteAllBytes(outputFilename, bytes)
      Return bytes.Length
  End Using
  </code></pre>
  <p>The project has package references</p>
  <pre><code>  &lt;ItemGroup&gt;
      &lt;PackageReference Include=&quot;Microsoft.Report.Viewer&quot;&gt;
        &lt;Version&gt;11.0.0&lt;/Version&gt;
      &lt;/PackageReference&gt;
      &lt;PackageReference Include=&quot;Microsoft.ReportViewer.WinForms.VS2010&quot;&gt;
        &lt;Version&gt;10.0.40219.1&lt;/Version&gt;
      &lt;/PackageReference&gt;
    &lt;/ItemGroup&gt;
  </code></pre>
  <p>This works fine in a library called from .net framework 4.7.2
  However if I call the library from a .net core 6 library I get the following error.</p>
  <blockquote>
  <p>Could not load file or assembly 'Microsoft.ReportViewer.WinForms,
  Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
  The system cannot find the file specified</p>
  </blockquote>
  <p>The same relevant files are present, in particular</p>
  <pre><code>Microsoft.ReportViewer.Winforms.dll
  Microsoft.ReportViewer.Common.dll
  Microsoft.ReportViewer.ProcessingObjectModel.dll
  </code></pre>
  <p>I have asked <a href="https://stackoverflow.com/questions/71073041/how-can-i-tell-if-net-framework-winforms-code-is-callable-from-net-core6">this</a> related question.</p>