C# – The type or namespace name ‘FileIO’ does not exist in the namespace ‘Microsoft.VisualBasic’

asp.netcvisual studio

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

I am getting the following error while executing the project.

Compilation Error Description: An error occurred during the
compilation of a resource required to service this request. Please
review the following specific error details and modify your source
code appropriately.

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 had tried adding the reference again and again but it doesn't seems to be working.

I even tried the answers from following question in Stack Overflow but nothing helped
microsoft.visualbasic.fileio does not exist

here is my reference and properties of Microsoft visual basic

Please help me

Best Answer

I got this problem solved now

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

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

-> Right click the Microsoft.VisualBasic reference in solution explorer and change Copy Local property value as 'True' . This will do the trick