简体   繁体   中英

Type 'Scripting.FileSystemObject' is not defined

I have migrated a VB project from 2008 to 2012. As expected, there are many code modification to meet the migration process. As stated in the title, how can I resolved this error?

Here is the line having the said error:

Dim FSO As Scripting.FileSystemObject
FSO = New Scripting.FileSystemObject

To fix your error you need to add a reference to the FileSystemObject :

Project>Properties>References>Add>COM>Microsoft Scripting Runtime

But there is absolutely no need to use the FileSystemObject to use the file system.

You can use the fully managed methods in the File class in the System.IO namespace: http://msdn.microsoft.com/en-us/library/system.io.file_methods(v=vs.110).aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM