문제

i am getting error when building an ASP.net web-site:

Identifier '__ASP' is not CLS-compliant

Nowhere in my code is there the identifier __ASP.

i know why __ASP is not CLS-compliant (it starts with an _). What i need to figure out who is emitting it, and how either:

  • change it to not start with an underscore, or
  • make it private

i could also stop marking the assembly as CLSCompliant - but i'm not gonna

The warning does not list any useful file:

4d48b87d\63ccbbb9\App_Code.x0tl4q2v.49.cs line 15

Which is, obviously, not a file i created. How can i identify where this __ASP identifier is, and remove it, or make it private?


i'm not the only person experiencing __ASP problems:

도움이 되었습니까?

해결책

The "__ASP" files are created by the runtime ASP.NET compiler that converts *.aspx, *.ascx, *.master files into .NET classes that derive from your CodeBehind classes (or in MVC, from your ViewPage classes). The compiler build system also compiles your App_Code files at runtime (as opposed to compiling them from within the IDE).

However, you shouldn't get CLS-compliancy messages in ASP.NET applications unless you've added the [CLSCompliant] attribute to your assembly somewhere. Do you have an AssemblyInfo.cs file, if so, where is it?

EDIT:

I just saw that you said your assembly is marked as CLSCompliant. Well, that's your problem. You need to remove it because ASP.NET's batch-compiled files are not compliant: they don't need to be. Terminal assemblies (i.e. those not referenced by other assemblies, usually because they are the "application" assemblies) do not need to be CLSCompliant.

Why do you say you're "not gonna" remove the attribute? It isn't inappropriate to not have it.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top