为什么VS 2005年继续给我"'X'是不明确的命名空间中的“Y”"错误? [英] Why does VS 2005 keep giving me the "'x' is ambiguous in the namespace 'y'" error?

查看:218
本文介绍了为什么VS 2005年继续给我"'X'是不明确的命名空间中的“Y”"错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

赏金:我会送通过PayPal $ 5,修复这个问题,我的答案

Bounty: I will send $5 via paypal for an answer that fixes this problem for me.

我不知道VS设置我已经改变,或者如果它是一个web.config设置或什么,但我一直在错误列表收到此错误,但所有的解决方案打造精品。下面是一些例子:

I'm not sure what VS setting I've changed or if it's a web.config setting or what, but I keep getting this error in the error list and yet all solutions build fine. Here are some examples:


Error   5   'CompilerGlobalScopeAttribute' is ambiguous in the namespace 'System.Runtime.CompilerServices'. C:\projects\MyProject\Web\Controls\EmailStory.ascx  609 184 C:\...\Web\
Error   6   'ArrayList' is ambiguous in the namespace 'System.Collections'. C:\projects\MyProject\Web\Controls\EmailStory.ascx.vb   13  28  C:\...\Web\
Error   7   'Exception' is ambiguous in the namespace 'System'. C:\projects\MyProject\Web\Controls\EmailStory.ascx.vb   37  21  C:\...\Web\
Error   8   'EventArgs' is ambiguous in the namespace 'System'. C:\projects\MyProject\Web\Controls\EmailStory.ascx.vb   47  64  C:\...\Web\
Error   9   'EventArgs' is ambiguous in the namespace 'System'. C:\projects\MyProject\Web\Controls\EmailStory.ascx.vb   140 72  C:\...\Web\
Error   10  'Array' is ambiguous in the namespace 'System'. C:\projects\MyProject\Web\Controls\EmailStory.ascx.vb   147 35  C:\...\Web\

    [...etc...]

Error   90  'DateTime' is ambiguous in the namespace 'System'.  C:\projects\MyProject\Web\App_Code\XsltHelperFunctions.vb   13  8   C:\...\Web\

你可以想像,这真是烦人,因为波浪强调无处不在的code,并在错误列表窗格中过滤出相关的错误几乎是不可能有蓝色。我检查了默认的ASP.Net的web.config和machine.config中,但似乎没有任何站在那里。

As you can imagine, it's really annoying since there are blue squiggly underlines everywhere in the code, and filtering out relevant errors in the Error List pane is near impossible. I've checked the default ASP.Net web.config and machine.config but nothing seemed to stand out there.

编辑:的下面是一些地方在错误发生源的:

Here's some of the source where the errors are occurring:

'Error #5: whole line is blue underlined'
<%= addEmailToList.ToolTip %>

'Error #6: ArrayList is blue underlined'
Private _emails As New ArrayList()

'Error #7: Exception is blue underlined'
Catch ex As Exception

'Error #8: System.EventArgs is blue underlined'
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

'Error #9: System.EventArgs is blue underlined'
Protected Sub sendMessage_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles sendMessage.Click

'Error #10: Array is blue underlined'
Me.emailSentTo.Text = Array.Join(";", mailToAddresses)

'Error #90: DateTime is blue underlined'
If DateTime.TryParse(data, dateValue) Then


修改的:GACUTIL结果


Edit: GacUtil results


C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\gacutil -l mscorlib

Microsoft (R) .NET Global Assembly Cache Utility.  Version 1.1.4318.0
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.

The Global Assembly Cache contains the following assemblies:

The cache of ngen files contains the following entries:
        mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c5619
34e089, Custom=5a00410050002d004e0035002e0031002d003800460053002d003700430039004
40037004500430036000000
        mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c5619
34e089, Custom=5a00410050002d004e0035002e0031002d0038004600440053002d00370043003
900450036003100370035000000

Number of items = 2


"C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil" -l mscorlib

Microsoft (R) .NET Global Assembly Cache Utility.  Version 2.0.50727.42
Copyright (c) Microsoft Corporation.  All rights reserved.

The Global Assembly Cache contains the following assemblies:

Number of items = 0


修改的:从NGEN有趣的结果:


Edit: interesting results from ngen:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ngen display mscorlib /verbose

Microsoft (R) CLR Native Image Generator - Version 2.0.50727.832
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.

NGEN Roots:

mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=5a00410050002d004e0035002e0031002d003800460053002d00330037004200430043003300430035000000 
    ScenarioDefault 
        mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=5a00410050002d004e0035002e0031002d003800460053002d00330037004200430043003300430035000000 
            DisplayName = mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
            Native image = {7681CE0F-F0E7-F03A-2B56-96345589D82B}
            Hard Dependencies:
            Soft Dependencies:
mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 
    ScenarioNoDependencies 
        mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 
            DisplayName = mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
            Native image = {7681CE0F-F0E7-F03A-2B56-96345589D82B}
            Hard Dependencies:
            Soft Dependencies:

NGEN Roots that depend on "mscorlib":
[...a bunch of stuff...]

Native Images:

mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    Source MVID:    {D34102CF-2ABF-4004-8B42-2859D8FF27F3}
    Source HASH:    bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec
    NGen GUID sign: {7681CE0F-F0E7-F03A-2B56-96345589D82B}
    OS:     WinNT
    Processor:  x86(Pentium 4) (features: 00008001)
    Runtime:    2.0.50727.832
    mscorwks.dll:   TimeStamp=461F2E2A, CheckSum=00566DC9
    Flags:      
    Scenarios:      <no debug info> <no debugger> <no profiler> <no instrumentation> 
    Granted set:    <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true"/>

    File:       

C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\mscorlib\0fce8176e7f03af02b5696345589d82b\mscorlib.ni.dll
    Dependencies:
        mscorlib, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089:
            Guid:{D34102CF-2ABF-4004-8B42-2859D8FF27F3}
            Sign:bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec

mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    Source MVID:    {D34102CF-2ABF-4004-8B42-2859D8FF27F3}
    Source HASH:    bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec
    NGen GUID sign: {7681CE0F-F0E7-F03A-2B56-96345589D82B}
    OS:     WinNT
    Processor:  x86(Pentium 4) (features: 00008001)
    Runtime:    2.0.50727.832
    mscorwks.dll:   TimeStamp=461F2E2A, CheckSum=00566DC9
    Flags:      
    Scenarios:      <no debug info> <no debugger> <no profiler> <no instrumentation> 
    Granted set:    <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true"/>

    File:       

C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\mscorlib\0fce8176e7f03af02b5696345589d82b\mscorlib.ni.dll
    Dependencies:
        mscorlib, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089:
            Guid:{D34102CF-2ABF-4004-8B42-2859D8FF27F3}
            Sign:bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec

mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    Source MVID:    {D34102CF-2ABF-4004-8B42-2859D8FF27F3}
    Source HASH:    bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec
    NGen GUID sign: {7681CE0F-F0E7-F03A-2B56-96345589D82B}
    OS:     WinNT
    Processor:  x86(Pentium 4) (features: 00008001)
    Runtime:    2.0.50727.832
    mscorwks.dll:   TimeStamp=461F2E2A, CheckSum=00566DC9
    Flags:      
    Scenarios:      <no debug info> <no debugger> <no profiler> <no instrumentation> 
    Granted set:    <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true"/>

    File:       

C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\mscorlib\0fce8176e7f03af02b5696345589d82b\mscorlib.ni.dll
    Dependencies:
        mscorlib, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089:
            Guid:{D34102CF-2ABF-4004-8B42-2859D8FF27F3}
            Sign:bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec

mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    Source MVID:    {D34102CF-2ABF-4004-8B42-2859D8FF27F3}
    Source HASH:    bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec
    NGen GUID sign: {7681CE0F-F0E7-F03A-2B56-96345589D82B}
    OS:     WinNT
    Processor:  x86(Pentium 4) (features: 00008001)
    Runtime:    2.0.50727.832
    mscorwks.dll:   TimeStamp=461F2E2A, CheckSum=00566DC9
    Flags:      
    Scenarios:      <no debug info> <no debugger> <no profiler> <no instrumentation> 
    Granted set:    <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true"/>

    File:       

C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\mscorlib\0fce8176e7f03af02b5696345589d82b\mscorlib.ni.dll
    Dependencies:
        mscorlib, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089:
            Guid:{D34102CF-2ABF-4004-8B42-2859D8FF27F3}
            Sign:bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec

mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    Source MVID:    {D34102CF-2ABF-4004-8B42-2859D8FF27F3}
    Source HASH:    bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec
    NGen GUID sign: {7681CE0F-F0E7-F03A-2B56-96345589D82B}
    OS:     WinNT
    Processor:  x86(Pentium 4) (features: 00008001)
    Runtime:    2.0.50727.832
    mscorwks.dll:   TimeStamp=461F2E2A, CheckSum=00566DC9
    Flags:      
    Scenarios:      <no debug info> <no debugger> <no profiler> <no instrumentation> 
    Granted set:    <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true"/>

    File:       

C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\mscorlib\0fce8176e7f03af02b5696345589d82b\mscorlib.ni.dll
    Dependencies:
        mscorlib, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089:
            Guid:{D34102CF-2ABF-4004-8B42-2859D8FF27F3}
            Sign:bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec

mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    Source MVID:    {D34102CF-2ABF-4004-8B42-2859D8FF27F3}
    Source HASH:    bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec
    NGen GUID sign: {7681CE0F-F0E7-F03A-2B56-96345589D82B}
    OS:     WinNT
    Processor:  x86(Pentium 4) (features: 00008001)
    Runtime:    2.0.50727.832
    mscorwks.dll:   TimeStamp=461F2E2A, CheckSum=00566DC9
    Flags:      
    Scenarios:      <no debug info> <no debugger> <no profiler> <no instrumentation> 
    Granted set:    <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true"/>

    File:       

C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\mscorlib\0fce8176e7f03af02b5696345589d82b\mscorlib.ni.dll
    Dependencies:
        mscorlib, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089:
            Guid:{D34102CF-2ABF-4004-8B42-2859D8FF27F3}
            Sign:bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec

mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    Source MVID:    {D34102CF-2ABF-4004-8B42-2859D8FF27F3}
    Source HASH:    bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec
    NGen GUID sign: {7681CE0F-F0E7-F03A-2B56-96345589D82B}
    OS:     WinNT
    Processor:  x86(Pentium 4) (features: 00008001)
    Runtime:    2.0.50727.832
    mscorwks.dll:   TimeStamp=461F2E2A, CheckSum=00566DC9
    Flags:      
    Scenarios:      <no debug info> <no debugger> <no profiler> <no instrumentation> 
    Granted set:    <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true"/>

    File:       

C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\mscorlib\0fce8176e7f03af02b5696345589d82b\mscorlib.ni.dll
    Dependencies:
        mscorlib, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089:
            Guid:{D34102CF-2ABF-4004-8B42-2859D8FF27F3}
            Sign:bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec

mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    Source MVID:    {D34102CF-2ABF-4004-8B42-2859D8FF27F3}
    Source HASH:    bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec
    NGen GUID sign: {7681CE0F-F0E7-F03A-2B56-96345589D82B}
    OS:     WinNT
    Processor:  x86(Pentium 4) (features: 00008001)
    Runtime:    2.0.50727.832
    mscorwks.dll:   TimeStamp=461F2E2A, CheckSum=00566DC9
    Flags:      
    Scenarios:      <no debug info> <no debugger> <no profiler> <no instrumentation> 
    Granted set:    <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true"/>

    File:       

C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\mscorlib\0fce8176e7f03af02b5696345589d82b\mscorlib.ni.dll
    Dependencies:
        mscorlib, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089:
            Guid:{D34102CF-2ABF-4004-8B42-2859D8FF27F3}
            Sign:bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec

mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    Source MVID:    {D34102CF-2ABF-4004-8B42-2859D8FF27F3}
    Source HASH:    bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec
    NGen GUID sign: {7681CE0F-F0E7-F03A-2B56-96345589D82B}
    OS:     WinNT
    Processor:  x86(Pentium 4) (features: 00008001)
    Runtime:    2.0.50727.832
    mscorwks.dll:   TimeStamp=461F2E2A, CheckSum=00566DC9
    Flags:      
    Scenarios:      <no debug info> <no debugger> <no profiler> <no instrumentation> 
    Granted set:    <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true"/>

    File:       

C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\mscorlib\0fce8176e7f03af02b5696345589d82b\mscorlib.ni.dll
    Dependencies:
        mscorlib, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089:
            Guid:{D34102CF-2ABF-4004-8B42-2859D8FF27F3}
            Sign:bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec

mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    Source MVID:    {D34102CF-2ABF-4004-8B42-2859D8FF27F3}
    Source HASH:    bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec
    NGen GUID sign: {7681CE0F-F0E7-F03A-2B56-96345589D82B}
    OS:     WinNT
    Processor:  x86(Pentium 4) (features: 00008001)
    Runtime:    2.0.50727.832
    mscorwks.dll:   TimeStamp=461F2E2A, CheckSum=00566DC9
    Flags:      
    Scenarios:      <no debug info> <no debugger> <no profiler> <no instrumentation> 
    Granted set:    <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true"/>

    File:       

C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\mscorlib\0fce8176e7f03af02b5696345589d82b\mscorlib.ni.dll
    Dependencies:
        mscorlib, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089:
            Guid:{D34102CF-2ABF-4004-8B42-2859D8FF27F3}
            Sign:bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec

mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    Source MVID:    {D34102CF-2ABF-4004-8B42-2859D8FF27F3}
    Source HASH:    bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec
    NGen GUID sign: {7681CE0F-F0E7-F03A-2B56-96345589D82B}
    OS:     WinNT
    Processor:  x86(Pentium 4) (features: 00008001)
    Runtime:    2.0.50727.832
    mscorwks.dll:   TimeStamp=461F2E2A, CheckSum=00566DC9
    Flags:      
    Scenarios:      <no debug info> <no debugger> <no profiler> <no instrumentation> 
    Granted set:    <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true"/>

    File:       

C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\mscorlib\0fce8176e7f03af02b5696345589d82b\mscorlib.ni.dll
    Dependencies:
        mscorlib, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089:
            Guid:{D34102CF-2ABF-4004-8B42-2859D8FF27F3}
            Sign:bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec

目前应该只有一个mscorlib程序在本地的图像,对不对?我怎样才能摆脱别人?

There should only be one mscorlib in the native images, correct? How can I get rid of the others?

推荐答案

根据您的GACUTIL输出结果(感谢这样做,我认为它可以帮助),我会说你需要尝试和运行维修的.NET框架安装和Visual Studio 2005,我不知道这将修复它,但你可以从GACUTIL的输出看,你有没有为2.0。

Based on the results of your gacutil output (thanks for doing that; I think it helps), I would say you need to try and run a repair on the .NET Framework install and Visual Studio 2005. I'm not sure if that will fix it, but as you can see from the output of the gacutil, you have none for 2.0.

这是我的VS2005命令提示符下,我得到:

From my VS2005 Command Prompt, I get:


Microsoft (R) .NET Global Assembly Cache Utility.  Version 2.0.50727.42
Copyright (c) Microsoft Corporation.  All rights reserved.

The Global Assembly Cache contains the following assemblies:
  mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=x86

Number of items = 1

这是我的VS2003命令提示符下,我得到:

From my VS2003 Command Prompt, I get:


Microsoft (R) .NET Global Assembly Cache Utility.  Version 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.

The Global Assembly Cache contains the following assemblies:

The cache of ngen files contains the following entries:
    mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=5a00410050002d004e0035002e0031002d003800460053002d00330037004200430043003300430035000000
    mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=5a00410050002d004e0035002e0031002d0038004600440053002d00330037004200440036004600430034000000

Number of items = 2

这篇关于为什么VS 2005年继续给我&QUOT;'X'是不明确的命名空间中的“Y”&QUOT;错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆