Edit .*proj file from the IDE (programmatically).

Hello,

I am looking for a smart way to programmatically edit a project file (i.e. Foo.csproj), and then persist these changes without Visual Studio coming with this annoying message prompt saying something along these lines:
"Changes have been made to the current project file... To update click on Reload, otherwise Ignore...".
I have been browsing the web for quite some time now, and have yet to find a satisfactory answer.
I really hope something out here can help me out.

Many thanks, Poseidon.

[531 byte] By [Poseidon13] at [2008-1-7]
# 1
Hope this helps (not sure)

You can probably use the following to get a reference to the project.

_applicationObject.Solution.Projects.Item(Project)

I am not sure if that helps at all. As for editing the text of the file I am not sure. If that is how you are currently modifying the file, I would be interested to see the code.

Also I would recommend (if you haven't done this already) since the proj file is xml to use the xsd.exe tool to generate a class from the schema and use that to modify the file. The advantage of that is that you can just serialize/deserialize the object and adding a line to xml becomes really easy. xsd.exe is also know as the schema inference tool i think. its included with visual studio and is accessed from the commandline.

Dessus at 2007-10-2 > top of Msdn Tech,Visual Studio,Visual Studio Extensibility...
# 2
Hi Dessus,

I already have a function that deals with the rewriting of the project file's xml data. The main problem is that whenever I try to save my changes VS comes up with a message prompt, telling me that modifications to the project file have been made outside of the IDE (and from there I can either reload the project or ignore changes; in this case they will be applied the next time I load the project).
I just want to know which API to use to by pass this notification message.

Thanks, Posseidon.

Poseidon13 at 2007-10-2 > top of Msdn Tech,Visual Studio,Visual Studio Extensibility...
# 3

Hi Posseidon,

I think you should try to access project properties using automation object model. This way should prevent from prompt messagebox you are talking about. You can find a lot of automation object model HowTo-s on Carlos Quintero's website http://www.mztools.com

Hope that helps.

DmitryPavlov at 2007-10-2 > top of Msdn Tech,Visual Studio,Visual Studio Extensibility...

Visual Studio

Site Classified