I'm trying to work on a Visual Studio Extension that needs to add a property that gets persisted to the current csproj file like so:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MyProperty Condition="$(MyProperty) == '' Or $(MyProperty) == '*Undefined*'">MyPropertyValue</MyProperty>
I have an ENVDTE.Project instance, but can't seem to find anywhere in the API to add a new property to the project.
I'm able to work around the issue by converting it to an MSBuild project and adding the property that way, but that approach causes the user to get prompted that the csproj file has been modified outside of the IDE and asks them to re-load, which I don't want.
How can I either add the property with the ENVDTE.Project instance, or prevent the 'Modified outside the environment' prompt from showing up in some other way?