Monthly Archives: October 2007

Updating a file in a Visual Studio project from VFP is pretty straightforward.

First up, get a reference to the project:

oVS = createobject("VisualStudio.Solution.8.0") && VS2005 
oVS.Open("C:\projects\example.sln")
oProject = oVS.Projects(1)

Each project has a ProjectItems collection: each can be a folder or a file. The items can be referenced by name, so this returns a reference to an XML file in the XML folder:

oDocument = oProject.ProjectItems("XML").ProjectItems("file.xml")

Each item has a URL property which indicates (for a file) the file name, but this is only available via the Properties collection:

cFilePath = substr(oDocument.Properties("URL").Value, 9) && strip off file:///
xmltocursor(alias(), "_cliptext")… Continue reading