The type or namespace name 'FileIO' does not exist in the namespace 'Microsoft.VisualBasic'

I am using visual studio 2012 and .Net framework 4.5 . I have included "Microsoft.VisualBasic" in my project link.

I am getting the following error while executing the project.

Compilation Error Description: An error occurred while compiling a resource required to service this request. please review the following specific error details and change the code source accordingly.

Compiler Error Message: CS0234: The type or namespace name 'FileIO' does not exist in the namespace 'Microsoft.VisualBasic' (are you missing an assembly reference?)

Source error:

      int lineNumber = 0;
      int flag = 1;
     using (Microsoft.VisualBasic.FileIO.TextFieldParser parser = new Microsoft.VisualBasic.FileIO.TextFieldParser(file))
     {
        parser.CommentTokens = new string[] { "#" };

      

I tried adding the link over and over again but it doesn't seem to work.

I even tried the answers from the following question on Stack Overflow but nothing helped microsoft.visualbasic.fileio doesn't exist

here is my reference and properties of Microsoft visual basic

Please help me

+3


source to share


3 answers


I solved this problem now

I copied the Microsoft.VisualBasic.dll file to the bin folder of my project and now it seems to be working fine. (OR) You can change the link properties as follows



right click the Microsoft.VisualBasic reference in solution explorer and change ** Copy Local ** property value as '** True **'

-> Right click on the Microsoft.VisualBasic link in the solution explorer and change the value of the Copy Local property to " True ". This will do the trick

+2


source


Like Mark Richman, he still didn't give me access to FileIO. What I did was click Tools-> NuGet PackageManager-> Manage NuGet Packages for solution. Search Microsoft.VisualBasic. Click "Install" and he gave some terms that I accepted. After setting this path, I was able to get the FileIO parameter.



+1


source


I ran into this error while writing unit tests and thought I added a link to my project as described above (and in this answer ). However, I was adding a link to my unit test project and not my main project. Just in case someone is as dumb as me: add a link to the correct project, clean up the project / solution and then make a profit.

+1


source







All Articles