Weird error in C#
I have the following code,
TextWriter writer = new StreamWriter(@"c:\temp\ab开发者_开发知识库c.txt")
but it is raising this in while compile
Error 1 Friend access was granted to 'System, PublicKey=00000000000000000400000000000000', but the output assembly is named 'System, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Try adding a reference to 'System, PublicKey=00000000000000000400000000000000' or changing the output assembly name to match. c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\mscorlib.dll System
Anyone has an idea why?
Shot in the dark...
Have you called your project "System", or do you have "System" in your namepsace? If you have .Net will get terribly confused as there is already something called System.dll
. Call your project something else, so the output dll is named differently.
Do you have different versions of same DLLs? In the past I got a similar exception when I installed two versions of Crystal Report and used its APIs in my code.
精彩评论