Unable to generate temporary class in Windows 2008 R2 64 bit for C# app
I have no clue whats going on here. My c# (VS2008) app runs fine in 32 bit OS but when i run the same in Windows 2008 R2 64bit i am getting following error:
Unable to generate a temporary class (result=1). error CS0008: Unexpected error reading metadata from file 'c:\Windows\assembly\GAC_MSIL\xxxx\7.0.1001.0__5b72a65e64576834\xxxx.dll' -- 'Bad Key. '
Looked through some articles, which says if there is no sufficient permissions to temp folder this error will popup. And i have given permissions to temp folder "C:\windows\temp" and user temp folder ("C:\users\\appdata\local\temp") but no luck. I have a webservice proxy class in this assembly, which requires XML serialization and i guess uses temp folder to create serialized assembly at run time, where it is throwing this error.
Any inputs much appreciated. BTW i 开发者_开发百科found that error (unable to generate.....) in event viewer.
Thanks.
There are a couple of fundamental things wrong in your question. This is a compile time error, not a runtime error. Note CS0008 in the message, documented as:
A DLL was successfully opened for retrieving metadata but is corrupted, such that data could not be read from it. For more information, see /reference (Import Metadata) (C# Compiler Options).
Next thing that's wrong is that this assembly clearly comes from the GAC. The compiler should never reference an assembly from the GAC, reference assemblies have to be copies stored in a relevant directory. Like c:\windows\microsoft.net\etc for the .NET framework assemblies.
Whatever you did to get this error clearly voided the warranty. I cannot reverse-engineer what you did from your question, obfuscating the assembly name certainly did not help.
精彩评论