Monday, May 31, 2010

Visual Studio 2010, Build error, Build (web): Object reference not set to an instance of an object

When upgrading a from previous version, Crystal report build provider will cause builder error, in ASP.NET 4 crystal reports are also pre-compiled using build provider for (.rpt), when compiler tries to pre-compile reports build in previous version, a build error "Object reference not set to an instance of an object" is thrown and build fails.

Possible work arround is to remove the build provider for (*.rpt) in your web.config:

There will be following construct under section:

<buildProviders>
<add extension=".rpt" type="CrystalDecisions.Web.Compilation.RptBuildProvider, CrystalDecisions.Web, Version=14.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
</buildProviders>

We can change this to:

<buildProviders>
<add extension=".rpt" type="CrystalDecisions.Web.Compilation.RptBuildProvider, CrystalDecisions.Web, Version=14.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<remove extension=".rpt"/>
</buildProviders>

What we have done is removed the build provider for (.rpt), in this way the crystal reports will remain as it is and no build error will show.

6 comments:

  1. Thanks alot ! Worked for me like a Charm.....

    ReplyDelete
  2. Thanks, it took me some time to resolve the issue. But i hope it will now save time for guys who are facing this issue.

    ReplyDelete
  3. Thank a lot. Good job! Nice workaround, it's now up to CR people to fix correctly. Problem is not resolved in SP3 (CRforVS_13_0_3)

    ReplyDelete
  4. @Christian Thanks for appreciating

    ReplyDelete
  5. Thanks that did the trick.....I really appreciate it...

    ReplyDelete
  6. Thanks, worked like a charm.

    ReplyDelete