MSBuild使用错误版本的程序集来编译RDLC文件 [英] MSBuild Using Wrong Version of Assembly to Compile RDLC File

查看:95
本文介绍了MSBuild使用错误版本的程序集来编译RDLC文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用VS 2010中的reportviewer控件来创建客户端报告(rdlc).在开发计算机上,一切正常,当我手动编译(通过VS2010)并手动部署到未安装开发工具的测试计算机上时.

I am using the reportviewer control from VS 2010 to create client side reports (rdlc). Everything is working fine on my development machine, and when I manually compile (via VS2010) and manually deploy to a test machine that doesn't have development tools installed.

为了使测试机正常工作(无需安装VS2010或ReportViewer.exe),我必须在项目中将引用添加到Microsoft.ReportViewer.Winforms,Microsoft.ReportViewer.Common和Microsoft.ReportViewer.ProcessingModel,并具有他们都是本地复制".

In order to get the test machine to work (without installing VS2010 or ReportViewer.exe), I had to add references in my project to Microsoft.ReportViewer.Winforms, Microsoft.ReportViewer.Common and Microsoft.ReportViewer.ProcessingModel and have them all "Copy Local".

我为Build Action =>嵌入式资源配置了rdlc文件.将新的rdlc添加到项目时,这是默认设置.如果可以解决此问题(不知道是否相关),我愿意进行配置.

I have the rdlc files configured for Build Action => embedded resources. This is the default setting when adding a new rdlc to the project. I am open to configuring this otherwise if this would resolve this problem (no idea if its related).

问题:自从添加rdlc文件以来,该解决方案不再在构建服务器上构建.我已经在构建服务器上安装了ReportViewer.exe,并验证了GAC中是否存在必需的程序集. .net 4框架未安装在构建服务器上-我认为这不是必需的,因为该解决方案的目标是3.5运行时.

The problem: since adding the rdlc files, the solution no longer builds on the build server. I have installed ReportViewer.exe on the build server, and have verified that the required assemblies exist in the GAC. The .Net 4 framework is NOT installed on the build server--I don't think this is required because the solution targets the 3.5 runtime.

我认为问题的根源在于构建日志中的内容:

I believe the root of the problem is the following from the build log:

目标"RunRdlCompiler":建筑物 完全定位"RunRdlCompiler". 输出文件 "obj \ Release \ RdlCompile.compiled"确实 不存在.使用"RdlCompile"任务 从组装 "Microsoft.ReportViewer.Common, 版本= 9.0.0.0,文化=中性, PublicKeyToken = b03f5f7f11d50a3a.任务 "RdlCompile": Report \ RDLC \ GreenReport.rdlc(0,0): 错误rsInvalidReportDefinition: 报告定义无效. 详细信息:报告定义中有一个 无效的目标名称空间 ' http://schemas.microsoft.com/sqlserver/reporting/2008/01/报告定义" 无法升级.

Target "RunRdlCompiler": Building target "RunRdlCompiler" completely. Output file "obj\Release\RdlCompile.compiled" does not exist. Using "RdlCompile" task from assembly "Microsoft.ReportViewer.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". Task "RdlCompile": Report\RDLC\GreenReport.rdlc (0,0): error rsInvalidReportDefinition: The report definition is not valid. Details: The report definition has an invalid target namespace 'http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition' which cannot be upgraded.

据我所知,应该使用Microsoft.ReportViewer.Common 10.0.0.0版来编译" rdlc,但MSBuild似乎正在使用9.0.0.0.我相信,如果我可以强迫它使用正确的版本(GAC中已安装该版本),该解决方案将可以编译.

From what I can tell, Microsoft.ReportViewer.Common version 10.0.0.0 is what should be used to "compile" the rdlc, but MSBuild appears to be using 9.0.0.0. I believe if I could force it to use the right version (which IS installed in the GAC), the solution would compile.

推荐答案

这是因为您的Microsoft.Common.Targets文件指向程序集的9.0版本.

This is because your Microsoft.Common.Targets file is pointing to the 9.0 version of the assembly.

如果您查看[sysdir] \ Microsoft.NET \ Framework \ v3.5,则会发现Microsoft.Common.targets,它推动了MSBuild的大量工作.此版本的通用目标文件指向[Program Files]\MSBuild\Microsoft\VisualStudio\v9.0\ReportingServices\Microsoft.ReportingServices.targets,强制MSBuild与9.0版本一起运行.

If you look in [sysdir]\Microsoft.NET\Framework\v3.5 you will find Microsoft.Common.targets, which is driving a lot of what MSBuild does. This verion of the common targets file points to [Program Files]\MSBuild\Microsoft\VisualStudio\v9.0\ReportingServices\Microsoft.ReportingServices.targets forcing MSBuild to run with the 9.0 version.

在安装.NET 4.0时,在v4.0.x目录中获得了一个新的通用目标文件,该新文件现在指向[Program Files]\MSBuild\Microsoft\VisualStudio\v10.0\ReportingServices\Microsoft.ReportingServices.targets,该文件指向ReportViewer程序集的10.0版本.

When you installed .NET 4.0, you got a new common targets file in the v4.0.x directory, this new one now points to [Program Files]\MSBuild\Microsoft\VisualStudio\v10.0\ReportingServices\Microsoft.ReportingServices.targets which points to the 10.0 version of the ReportViewer assemblies.

10.0 ReportViewer是针对.NET 3.5编译的,旨在同时在3.5和4.0中工作.您很可能会放弃.NET 4.0框架,并更改3.5公共目标文件以指向新的ReportingServices目标文件,它应该可以工作.从理论上讲,我从未真正尝试过.坚持使用4.0可能是最好的选择,因为这是我们为新查看器设计MSBuild支持时所要达到的目的.

The 10.0 ReportViewer is compiled against .NET 3.5 and intended to work in both 3.5 and 4.0. You could very likely get rid of the .NET 4.0 framework, and alter your 3.5 common targets file to point to the new ReportingServices target file, and it should work. In theory anyway, I've never actually tried it. You may be best off just sticking with 4.0, as that's what we intended when we designed the MSBuild support for the new viewer.

这篇关于MSBuild使用错误版本的程序集来编译RDLC文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆