
i got "Compiler Error Message: CS1595" after making a simple change in my project.
there's an msdn article on this error - however - it didn't help... something else caused the error...
here's the error page, generated by asp.net at runtime:
Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1595: 'RoleBasedAuthentication.Web.Global' is defined in multiple places; using definition from 'c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\rolebasedauthentication.web\e4f96df9\5be0184c\assembly\dl2\6e7f017a\001d645f_e3cac401\RoleBasedAuthentication.Web.DLL'
Source Error:
Line 26:
Line 27: [System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()]
Line 28: public class Global_asax : RoleBasedAuthentication.Web.Global {
Line 29:
Line 30: private static bool __initialized = false;
Source File: c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\rolebasedauthentication.web\e4f96df9\5be0184c\lwnbltp8.0.cs Line: 28
Microsoft (R) Visual C# .NET Compiler version 7.10.3052.4 for Microsoft (R) .NET Framework version 1.1.4322 Copyright (C) Microsoft Corporation 2001-2002. All rights reserved.
c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\rolebasedauthentication.web\e4f96df9\5be0184c\lwnbltp8.0.cs(28,32): error CS1595: 'RoleBasedAuthentication.Web.Global' is defined in multiple places; using definition from 'c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\rolebasedauthentication.web\e4f96df9\5be0184c\assembly\dl2\6e7f017a\001d645f_e3cac401\RoleBasedAuthentication.Web.DLL'
Show Complete Compilation Source:
Line 1: //-------------------------------------------- Line 2: //--------------------------------------------------------------------------------Line 3: // This code was generated by a tool. Line 4: // Runtime Version: 1.1.4322.573 Line 5: // Line 6: // Changes to this file may cause incorrect... Line 7: // Line 8: // Line 9: //-------------------------------------------- Line 10: Line 11: namespace ASP { Line 12: using System; Line 13: using System.Collections; Line 14: using System.Collections.Specialized; Line 15: using System.Configuration; Line 16: using System.Text; Line 17: using System.Text.RegularExpressions; Line 18: using System.Web; Line 19: using System.Web.Caching; Line 20: using System.Web.SessionState; Line 21: using System.Web.Security; Line 22: using System.Web.UI; Line 23: using System.Web.UI.WebControls; Line 24: using System.Web.UI.HtmlControls; Line 25: Line 26: Line 27: [System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()] Line 28: public class Global_asax : RoleBasedAuthentication.Web.Global { Line 29: Line 30: private static bool __initialized = false; Line 31: Line 32: public Global_asax() { Line 33: if ((ASP.Global_asax.__initialized == false)) { Line 34: ASP.Global_asax.__initialized = true; Line 35: } Line 36: } Line 37: } Line 38: } Line 39:
Some posts have indicated that this is a web server permissions problem for the ASPNET account. (The suggested solution has been to make sure that ASPNET has "read & execute" permissions from the root up the tree C:\WINNT\Microsoft.NET\Framework\... and "full control" permissions in C:\WINNT\Temp and C:\WINNT\Microsoft.NET\Framework\v1.0.3705\Temporary ASP.NET Files.
RESOLUTION
There are two typical suggestions to resolve this problem, although neither worked in my case. I found third solution. you can read about this issue at http://support.microsoft.com/kb/318274
Method One: Include the /nostdlib Option in the C# Compiler Definition To resolve this problem, modify 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:
Open the Machine.config file, and then locate the
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 Two: Grant List Permissions to the ASPNET Account (or the NetworkService account, for applications that runs on Microsoft Internet Information Services [IIS] 6.0). you can also grant "List Folder/Read Data" permissions to one of the following accounts: ASPNET account (or the NetworkService account , for applications that runs on Microsoft Internet Information Services [IIS] 6.0) Group that includes the ASPNET account (or NetworkService account). Process identity that is being used to run the ASP.NET worker process for every folder in the path to the mscorlib.dll assembly (which is usually %windir%\Microsoft.NET\Framework\Version). This is generally the root of the volume where the account does not have permissions (for example, C:\).
Note Do not use this method if you use the /nostdlib option and if you are not using Web services.
my issue / solution:
i changed the class name and output file in my project, and while the code compiles just fine - i got this error at runtime. it would also seem the temporary asp pages in the .net folder are copied when you launch the IIS process, not browse to the page as a client (so it's a server thing).
despite the fact i selected 'rebuild all' in visual studio, and deleted all the files in the temporary asp file cache, i kept getting this error!
i had to actually delete the bin and obj folders in my project. so, there must be some artifact of the old objects in those folders - not updated by the build process. that file must be copied to the temporary asp folder, and then causes the problem.
<compiler language="c#;cs;csharp"
extension=".cs"
type="Microsoft.CSharp.CSharpCodeProvider, System,
Version=1.0.3300.0,
Culture=neutral,
PublicKeyToken=b77a5c561934e089"
warningLevel="1"
compilerOptions="/nostdlib" />
Note The compilerOptions attribute is not additive. If you need to override this option in a Web.config file or on a given page, you must add the /nostdlib option in addition to your customizations.