vb.net 未定义类型“Scripting.FileSystemObject”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26504141/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Type 'Scripting.FileSystemObject' is not defined
提问by codefish06
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?
我从2008年迁移了一个VB项目到2012年,果然有很多代码修改来满足迁移过程。如标题所述,如何解决此错误?
Here is the line having the said error:
这是具有上述错误的行:
Dim FSO As Scripting.FileSystemObject
FSO = New Scripting.FileSystemObject
回答by Matt Wilko
To fix your error you need to add a reference to the FileSystemObject:
要修复您的错误,您需要添加对以下内容的引用FileSystemObject:
Project>Properties>References>Add>COM>Microsoft Scripting Runtime
Project>Properties>References>Add>COM>Microsoft Scripting Runtime
But there is absolutely no need to use the FileSystemObject to use the file system.
但是绝对没有必要使用 FileSystemObject 来使用文件系统。
You can use the fully managed methods in the Fileclass in the System.IOnamespace: http://msdn.microsoft.com/en-us/library/system.io.file_methods(v=vs.110).aspx
您可以File在System.IO命名空间中的类中使用完全托管的方法:http: //msdn.microsoft.com/en-us/library/system.io.file_methods(v=vs.110).aspx

