Article ID: 318274 - Last Review: April 19, 2007 - Revision: 4.6 Error message when you use the C# compiler to compile an ASP.NET resource: "Compiler Error Message: CS1595"This article was previously published under Q318274 On This PageSYMPTOMS When you use the C# compiler (Csc.exe) to compile an
ASP.NET resource, you may receive a compiler error message that is similar to
one of the following error messages: Message 1 Compiler Error
Message: CS1595: 'System.Collections.ArrayList' is defined in multiple places;
using definition from 'c:\winnt\microsoft.net\framework\v1.0.3705\mscorlib.dll'
Message 2 Compiler Error Message: CS1595:
'System.Runtime.CompilerServices.CompilerGlobalScopeAttribute' is defined in
multiple places; using definition from
'c:\windows\microsoft.net\framework\v1.0.3705\mscorlib.dll' CAUSE This issue occurs because the C# compiler does not have
permission to access the folders in the path to the mscorlib.dll assembly.
RESOLUTION To resolve this issue, use one of the following methods.
(The methods are listed in the order of preference.) Method 1Modify the compiler definition for the C# compiler to include the /nostdlib option. The /nostdlib option prevents the import of the mscorlib.dll assembly, which defines the entire System namespace.To include the /nostdlib option in the C# compiler definition on a computer, follow these steps:
Note You cannot use this method for applications that use the XmlSerializer class or Web services because the compiler invocation that XmlSerializer uses does not inherit these options. Method 2Grant List permissions to the process identity that is being used to run the ASP.NET worker process for every folder in the path of the mscorlib.dll assembly. Typically, this path is %WinDir%\Microsoft.NET\Framework\Version. This is generally the root of the volume where the account does not have permissions. For example, the root may be C:\.Note Do not use this method if the following conditions are true:
Method 3Grant "List Folder/Read Data" permissions to one of the following accounts:
STATUSThis
behavior is by design. MORE INFORMATION Web services use the C# compiler to compile their proxies,
regardless of whether they are written in Visual Basic .NET or Visual C# .NET.
Therefore, you may receive this error message even if you are working with a
Visual Basic .NET project. Note that you can also receive similar compiler error messages if you combine the src and the codebehind attributes in a single page. However, this is considered a developer error. If you are encountering the specific issue that is described in this article, the error message always specifies the mscorlib.dll assembly. Default access control lists on a volume grant the Everyone and the Users groups permission to read and to list files. However, sometimes these permissions are removed to provide a more secure environment. When this occurs, Csc.exe cannot cannibalize path names. Because ASP.NET does not currently provide the /nostdlib option to the compiler, the compiler contains multiple instances of assemblies. This issue does not occur when you use the Visual Basic .NET compiler (Vbc.exe) to compile resources. REFERENCES For more information, visit the following Microsoft Developer Network (MSDN) Web site:
http://msdn2.microsoft.com/en-us/library/a15ebt6c(vs.71).aspx
(http://msdn2.microsoft.com/en-us/library/a15ebt6c(vs.71).aspx)
| Article Translations
|
Back to the top
