“microsoft.visualbasic.fileio 不存在";尝试使用 TextFieldParser [英] "microsoft.visualbasic.fileio does not exist" trying to use TextFieldParser

查看:40
本文介绍了“microsoft.visualbasic.fileio 不存在";尝试使用 TextFieldParser的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在许多网站上看到多次询问上述问题,但我还没有看到解决问题的答案.

I've seen the above question asked many times on many sites, but I haven't seen an answer that fixed the problem.

剧情是这样的……我在 .NET Framework 4.0 上,使用 Razor 视图引擎在 VisualStudio 2012 Express 中构建 C# Web 应用程序.

The scenario is this... I am on .NET Framework 4.0, building a C# web application in VisualStudio 2012 Express with the Razor view engine.

我正在尝试在我的代码中使用 Microsoft.VisualBasic.FileIO.TextFieldParser.从我读过的内容来看,通过添加对 Microsoft.VisualBasic 的项目引用(我已经完成)并编码 @using Microsoft.VisualBasic 来这样做是合适的在我看来.但是,当我编码时...

I'm trying to use Microsoft.VisualBasic.FileIO.TextFieldParser in my code. From what I've read it is appropriate to do so by adding a project reference to Microsoft.VisualBasic, which I've done, and coding @using Microsoft.VisualBasic; in my view. However when I code...

Microsoft.VisualBasic.FileIO.TextFieldParser parser = new Microsoft.VisualBasic.FileIO.TextFieldParser(new StringReader(xxxxxxxx));

...在视图和重建解决方案中,它返回错误:命名空间Microsoft.VisualBasic"中不存在类型或命名空间名称FileIO"(您是否缺少程序集引用?)

...in the view and rebuild the solution it returns errors: The type or namespace name 'FileIO' does not exist in the namespace 'Microsoft.VisualBasic' (are you missing an assembly reference?)

我知道引用在正确的项目中,因为当我添加和删除它时,我看到它从引用文件夹中来来去去.我知道我尝试引用的代码存在,因为我可以在对象浏览器中看到它.我什至尝试使用对象浏览器而不是通过菜单添加引用,尽管添加了引用,但结果是相同的.

I know the reference is in the correct project because when I add and remove it I see it come and go from the references folder. I know the code I'm trying to reference exists because I can see it in Object Browser. I've even tried adding the reference using Object Browser instead of through the menus and although it gets added, the results are the same.

它的解决方案有点复杂,所以我尝试只创建一个独立的 C# 测试项目,我得到了相同的结果.我还尝试创建一个独立的 Visual Basic 项目,果然,它在那里像宣传的那样工作.我绝不是 Visual Studio 的专家,所以我猜这只是我在配置中缺少的东西,但我无法弄清楚.

The solution it's in is a bit complicated so I tried just creating a test stand alone C# project and I get the same results. I also tried creating a test stand alone Visual Basic project, and sure enough, it works there as advertised. I'm by no means an expert on Visual Studio so I'm guessing that it's just something I'm missing in the configuration, but I'm at a loss to figure it out.

我已经为此花费了数天时间,因此任何人都可以提供任何帮助,我们将不胜感激.

I've spent days on this, so any help anyone could offer would be greatly appreciated.

推荐答案

  1. 右键单击您的项目并选择添加引用...

  1. Right-click on your project and select Add Reference...

在参考管理器中,展开程序集并选择框架.然后选中 Microsoft.VisualBasic 框并单击确定".

In the Reference Manager, expand Assemblies and select Framework. Then check the box for Microsoft.VisualBasic and click OK.

归功于:https://stackoverflow.com/a/17146200/2530360

我刚刚遇到了同样的问题,而且你的问题标题更冗长,所以我认为里面应该有答案.

I just had the same problem and your question title was more verbose so I figured it should have the answer inside.

这篇关于“microsoft.visualbasic.fileio 不存在";尝试使用 TextFieldParser的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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