SAP Knowledge Base Article - Public

1870682 - reportClientDocument.close() in Crystal Reports Server 2008 and BI 4 SDK does not delete temp report and subreports temp files

Symptom

Using reportClientDocument.close() in code to release all resources it does not delete any temp files like *.subrpt or *.rpt

Environment

Crystal Reports Developer for Visual Studio

Crystal Reports Server 2011 .NET SDK.

 

Resolution

There are 2 way to resolve this issue:

1. use the following code to manually delete the files:

string myUser = Environment.GetEnvironmentVariable("USERPROFILE");
string myDirectory = myUser + @"\AppData\Local\Temp\";

try
{
     foreach (FileInfo f in new DirectoryInfo(myDirectory).GetFiles("*.subrpt")) f.Delete();
}
catch
{
     MessageBox.Show("file in use");
}
try
{
     foreach (FileInfo f in new DirectoryInfo(myDirectory).GetFiles("*.rpt"))
         f.Delete();
}
catch
{
     MessageBox.Show("file in use");
}

2. Apply Service Pack 5 for CR Server 2008 or Support Pack 6 for BI 4.0 SDK package.

Keywords

CR Server 2008 or Support Pack 6 for BI 4.0 SDK package, subreport temp files, report temp files, rpt, subrpt , KBA , BI-DEV-NET-SDK , .NET SDK / COM SDK , Problem

Product

Crystal Reports Server 2008 V1 ; SAP Crystal Reports, developer version for Microsoft Visual Studio ; SAP Crystal Server 2011