开发者

Crystal reports really slows down asp.net website build, any way to exclude them?

Was helping a friend who has some 100+ "Crystal Reports 2008" reports as part of a "asp.net website project".

I do not know how/why, but when this "asp.net website" project is building, it spends about 15 minutes "building" the reports directory where all the Crystal Reports reside.

Can Crystal Reports files .rpt's even be build/compiled? Actually it looks like they can be an embe开发者_Python百科dded resource. Like for example according to this article http://msdn.microsoft.com/en-us/library/aa287962(VS.71).aspx you should be able to change whether a report is embedded or not from properties, BUT in "asp.net website project" those properties are not available when a report is highlighted in sol exp.

When the website is build and published, all report files are still put into a corresponding reports folder.

So I guess, my question is there any way to stop VS from building Crystal Reports in "website project"? It's just takeing sooo long it's unbearable.


Thanks for all the suggestions. Turns out it was set up to be embedded as a resource..which with near a hundred was killing the build. Set it to false and the build is in less than a minute.

<businessObjects>
    <crystalReports>
        <rptBuildProvider>
            <add embedRptInResource="false"/>
        </rptBuildProvider>
    </crystalReports>
</businessObjects>


We use crystal reports in quite a few different apps/web pages. In none of them do we actually include the report files themselves within the Visual Studio project. We put the files in the something like a /Reports sub directory, and then reference them by filename. We're still using a fairly old version of Crystal, but I wouldn't think they'd take something like that out.

We use code something like the following:

Dim myRpt As New ReportDocument
Select Case strFormNum
    Case "M5044b"
        strReportPath = Server.MapPath("/Reports/M5044b.rpt")
    <..Snip a lot of case statements...> 
    Case "M5238aWithAI"
        strReportPath = Server.MapPath("/Reports/M5238a_WithAI.rpt")
End Select

myRpt.Load(strReportPath)

myRpt.SetDatabaseLogon(strCRUser, strCRPassword, strCRServer, strCRDB)

myRpt.SetParameterValue("@nIndex", intNewIndex)

myRpt.DataDefinition.FormulaFields.Item("Version").Text = "'Report Printed: " & Now().ToString & "'"

oStream = myRpt.ExportToStream(ExportFormatType.PortableDocFormat)


You need to make sure that custom tool is not run on each report. By default when you add a crystal report to a project, it will associate this custom tool that generates a wrapper class for the report. It's much faster to reference the report by filename (as Josh W. demonstrates), and keep the reports out of the assembly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜