Hi, I'm trying to run a Reportviwer RDLC report, rendering data from a SQL Server DB to Excel from Powershell 5.1.
When I run the PS script report with Reportviewer runtime 2015 v14 or runtime 2017 v15 I get this error: "Could not load file or assembly 'Microsoft.ReportViewer.Common' version=15.0.0.0 Winforms Powershell."
Échec du chargement de l'assembly hôte d'expressions. Détails: Impossible de charger le fichier ou l'assembly 'Microsoft.ReportViewer.Common, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' ou une de ses dépendances.
Le fichier spécifié est introuvable.
à Microsoft.ReportingServices.RdlExpressions.ReportRuntime.ProcessLoadingExprHostException(ObjectType assemblyHolderObjectType, Exception e, ProcessingErrorCode errorCode)
à Microsoft.ReportingServices.RdlExpressions.ReportRuntime.LoadCompiledCode(IExpressionHostAssemblyHolder expressionHostAssemblyHolder, Boolean includeParameters, Boolean parametersOnly, ObjectModelImpl reportObjectModel, ReportRuntimeSetup runtimeSetup)
à Microsoft.ReportingServices.OnDemandProcessing.Merge.Init(Boolean includeParameters, Boolean parametersOnly)
à Microsoft.ReportingServices.OnDemandProcessing.Merge.Init(ParameterInfoCollection parameters)
à Microsoft.ReportingServices.ReportProcessing.Execution.ProcessReportOdp.CreateReportInstance(OnDemandProcessingContext odpContext, OnDemandMetadata odpMetadata, ReportSnapshot reportSnapshot, Merge& odpMerge)
à Microsoft.ReportingServices.ReportProcessing.Execution.ProcessReportOdp.Execute(OnDemandProcessingContext& odpContext)
à Microsoft.ReportingServices.ReportProcessing.Execution.RenderReportOdpInitial.ProcessReport(ProcessingErrorContext errorContext, ExecutionLogContext executionLogContext, UserProfileState& userProfileState)
à Microsoft.ReportingServices.ReportProcessing.Execution.RenderReport.Execute(IRenderingExtension newRenderer)
à Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RenderReport(IRenderingExtension newRenderer, DateTime executionTimeStamp, ProcessingContext pc, RenderingContext rc, IChunkFactory yukonCompiledDefinition)
à Microsoft.Reporting.LocalService.Render(String format, String deviceInfo, String paginationMode, Boolean allowInternalRenderers, IEnumerable dataSources, CreateAndRegisterStream createStreamCallback)
à Microsoft.Reporting.WinForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMod
What is absolutely weird is:
The same PS script running with Reportviewer Runtime 2012 works fine.
The PS script running with Reportviewer Runtime 2015 or runtime 2017 get the error. My RDLC report contains some expression e.g: = "xxx" + DateTime.Now. If I remove all the report expressions, the PS script works fine.
I've made a console test program with C# VS2017 that runs exactly the same statements as the PS script. The console app runsfine.
I run the PS script in the same debug folder as the console app and load automatically all the present DLLs :
Microsoft.MSXML.dll
Microsoft.ReportViewer.Common.dll
Microsoft.ReportViewer.Common.resources.dll
Microsoft.ReportViewer.DataVisualization.dll
Microsoft.ReportViewer.DataVisualization.resources.dll
Microsoft.ReportViewer.Design.dll
Microsoft.ReportViewer.Design.resources.dll
Microsoft.ReportViewer.ProcessingObjectModel.dll
Microsoft.ReportViewer.WebDesign.dll
Microsoft.ReportViewer.WebDesign.resources.dll
Microsoft.ReportViewer.WebForms.dll
Microsoft.ReportViewer.WebForms.resources.dll
Microsoft.ReportViewer.WinForms.dll
Microsoft.ReportViewer.WinForms.resources.dll
Microsoft.SqlServer.Types.dll
But still the same error.
I don't want continuing using the VS2013 2012 runtime, because it is to old and is not support by the report bulder designer.
I have no idea of which DLL from Reportviewer.Common could miss. I've try every dll from GAC which depend on, with no succes.
I'm running out of ideas!
Any help much appreciated.
Thank you.
Olivier