I have a .NET Framework 4.5 project (C# language) in Visual Studio 2019.
I'm tryng to use Crystal Reports.
When I write ReportDocument r = new ReportDocument(); this throw this exception:
Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Impossibile trovare il file specificato.
How can I solve?
Try adding this to your App.config file:
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
In the past the "Crystal Reports for .NET Framework 4.0" used to target the 2.0 CLR for whatever reason. They have fixed this in later versions but it could be related to your issue. You will also want to verify you have the .NET Framework 4.x installed (I'm assuming you do). You might also double check that your project has a reference to System.Windows.Forms and if not try adding one and see if it helps.
If those don't work, consider installing the latest service pack from SAP for the version of Crystal Reports you're using. The version of Crystal I use is on SP 30 something. Those libraries now actually target the 4.x framework. I don't know the version you're using so I can't provide a direct link but you should be able to search SAP's site for it.
Related
I am currently migrating some VS 2005 projects to VS 2012.
All of them compiled fine, but when I tried to run it, I got a crystal report error:
Error 1 Could not load file or assembly
'CrystalDecisions.CrystalReports.Engine, Version=10.2.3600.0,
Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its
dependencies. The system cannot find the file specified.
VS 2005 has built in support for crystal reports, but VS 2012 doesn't seem to have that. I googled and found out that there is a new update available from Crystal reports to work with VS 2012, but the link seems dead (http://scn.sap.com/docs/DOC-35074)
Can Anybody show me the way?
Thanks in advance.
I installed Crystal Reports for VS 2010 from http://www.sdn.sap.com
When I create new Crystal Report in the CrystalReport.cs class there are few errors:
The type or namespace name 'Engine' does not exist in the namespace
'CrystalDecisions.CrystalReports' (are you missing an assembly
reference?)
I manually browsed the CrystalDecisions.CrystalReports.Engine.dll and added it to the References but still gives me the error
The same error gives me for CrystalDecisions.ReportSource
The same error gives me for CrystalDecisions.Shared
Also the CrystalDecisions.CrystalReports.Engine doesn't exist when I go to Add Reference .NET tab ..
For all those who has still this problem:
Somehow i figured out that there are problems with .NET 4, with .NET 4.5 & VS2012 they just work fine.
I haven't tried Ally's solution but that maybe is the right answer to my problems, but whatever i switched to vs2012 & 4.5 so they work just fine.
Thanks
You Must Change Version Of .Net In Project Properties. In Tab Application, Change Target framework To .Net Framework 4. I exactly had problem. In fact, initial .Net Framework When I created Project was .Net Framework 4 Client Profile. As I told, I changed to .Net framework 4.
Problem solved perfectly.
I am using VS2010 with SP1 (also have VS2012 installed on the same machine). Moles 1.0
The project is using .NET 4
I added moles assembly to system.dll and get the following error on compile
Error 46 The type or namespace name 'IReadOnlyList' does not exist in the namespace 'System.Collections.Generic' (are you missing an assembly reference?) [C:\Test\obj\Debug\Moles\s\m.g.csproj] C:\Test\m.g.cs Test
IReadOnlyList .NET 4.5 as far as I know.
Anyone else got this issue?
Updated Solution
I was able to get Pex to run in VS 2010 with .Net Framework 4.5 installed. Maybe others have explained that this is the solution but my issue (being new to Moles and Pex) is that many of the explanations were vague. Thanks to the author of these posts because they got me headed in the right direction:
http://feherzsolt.wordpress.com/2013/02/13/moles-and-net-4-5/
http://www.daedtech.com/using-moles-with-the-system-assembly
So the solution is to create a new .moles file (System.moles) in the test project at the same level that Pex created the yourAssemblyUnderTest.moles file and add the following to the file.
<Moles xmlns="http://schemas.microsoft.com/moles/2010/">
<Assembly Name="System" ReflectionOnly="true" />
</Moles>
You may have to clean (or manually delete the obj folder contents) and rebuild but this solution worked for me. I also noticed that the first build would report build errors, but the errors would go away on subsequent builds.
Alternative Solution
I know this isn't THE solution but it is a (poor) workaround that allows Pex to run...plus this was too long for a comment. If anyone knows how to get PEX to run on a machine with the 4.5 .Net Framework PLEASE respond.
This was my scenario. I have a machine with the .Net Framework 4.5 and I have Visual Studio 2010 and 2012 installed. I installed Pex (en_visual_studio_2010_pex_0.94.51023.0_power_tools_x64_598803.exe) and could run Pex in a VS 2010 project that was targeting .Net Framework 4.0. I could run Pex and it identified issues...but once I promoted issues to Unit Tests the unit test project wouldn't compile because of the following build error
The type or namespace name 'IReadOnlyList' does not exist in the namespace 'System.Collections.Generic' (are you missing an assembly reference?)
After much searching, and reading that Pex or Moles was replacing 4.5 .Net Framework assemblies with 4.0 versions I decided to uninstall 4.5, install 4.0, and give it a try. Running on 4.0 works just fine and I didn't need to define Mole type filters to get it to work. Then I tried tried to upgrade to the 4.5 Framework again...but sadly I end up right back where I started with the IReadOnlyList namespace issue.
I hosted my application on vertual dedicated server.(windows 2008 r2)
All the crystal reports are running on the local host.but after hosting application, reports are not working.I installed "CRRuntime_64bit_13_0_1" on the server.error message as below.
Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral,
PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the
file specified.
Please help me to solve this.
Log4net is an error reporting tool and is independent of Crystal Reports.
So, at risk of asking the obvious here but do you have the correct version of the log4net DLL in the Bin folder of your installed app?
I'm having problems running MVC2. I've compiled defult MVC project and deployed it on working mono setup (MVC1 works without problems, but only as C#, VB.net MVC1 fails with a message similar to this one). When I try to access MVC2 web (VB.NET version, C# works) I get this message:
Compiler Error Message:
VBNC30456: 'RenderPartial' is not a member of 'System.Web.Mvc.HtmlHelper`1[[System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'.
~/Views/Shared/Site.Master
I've set System.Web.MVC to Copy local, but to no avail.
# mono -V
Mono JIT compiler version 2.6.4 (tarball Tue May 25 19:27:01 CEST 2010)
Mono's VB compiler does not support 2008 features, like extension methods.
The way to get around this is to use Visual Studio to precompile your application and copy it to wherever you intend to use Mono to serve it. This way, Mono's VB compiler should never be invoked.