键入' Scripting.FileSystemObject'没有定义

时间:2014-10-22 09:18:26

标签: .net vb.net scripting migration filesystemobject

我从2008年到2012年迁移了一个VB项目。正如预期的那样,有许多代码修改可以满足迁移过程。如标题所述,我该如何解决这个错误?

这是具有上述错误的行:

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

1 个答案:

答案 0 :(得分:3)

要修复错误,您需要添加对FileSystemObject的引用:

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

但绝对不需要使用FileSystemObject来使用文件系统。

您可以使用File命名空间中System.IO类中的完全托管方法:http://msdn.microsoft.com/en-us/library/system.io.file_methods(v=vs.110).aspx