Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by moblab · Apr 09, 2021 at 01:44 AM · monodevelopvisual studiomonovisualstudio

Using TextFieldParser class from Microsoft.VisualBasic.FileIO

Hi, I am trying to use the TextFieldParser class to parse some CSV files in my project.

I am using Unity 2019.3.9f1. Under Edit > Project Settings > Player > Other Settings, I have API Compatibility Level set to .NET 4.x. (Supposedly, this should provide my project access to .NET 4 API, which contains Microsoft.VisualBasic.FileIO.) In the C# script I am attempting to use TextFieldParser in, I have "using Microsoft.VisualBasic.FileIO;". When I open my Unity project, I receive the following error message in the Unity console: "error CS0234: The type or namespace name 'FileIO' does not exist in the namespace 'Microsoft.VisualBasic' (are you missing an assembly reference?)".

The platform I have specified in Build Settings is iOS if that is relevant information also.

I have tried adding an assembly reference through Visual Studio (Community 2019). I open up the .csproj file overseeing the .cs file that I am trying to add TextFieldParser to, right-click it to add a reference, and browse to the Microsoft.VisualBasic.dll file found in my Unity installation's folder (C:\Program Files\Unity\Hub\Editor\2019.3.9f1\Editor\Data\MonoBleedingEdge\lib\mono\4.7.1-api\Microsoft.VisualBasic.dll). This reference gets added (and I am able to create a TextFieldParser object without incident), but upon re-launching my Unity project, it gets removed! And I am left with the same error message in the Unity console.

I would appreciate any help to resolve this mystery.

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Llama_w_2Ls · Apr 09, 2021 at 07:55 AM 1
Share

I believe that if you install a package from the NuGet package manager from within Visual Studio, it's recognised by VS, but not Unity. To do that correctly, you need to find the .dll file for the plugin, create a new folder in your Unity assets folder called 'Plugins', and drag in the .dll file. Then, it should recognise the namespace, I believe. @moblab

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by moblab · Apr 09, 2021 at 12:54 PM

Hello, I have solved my problem.

First, I changed my API Compatibility Level to .NET Standard 2.0. Then, I copied and pasted the Microsoft.VisualBasic.dll from here () to my Unity project's Assets folder. Finally, I restarted my Unity editor. And no more console errors!

(I also tried @Llama_w_2Ls suggestion of putting the .dll file into the Assets/Plugins folder. That works too, provided that the API Compatibility Level is set to .NET Standard 2.0.)

Strange that Microsoft.VisualBasic.FileIO is not recognized when the API Compatibility Level is set to .NET 4.x. Perhaps it's my Unity installation? Anyway, I hope this answer helps someone in the future.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image moblab · Apr 09, 2021 at 12:56 PM 0
Share

Whoopsies, I forgot to add the filepath of the Microsoft.VisualBasic.dll that I had used. Here it is: C:\Program Files\Unity\Hub\Editor\2019.3.9f1\Editor\Data\MonoBleedingEdge\lib\mono\2.0-api\Microsoft.VisualBasic.dll.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

120 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

vscode - exclude directories from warnings + code style linter 0 Answers

How Do I use Mono Debugging in Unity 3.0? 1 Answer

Difference between differrent csproj files (there are 3) in a unity editor (rider) 1 Answer

Is it possible for unity to open visual studio as a dumb text editor? 0 Answers

Can't save C# scripts? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges