[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 530
  • Last Modified:

Upgrading window application in vs 2003 to vs 2005.

Hi, I need to upgrade a window application in visual studio 2003 to visual studio 2005, I tried the conversion wizard but there are still many other libraries that need to be fixed. This is one of the error I am getting:  'FileSystemObject' is ambiguous in the namespace 'Scripting'.

Please assist when possible.

Thanks
0
vielkacarolina1239
Asked:
vielkacarolina1239
  • 4
  • 4
2 Solutions
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Why are you using FSO in a .Net project?...use the System.IO namespace.  VB.Net 2005 specifically has an entire "My.Computer.FileSystem" namespace for working with files as well.
0
 
vielkacarolina1239Author Commented:
I am converting somebody else project.
0
 
Priest04Commented:
As idle_mind said, you should convert FSO to System.IO. The person that wrote the project shouldnt have used FSO in VS2003, most probably he has migrated from VB6 world.

Here is a start for you

http://support.microsoft.com/kb/304427

Goran
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Can you show us which line causes the "'FileSystemObject' is ambiguous in the namespace 'Scripting'" error?
0
 
vielkacarolina1239Author Commented:
this line:

iReadFile = fso.OpenTextFile(sINIInputFile, Scripting.IOMode.ForReading, False, Scripting.Tristate.TristateUseDefault)
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
So what is "fso" declared as?  Can we see the OpenTextFile() function?
0
 
vielkacarolina1239Author Commented:
There is not an implementation for OpenTextFile(), I believe is built in, the fso file declaration is as follow
Dim fso As  Scripting.FileSystemObject
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
I see now...your app must have a COM Reference to the "Microsoft Scripting Runtime" then:

    Project --> Add Reference --> COM Tab --> "Microsoft Scripting Runtime"

A made a quick VB.Net 2005 Express app with this in it:

            Dim fso As New Scripting.FileSystemObject
            Dim iReadFile As Scripting.TextStream
            Dim sINIInputFile As String = "c:\someFile.txt"
            iReadFile = fso.OpenTextFile(sINIInputFile, Scripting.IOMode.ForReading, False, Scripting.Tristate.TristateUseDefault)
            Debug.Print(iReadFile.ReadAll)
            iReadFile.Close()

...and it it ran fine with no problems at all.  =\

*** shot in the dark***
Try removing the Scripting reference and then adding it back in to see if that "fixes" anything:

    In the Solution Explorer Pane, click the "Show All Files" button.
    Expand the References node.
    Right click "Scripting" and Select "Remove".

Then add it back in:

    Click Project --> Add Reference --> COM Tab --> "Microsoft Scripting Runtime"
0
 
vielkacarolina1239Author Commented:
Thanks guys this solved the problem.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now