12

My asp.net site has to run on several client servers. It's working fine on a majority of them, but a couple have run into an error message on a few pages:

Compiler Error Message: CS0012: The type 'MetaNameValuePair' is defined in an assembly that is not referenced. You must add a reference to assembly 'App_Code.t_3vcono, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.

The type 'MetaNameValuePair' is actually defined in a .cs file within my App_Code folder, not an external assembly. Is it failing to compile that .cs file?

Jake Stevenson
  • 3,009
  • 6
  • 35
  • 40

5 Answers5

13

Attempt 1:

A similar question was asked a couple of months back and look at those answers.

Attempt 2:

Have you cleared the "Temporary ASP.Net Files" for the site, usually found at C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files? There may be an old copy lingering around.

Community
  • 1
  • 1
JB King
  • 11,860
  • 4
  • 38
  • 49
  • 1
    I looked at that, but it was a question about referencing a "real" assembly (.dll). As I mentioned in my question, the type listed is not defined in a separate assembly, it's defined within the same site. – Jake Stevenson Jan 30 '09 at 16:58
  • 1
    Clearing the temporary files looks like it did it. Thank you very much. – Jake Stevenson Jan 30 '09 at 17:32
8

For some special cases you could get rid of this if you disable batch compilation in the Web.config file like this:

<system.web>
    ...
    <compilation debug="true" targetFramework="4.0" batch="false" />
    ...
</system.web>

After compiling, you can change the value back to True or remove the "batch" attribute, and then rebuild successfully.

Malice
  • 3,927
  • 1
  • 36
  • 52
Géza Prouza
  • 81
  • 1
  • 1
  • 1
    I found that clearing the cache didn't work me - and while this slows things down it did work as a second resort. – Ian Mar 18 '14 at 09:35
1

Had this numerous times. The solution is to close and open Visual Studio.

In my case at least it seemed to hove something to do wit

Karlth
  • 3,267
  • 2
  • 27
  • 28
0

None of the solutions worked for me. The code that it is complaining about is this:

thisSession = ((SiteMasterPage)this.Master).foo;

I'm casting the page's generic master page to the specific master page which grants me access to the foo object on the page's master page which is a complex object with trivial user data.

If you want to know why I'm doing this, it's because so far it's the best solution. Requirements dictate that I cannot extend the page class, no session variables, or cookies, and it must be user specific data.

I don't have enough reputation to comment, so I have to reply in an answer. :(

  • You should open a new question with your specific case, with a paragraph at its end explaining why other similar questions you have seen does not cover your case. – Frédéric Mar 08 '19 at 13:49
0

The above solutions have worked for me in the past, but not this time.

I finally found the cause: one of those server side tags (like <%# Eval("Something") %> ) from the attribute of a control on the aspx page.

I'd added it shortly before the problem appeared, and removing it made the problem go away. It was in a TemplateField on a GridView.

Bizarre, but that's what did the trick.

MGOwen
  • 6,562
  • 13
  • 58
  • 67