/// <summary> /// Sets the value of an MSBuild project property. /// </summary> /// <param name="propertyName">The name of the property to change.</param> /// <param name="propertyValue">The value to assign the property.</param> /// <param name="condition">The condition to use on the property. Corresponds to the Condition attribute of the Property element.</param> public void SetProjectProperty(string propertyName, string propertyValue, string condition) { WixHelperMethods.VerifyStringArgument(propertyName, "propertyName"); if (propertyValue == null) { propertyValue = String.Empty; } // see if the value is the same as what's already in the project so we // know whether to actually mark the project file dirty or not string oldValue = this.GetProjectProperty(propertyName, true); if (!String.Equals(oldValue, propertyValue, StringComparison.Ordinal)) { // check out the project file if (this.ProjectMgr != null && !this.ProjectMgr.QueryEditProjectFile(false)) { throw Marshal.GetExceptionForHR(VSConstants.OLE_E_PROMPTSAVECANCELLED); } // Use condition! this.BuildProject.SetProperty(propertyName, propertyValue); //, condition); // refresh the cached values this.SetCurrentConfiguration(); this.SetProjectFileDirty(true); } }