Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Very Odd situation with CrystalReport and/or Visual studio 2010 I don't know maybe .Net Framework

I faced a very odd problem It seems very funny looks like some stuffs having a fun with me. I'm using Crystal-Report Version 13.0.2000.0 and Visual Studio 2010. Number of days ago I got a error related with my Crystal-Report, that was :

Could not load file or assembly 'file:///C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet1\crdb_adoplus.dll' or one of its dependencies. The system cannot find the file specified.

After googling I found solution, Then I added the following code to app.config file and It worked well, I had no error, no exception.

<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime Version="v4.0" sku=".NETFramework, Version=v4.0" />
</startup>

Today when I wanted to use same solution in my other project it showed the message that I should download .NetFrwamework 4.0 and It causes project to not run. I thought I missed something in configuration so I went to look exactly what configurations I did in previous project. Interesting point is here when I opened the project it shows me same message to download .NetFramework 4.0, while It worked very well number of days ago and I don't have any problem with that. But now .... .

I don't know what is the problem. Any advice will be helpful.

like image 271
saber Avatar asked Oct 01 '11 10:10

saber


2 Answers

After spent many hours, I solved my problem, I don't have any idea how ?!! but It doesn't throw any exception anymore. Things I've done :

  1. I delete app.config.
  2. I changed framework to 3.5 then compile it.
  3. Delete all related files with project in AppData/Local/Temp/ folder (Windows 7).
  4. I changed it back to 4.0 (It generated app.config) then compile it, It automatically added following code:

     <startup useLegacyV2RuntimeActivationPolicy="true">
     <supportedRuntime Version="v4.0" sku=".NETFramework, Version=v4.0" />
     </startup>
    

I ran my application without any error and exception. I don't know what was the problem but by doing these steps I fixed my issues.

like image 151
saber Avatar answered Oct 13 '22 08:10

saber


Just one thing, maybe useful for someone: for use Crystal Reports in VS 2010, you have to use Framewok 4.0 (not Framewok 4.0 Client Profile)

like image 24
George Avatar answered Oct 13 '22 10:10

George