We have a problem with Visual Studio 2010 32-bit installed on Windows 7 computers. If an RDLC file is included in a solution, then it is impossible to get a build to succeed. The build fails with no errors.
Turning on verbose build output, you see:
Target "RunRdlCompiler: (TargetId:33)" in file "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\ReportingServices\Microsoft.ReportingServices.targets" from project "C:\Users\bens\documents\visual studio 2010\Projects\WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1.csproj"
(target "CompileRdlFiles" depends on it): Building target "RunRdlCompiler" completely. Output file "obj\x86\Debug\RdlCompile.compiled" does not exist.
Using "RdlCompile" task from assembly "Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". Task "RdlCompile" (TaskId:25) Done executing task "RdlCompile" -- FAILED. (TaskId:25) Done building target "RunRdlCompiler"
in project "WindowsFormsApplication1.csproj" -- FAILED.: (TargetId:33)
Not much help there. So I deompiled the assembly.
The actual exception seems to be swallowed and appears to be a CAS security issue.
Trace looks roughly like this:
Location: Microsoft.Reporting.RdlCompile->CompileReport
privatebool
CompileReport(string
fileName)
{...
PublishingResult result = ReportCompiler.CompileReport(new
PreviewItemContext(), buffer, false,out
snapshot);
..}
Location: Microsoft.Report.ReportCompiler->CompileReport
publicstatic
PublishingResult CompileReport(ICatalogItemContext context, byte[]
reportDefinition, bool
generateExpressionHostWithRefusedPermissions, out
ControlSnapshot snapshot)
{...
compilationTempAppDomain = CreateCompilationTempAppDomain(); <--Throw Exception
...}
Excption thrown by CreateCompilationTempAppDomain is "The security state of an AppDomain was modified by an AppDomainManager configured with the NoSecurityChanges flag."
I have already tried sticking LegacyCASPolicy and NetFx40_LegacySecurityPolicy flags in <runtime> sections for devenv.exe.config and machine.config . I have also tried setting COMPLUS_LegacyCASPolicy=1 in Environment variables. Nothing seems to solve the issue.
Please advise!
Thanks!