Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

Set the BuildAction of a document

$
0
0
I am currently trying to set the BuildAction of files which are in a project. Additionally I really want to avoid the use of `BrowseObject`'s and the DTE. So I ended up with the following:
public void SetBuildAction(string buildAction)
{
    ThreadHelper.ThrowIfNotOnUIThread();

    var result = Hierarchy.SetProperty(ItemId, (int)__VSHPROPID4.VSHPROPID_BuildAction, buildAction);

    ErrorHandler.ThrowOnFailure(result);
}
However, the method is returning me a the following error code:
DISP_E_MEMBERNOTFOUND -2147352573

A return value indicating that the requested member does not exist, or the call to Invoke tried to set the value of a read-only property.
Since the `GetProperty` method with the same `propId` works as expected, I suspect that this property is read-only. I know for a fact that you can change this value and you are even allowed to by the user, so how comes? Is there any alternative?

Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>