Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to generate a temporary class

Tags:

iis

Unable to generate a temporary class (result=1). error CS2001: Source
file 'C:\Windows\TEMP\h3ugizgc.0.cs' could not be found error CS2008:
No inputs specified

error line
MemoryStream stream = new MemoryStream(System.Text.Encoding.Default.GetBytes(xmlSettings));
Line 52:                 XmlSerializer serializer = new XmlSerializer(typeof(Items));
Line 53:                 items = (Items)serializer.Deserialize(stream);

I am getting this error message when I try to rum my application using IIS on Windows 7.

like image 955
Kuttan Sujith Avatar asked Jan 20 '23 11:01

Kuttan Sujith


2 Answers

Is your application configured to run under a specific user account?

If so, check the user account associated to the application has List Folder Contents and Read permissions on the %windir%\Temp folder.

like image 90
vc 74 Avatar answered Feb 08 '23 06:02

vc 74


I know this is an old question but it's still valid (and the issue still happens), and here's more information in case anyone else runs into this: http://blog.coderunnr.com/2012/06/net-xmlserializer-unable-to-generate-a-temporary-class/.

The post includes a couple of solutions (adding an attribute to the schema) with examples. The problem is actually a bug in .NET's XmlSerializer: http://connect.microsoft.com/VisualStudio/feedback/details/349967/xsd-exe-generates-code-with-the-wrong-type-in-an-xmlarrayitemattribute

like image 34
spork Avatar answered Feb 08 '23 07:02

spork