Visual Studio 2008 网站参考的奇怪问题

发布于 2024-08-06 20:37:25 字数 394 浏览 4 评论 0 原文

我正在尝试在 Visual Studio 2008 网站项目中添加对 System.Xml 的 GAC 版本的引用。我右键单击解决方案资源管理器中的项目图标,然后单击“属性页”。在“引用”树选项下,我单击右侧的“添加”按钮。我导航到 .NET 选项卡中的 System.Xml,然后双击它(它列出的 System.Xml 路径为 C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.XML.dll,确实存在) 。该对话框消失了,但是... System.Xml 没有被添加为引用!该列表保持不变。

我尝试添加另一个 .NET 引用,只是为了确保其他引用可以正常添加,我添加了 System.Web.RegularExpressions,它添加​​得很好。究竟是什么原因导致它不添加 System.Xml?

I'm trying to add a reference to the GAC version of System.Xml in a Visual Studio 2008 web site project. I right-click the project icon in the Solution Explorer, and click Property Pages. Under the References tree option, I click the 'Add' button on the right. I navigate to System.Xml in the .NET tab, and double click it (the Path it lists for System.Xml, C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.XML.dll, DOES exist). The dialog disappears, but... System.Xml does not get added as a reference! The list just stays the same.

I tried adding another .NET reference just to make sure others could be added OK, I added System.Web.RegularExpressions and it added fine. What on earth could be causing it not to add System.Xml?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

云胡 2024-08-13 20:37:25

尝试编辑您的 vbproj 文件,然后添加

<Reference Include="System.Xml" />

Try to edit your vbproj file, and add

<Reference Include="System.Xml" />
唔猫 2024-08-13 20:37:25

我刚刚使用默认语言 C# 和 C# 创建了一个 ASP.NET 网站。 .NET 2.0作为目标。我还观察到,即使您尝试添加对 System.XML 的引用,您也不会在项目属性页面中找到引用。

就我而言,它是按照设计的。

默认情况下,您只需添加“using NAMESPACE_NAME;”即可访问所有默认的 .NET 命名空间(在您的目标版本中)。在你的代码后面。(系统(以及子命名空间,如 XML 等)。ASP、Microsoft 和 MS)仅当您引用第三方 .NET dll 或非 ASP.NET 网站项目默认值的内容时(不能在网上找到默认值列表),然后创建一个名为 bin 的新文件夹并创建一个名为 bin 的新文件夹。如果 GAC 中没有该 dll,则该 dll 的副本会存储在其中。

编辑:关于无法将cs文件添加到vb文件,我只是这样做了,&我可以访问 vb 文件中的 System.Xml 命名空间。

I just created a ASP.NET Website with default language C# & .NET 2.0 as the target. I also observed that even if you try to add a reference to System.XML, you will not find one in the project proprieties page.

As far it goes for me, its as designed.

By default you can access all the default .NET namespaces (in your target version) by just adding "using NAMESPACE_NAME;" in you code behind.(System (& the sub namespaces like XML etc). ASP, Microsoft & MS) Only when you reference a third party .NET dll or something that's not default for an ASP.NET Website project (could not find the list of defaults on the net), then a new folder called bin is created & a copy of that dll is stored in it if it is not in GAC.

EDIT: Regarding not able to add a cs file to vb file, I just did that, & I could access System.Xml namespace in the vb file.

心房的律动 2024-08-13 20:37:25

好吧,看起来这可能与我尝试将 .cs 文件添加到其余文件位于 vb.net 中的项目有关。嗯,我认为 .NET 的主要好处之一是您可以轻松地混合语言。哦,好吧,我删除了它并将这些行添加到我的 web.config 文件中:

<add namespace="System.Xml"/>

现在

<add assembly="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

它编译正常。我可以从 VB 代码中访问 System.Xml,因此看起来我必须将我拥有的类从 C# 转换为 VB.net。哼。

Well it looks like it might have had something to do with my trying to add a .cs file to a project where the rest of the files were in vb.net. Hmph, I thought one of the major benefits of .NET was you could easily mix languages. Oh well, I removed that and added these lines into my web.config file:

<add namespace="System.Xml"/>

and

<add assembly="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

and now it compiles OK. I can access System.Xml from within VB code, so it looks like I'll have to translate the class I had from C# to VB.net. Hmph.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文