Search code examples
c#asp.netpublish

ASP.NET website Publish adds using CrystalDecisions to class although not referenced by code


I have an ASP.NET website project that builds and runs perfectly, and had up until recently been publishing just fine.

However, this morning I went to publish the website and got the following error:

The type or namespace name 'CrystalDecisions' could not be found (are you missing a using directive or an assembly reference?)

In addition I found that a using Statement had been added to the class.

Before publish (builds and runs):

using System;
using System.Collections.Generic;
using System.Web;

public class Retail
{
    public Retail()
    {

After publish (does not build):

using System;
using System.Collections.Generic;
using System.Web;
using CrystalDecisions.Reporting.WebControls;

public class Retail
{
    public Retail()
    {

So far I have:

  • removed the using manually(build restores it)
  • deleted local cache files
  • rebuilt the solution

All without success.

UPDATE: Over the weekend this problem has resolved itself. Like @ohundij I have no Idea why and would love to know what causes this and what resolution there might be to avoid it in the future.


Solution

  • The problem has occurred again and in my case it was down to the reference being added seemingly automatically to CrystalDecisions (although it may have been an absent minded click as the issue came this time after I got latest version from TFS).

    When I double-clicked on the error message to see where the fault was it was ,unbeknownst to me and without any notification, opening a version of the file from a temp folder so that my edits were being overwritten each time by the original file.

    All I had to do was edit the original file, save it and the problem was resolved.