ProjectFile.SetBuildActionProperty doesn't work

I have a QuickFix that attempts to fix the BuildAction property of a project file.  If the project file is set to BuildAction == NONE, the warning appears.  In the QuickFix, I try to call SetBuildActionProperty(BuildAction.CONTENT, true); and it does not seem to work.  The Resharper API seems to think it worked -- it reports the BuildAction as CONTENT.  However, saving the project file saves a BuildAction of NONE, and then the API begins reporting NONE as the BuildAction again.

Similarly, I have another QuickFix that adds a file when a file is detected as missing.  This quickfix uses ProjectFile.CreateFileNearby() to create the new file in the same folder.  It then calls .SetBuildActionProperty on the returned IProjectFile instance.  This has the same behavior -- it causes the R# API to claim the BuildAction was changed but then the project file has the file marked as NONE.

Does this functionality work?  Is there a specific way it must be called for it to work?



Please sign in to leave a comment.