title: Windows Forms RDLC: missing assembly after updating the project to package reference format
body: <p>I have a Windows Forms app which uses local rdlc files for generating reports. This is an old app which has reports (rdlc files) which were built along the years with different versions of the rdlc designer. In this last weeks, I've been migrated the project and I've decided to update the csproj file to use the new package reference format. The old project was still using an older version of the report viewer contols, so I've decided to follow the <a href="https://docs.microsoft.com/en-us/sql/reporting-services/application-integration/integrating-reporting-services-using-reportviewer-controls-get-started?view=sql-server-2017" rel="nofollow noreferrer">instructions</a> and install the Microsoft.ReportingServices.ReportViewerControl.WinForms nuget package. Looking at the csproj, I can see that it's referencing the package:</p>
  
  <pre><code>&lt;PackageReference Include="Microsoft.ReportingServices.ReportViewerControl.Winforms"&gt;
    &lt;Version&gt;150.1358.0&lt;/Version&gt;
  &lt;/PackageReference&gt;
  </code></pre>
  
  <p>Unfortunately, now I'm getting several errors which I really don't understand. The first error I'm getting says that the report format is invalid. Despite the message, it seems like the problem is that it's missing the Microsoft.ReportViewer.ProcessingObjectModel assembly. </p>
  
  <p>Here's the complete stack error message:</p>
  
  <pre><code>Microsoft.Reporting.WinForms.LocalProcessingException: An error occurred during local report processing. ---&gt; Microsoft.Reporting.DefinitionInvalidException: The definition of the report '' is invalid. ---&gt; Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: An unexpected error occurred in Report Processing. ---&gt; System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.ReportViewer.ProcessingObjectModel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
     at Microsoft.ReportingServices.RdlExpressions.ExprHostCompiler.InternalCompile(AppDomain compilationTempAppDomain, Boolean refusePermissions)
     at Microsoft.ReportingServices.RdlExpressions.ExprHostCompiler.&lt;&gt;c__DisplayClass33_0.&lt;Compile&gt;b__0()
     at Microsoft.ReportingServices.Diagnostics.RevertImpersonationContext.&lt;&gt;c__DisplayClass1_0.&lt;Run&gt;b__0(Object state)
     at System.Security.SecurityContext.Run(SecurityContext securityContext, ContextCallback callback, Object state)
     at Microsoft.ReportingServices.Diagnostics.RevertImpersonationContext.Run(ContextBody callback)
     at Microsoft.ReportingServices.RdlExpressions.ExprHostCompiler.Compile(IExpressionHostAssemblyHolder expressionHostAssemblyHolder, AppDomain compilationTempAppDomain, Boolean refusePermissions, PublishingVersioning versioning)
     at Microsoft.ReportingServices.ReportPublishing.ReportPublishing.Phase3(ParameterInfoCollection&amp; parameters, Dictionary`2&amp; groupingExprCountAtScope)
     at Microsoft.ReportingServices.ReportPublishing.ReportPublishing.InternalCreateIntermediateFormat(Stream definitionStream, String&amp; description, String&amp; language, ParameterInfoCollection&amp; parameters, DataSourceInfoCollection&amp; dataSources, DataSetInfoCollection&amp; sharedDataSetReferences, UserLocationFlags&amp; userReferenceLocation, ArrayList&amp; dataSetsName, Boolean&amp; hasExternalImages, Boolean&amp; hasHyperlinks, Byte[]&amp; dataSetsHash)
     at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.CompileOdpReport(PublishingContext reportPublishingContext, PublishingErrorContext errorContext, String&amp; reportDescription, String&amp; reportLanguage, ParameterInfoCollection&amp; parameters, DataSourceInfoCollection&amp; dataSources, DataSetInfoCollection&amp; sharedDataSetReferences, UserLocationFlags&amp; userReferenceLocation, ArrayList&amp; dataSetsName, Boolean&amp; hasExternalImages, Boolean&amp; hasHyperlinks, Byte[]&amp; dataSetsHash)
     at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.CreateIntermediateFormat(PublishingContext reportPublishingContext)
     --- End of inner exception stack trace ---
     at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.CreateIntermediateFormat(PublishingContext reportPublishingContext)
     at Microsoft.Reporting.ReportCompiler.CompileReport(ICatalogItemContext context, Byte[] reportDefinition, Boolean generateExpressionHostWithRefusedPermissions, ControlSnapshot&amp; snapshot)
     --- End of inner exception stack trace ---
     at Microsoft.Reporting.ReportCompiler.CompileReport(ICatalogItemContext context, Byte[] reportDefinition, Boolean generateExpressionHostWithRefusedPermissions, ControlSnapshot&amp; snapshot)
     at Microsoft.Reporting.LocalService.GetCompiledReport(PreviewItemContext itemContext, Boolean rebuild, ControlSnapshot&amp; snapshot)
     at Microsoft.Reporting.LocalService.CompileReport()
     at Microsoft.Reporting.WinForms.LocalReport.EnsureExecutionSession()
     --- End of inner exception stack trace ---
     at Microsoft.Reporting.WinForms.LocalReport.EnsureExecutionSession()
     at Microsoft.Reporting.WinForms.LocalReport.GetParameters()
     at WndAssistencias.Views.frmReportViewer..ctor(RelInfo relInfo) in D:\code\work\tfsonline\AssistenciasHelpdesk\WNDASSISTENCIAS\Views\frmReportViewer.cs:line 32
     at WndAssistencias.Presenters.EdicaoPATPresenter.ImprimePatAsync() in D:\code\work\tfsonline\AssistenciasHelpdesk\WNDASSISTENCIAS\Presenters\EdicaoPATPresenter.cs:line 717
  </code></pre>
  
  <p>Well, the assembly is missing (I've confirmed that it's not on the output folder)...</p>
  
  <p>If I'm not mistaken, when I was using the package.config reference, I had to change the assemblies reference properties so that they would be copied to the output. Unfortunately, the assembly reference list in VS doesn't show the reporting assemblies anymore (it will only show the nuget package reference!), so I'm not sure on how to solve this.</p>
  
  <p><strong>EDIT</strong> Just to add that I've tried copying the processingObjectModel assembly to the output and I'm still getting the same error.</p>
  
  <p><strong>EDIT2</strong> I've went back to the packages.config format and it's working...I'd be interested in moving to packages references, so if someone knows how to solve this issue (copying auxiliary assemblies to output folder), please let me know.</p>
  
  <p>Any clues?</p>
  
  <p>thanks!</p>