Solved

'CrystalReportViewer' is ambiguous in the namespace 'CrystalDecisions.Web'

Posted on 2011-03-16
13
6,252 Views
Last Modified: 2014-04-19
We are working on ASP.Net website. We have some reports with Crystal Reports.
We recently upgraded from Visual Studio 2005 to Visual Studio 2008. Then some issues started...

1. In development machine, reports are working perfectly.
2. In our local Testing environment (Windows Server 2003), it is showing this error message
'CrystalReportViewer' is ambiguous in the namespace 'CrystalDecisions.Web'
This is the error in our testing server
These are configuration of development machine and source code
In our development machine, we have two version of Crystal Reports installed.
- Crystal Reports for Visual Studio 2005 (v10.2.3600.0) and
- Crystal Reports for Visual Studio 2008 (v 10.5.3700.0)

This is the screenshot of GAC in development machineGAC in Development Machine
In our Source code - References, we have referred only Crystal Reports for Visual Studio 2008 only (10.5.3700.0) References in the Source Code
Source Code of ASPX Page - See here also we have referred latest version of Crystal Reports.
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Sales_ReportV2.aspx.vb" Inherits="Sales_ReportV2" %>
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    

    
<%@ Register Assembly="CrystalDecisions.Web, Version=10.5.3700.0 , Culture=neutral, PublicKeyToken=692fbea5521e1304"
    Namespace="CrystalDecisions.Web" TagPrefix="CR" %>
    <%@ Register Assembly="CrystalDecisions.Shared, Version=10.5.3700.0 , Culture=neutral, PublicKeyToken=692fbea5521e1304"
    Namespace="CrystalDecisions.Shared" TagPrefix="CR" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Sales Report</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
   <link href="css/escc.css" rel="stylesheet" type="text/css" />
    <link href="/aspnet_client/System_Web/2_0_50727/CrystalReportWebFormViewer3/css/default.css"
        rel="stylesheet" type="text/css" />
    <script type ="text/javascript">
	function MaximizeWindow()
	{
		if (document.all || document.layers) {
		  self.moveTo(0,0);
		  self.resizeTo(screen.availWidth, screen.availHeight);
		}
	}
    </script>

</head>
<body style="overflow:auto; background-image : none; background-color:White ; " onload="javascript:MaximizeWindow();">
    <form id="frmPrintPreviewProposal" runat="server">
  <CR:CrystalReportViewer ID="CrystalReportViewerHead" runat="server" Height="1039px" 
        ReportSourceID="Sales_ReportSource" Width="901px" HyperlinkTarget="_blank"></CR:CrystalReportViewer>
        <CR:CrystalReportSource ID="Sales_ReportSource" runat="server">
            <Report FileName="Reports\Sales_Report.rpt">
            </Report>
    </CR:CrystalReportSource>
          <asp:Panel ID="toolTipErrorMsg" runat="server" CssClass="popupcurve" Visible="false">
                            <table style="width: 100%;" class="popupcurve_inside">
                                <tr>
                                    <td>
                                        <h1>
                                            <asp:Label ID="lblmsgheading" runat="server" Font-Bold="true" Text="Message!">
                                            </asp:Label></h1>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <asp:Label ID="lblmsg" runat="server">
                                        </asp:Label>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="center">
                                        <asp:Button ID="btnErrOk" Visible="true" Width="75px" CssClass="btnb" runat="server"
                                            Text="OK" />
                                    </td>
                                </tr>
                            </table>
                        </asp:Panel>
    </form>
</body>
</html>

Open in new window



Web.config
	<assemblies>
.....
				<add assembly="CrystalDecisions.CrystalReports.Engine, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
				<add assembly="CrystalDecisions.ReportSource, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
				<add assembly="CrystalDecisions.Shared, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
				<add assembly="CrystalDecisions.VSDesigner, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
				<add assembly="CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
				<add assembly="CrystalDecisions.Windows.Forms, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
				<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
				<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
			</assemblies>

Open in new window


In Brief:-
In development, Site is working with the above shown settings.
But once we host this site to testing environment, it is crashing (Screenshot I already posted)
In server also we have both versions of Crystal Reports installed.

I believe - I have provided relevant details. - How can I get around this issue ?

Any suggestion would be great to me - Please help

Raj
0
Comment
Question by:Rajkumar Gs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 2
  • 2
  • +1
13 Comments
 
LVL 13

Expert Comment

by:agarwalrahul
ID: 35154670
0
 
LVL 23

Author Comment

by:Rajkumar Gs
ID: 35154774
I already search in Experts-Exchange before posting this question.

Use the fully qualified crystalreportviewer.
"crystaldecisions.Web.CrystalReportViewer"

Nowhere I am using 'CrystalReportViewer' in code-behind.

Raj
0
 
LVL 3

Expert Comment

by:AbdulQuddos
ID: 35154869
I think here is some issue:

<%@ Register Assembly="CrystalDecisions.Web, Version=10.5.3700.0 , Culture=neutral, PublicKeyToken=692fbea5521e1304"    Namespace="CrystalDecisions.Web" TagPrefix="CR" %>

 <%@ Register Assembly="CrystalDecisions.Shared, Version=10.5.3700.0 , Culture=neutral, PublicKeyToken=692fbea5521e1304"    Namespace="CrystalDecisions.Shared" TagPrefix="CR" %>

Both of these directives have the same TagPrefix="CR"

Hope this helps.
0
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
LVL 23

Author Comment

by:Rajkumar Gs
ID: 35155518
Thanks Abdul for your suggestion.

Actualy 'CrystalDecisions.Shared' is not using in the ASPX page. I removed it. Still the same error

If I am right, this error 'CrystalReportViewer' is ambiguous in the namespace 'CrystalDecisions.Web' seems to be since 'CrystalReportViewer' is there in two namespaces referred in the project. But I can see only one version of Crystal Report referred there.

Any thoughts ?
Raj
0
 
LVL 3

Expert Comment

by:AbdulQuddos
ID: 35155537
if that's the case please try to remove/comment unused Assemblies in your Web.config
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 35156508
It indicates you have referenced 2 versions of the viewer.

This link has a link to a module checking tool
http://forums.sdn.sap.com/thread.jspa?threadID=1842278

mlmcc
0
 
LVL 23

Author Comment

by:Rajkumar Gs
ID: 35157367
mlmcc,

I tried the tool in the link that you posted in development server. It is showing the modules of Crystal Reports
- CrystalDecision.Shared.DLL
- CrystalDecisions.VsDesigner.DLL
- CrystalDecisions.Web.DLL
- CrystalDecisions.Windows.Forms.DLL
twice.
For WEBDEV.WEBSERVER.EXE & DEVENV.EXE

I don't understand why it is not showing 'ambiguious' error in web server, while working in development machine ? Both machines have both versions of Crystal Reports - at the same time in code, I have refered only newer version.

According to the code and screenshots that I posted in the main question, could you please suggest where I need to correct ?

Raj
0
 
LVL 23

Author Comment

by:Rajkumar Gs
ID: 35157424
Another important thing I noticed using that tool is that eventhough two DLLs are listed, both  DLL are seems to of 10.5 version  - Check this screenshot
 Modules Loaded
Any idea ?

Raj
0
 
LVL 23

Author Comment

by:Rajkumar Gs
ID: 35157434
The above screenshot is when I ran that tool in development machine.
Raj
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 35159301
Can you run it on the prod machine?

mlmcc
0
 
LVL 23

Author Comment

by:Rajkumar Gs
ID: 35162674
We didn't go for Client's producton yet. Only in our local testing environment and Client's UAT Server.

In Client's UAT Server also I faced hardtime to fix it out. Evenif I installed CR 10.5, there it was crashing by showing another error - Something like "Crystal Reports was not properly installed or registry keys are corrupted. Reinstall from Cryst.exe ... " - some similar error message like that
I managed this issue by uninstall all versions of Crystal Reports and install Crystal Reports Setup uploaded from our machine - C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\CrystalReports10_5
In this folder, there are setups for 32 bit and 64 bit OS. First when I installed 64 bit setup in the UAT 64 bit Windows 2003 Server, it was still showing the same error. But when I installed 32-bit setup in 64-bit system, it is working perfectly. Then I faced another issue - icons in the toolbar of the crystal report viewer was not showing. That's also I manged to fix by copy paste the image folder to proper location.

>> Can you run it on the prod machine?
Anyway I need our admin's permission to install this tool in our testing server. I am proceeding with that - I will do that and let you know

By the way - Please clarify these
1. If we using Crystal Reports for Visual Studio 2008, there could be older version of the same assembly in the Webserver where we are hosting this website. Someother sites may be using older version.
I am sure that if we uninstall older version, this error will go - but that is not a good solution. So I believe - it is good to fix this issue by make this site work in an environment that is having older and newer version of assembly of Crystal Reports installed and loaded in memory. That is what I am trying to achieve

It is crucial when we are going for publish to client's production server - as they have older and newer versions of CR used by different sites.

Is this tool help me to get around this way ?

2. According to the code and screenshots that I posted in the main question, could you please suggest where I need to correct ?

mlmcc - I highly appreciate your support. Hope you could help me to overcome this challenge

Raj
0
 
LVL 23

Accepted Solution

by:
Rajkumar Gs earned 0 total points
ID: 35163828
FIXED THIS ISSUE!!

We fixed this issue by using Crystal Reports for Visual Studio 2005.
Now working perfectly in development machine, our testing server and client's UAT server evenif we have both versions of Crystal Reports installed.

Going with Crystal Reports for Visual Studio 2008 seems to be a head-ache, which is affecting our deadline and also during deployment to UAT / Production there could be another couple of issues - they have some sites using Crystal Reports 2005.
Going with this solution - seems to be risk-free.

Steps that I done are
1. Find and Replace '10.5.3700.0' with '10.2.3600.0'
2. Used this version of  System.Web.Extensions
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0,
in ASPX page (if it is there)
3. Remove this from web.config
<add assembly="CrystalDecisions.VSDesigner, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
In Crystal Reports for Visual Studio 2005, it is not available
4. Publish

Regards
Raj
0
 
LVL 23

Author Closing Comment

by:Rajkumar Gs
ID: 35196551
Thanks Guys for your attempt to help me.
Raj
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question