Fixed project properties bug.

This commit is contained in:
José Pedro 2017-05-24 22:01:27 +01:00
parent 9c90f7eaae
commit bc9bbb4ecc
5 changed files with 36 additions and 9 deletions

View file

@ -144,8 +144,8 @@ Filename: "{app}\Build\Tools\VSIXBootstrapper.exe"; Parameters: "/q /a Cosmos.VS
;Filename: "{app}\Build\Tools\VSIXBootstrapper.exe"; Parameters: "/q /a XSharp.VS.vsix"; WorkingDir: "{app}\VSIX\"; Description: "Install Cosmos X# Language"; StatusMsg: "Installing Visual Studio Extension: Cosmos X# Language" ;Filename: "{app}\Build\Tools\VSIXBootstrapper.exe"; Parameters: "/q /a XSharp.VS.vsix"; WorkingDir: "{app}\VSIX\"; Description: "Install Cosmos X# Language"; StatusMsg: "Installing Visual Studio Extension: Cosmos X# Language"
[UninstallRun] [UninstallRun]
Filename: "{code:GetVsixInstallCommand}"; Parameters: "{code:GetVsixUninstallParams|Cosmos.VS.ProjectSystem}" Filename: "{app}\Build\Tools\VSIXBootstrapper.exe"; Parameters: "/q /a /u:Cosmos.VS.ProjectSystem"; Description: "Remove Cosmos Project System"; StatusMsg: "Removing Visual Studio Extension: Cosmos Project System"
;Filename: "{code:GetVsixInstallCommand}"; Parameters: "{code:GetVsixUninstallParams|XSharp.VS}" ;Filename: "{app}\Build\Tools\VSIXBootstrapper.exe"; Parameters: "/q /a /u:XSharp.VS"; Description: "Remove Cosmos X# Language"; StatusMsg: "Removing Visual Studio Extension: Cosmos X# Language"
[Code] [Code]
function ExecWithResult(const Filename, Params, WorkingDir: String; const ShowCmd: Integer; function ExecWithResult(const Filename, Params, WorkingDir: String; const ShowCmd: Integer;

View file

@ -189,6 +189,26 @@ namespace Cosmos.VS.ProjectSystem
} }
} }
protected override void SetMSBuildProjectProperty(string propertyName, string propertyValue)
{
var xPropertyGroupsCount = BuildProject.Xml.PropertyGroups.Count;
if (xPropertyGroupsCount == 0)
{
throw new Exception("The Cosmos project is invalid.");
}
if (xPropertyGroupsCount == 1)
{
var xPropertyGroup = BuildProject.Xml.AddPropertyGroup();
xPropertyGroup.SetProperty(propertyName, propertyValue);
}
else
{
BuildProject.Xml.PropertyGroups.ElementAt(xPropertyGroupsCount - 1).SetProperty(propertyName, propertyValue);
}
}
#region IVsReferenceManagerUser methods #region IVsReferenceManagerUser methods
public void ChangeReferences(uint operation, IVsReferenceProviderContext changedContext) public void ChangeReferences(uint operation, IVsReferenceProviderContext changedContext)

View file

@ -475,7 +475,6 @@ namespace Cosmos.VS.ProjectSystem.PropertyPages
else if (mProps.Profile == "PXE") else if (mProps.Profile == "PXE")
{ {
chckEnableDebugStub.Checked = false; chckEnableDebugStub.Checked = false;
} }
else if (mProps.Profile == "Bochs") else if (mProps.Profile == "Bochs")
{ {

View file

@ -276,10 +276,13 @@ namespace Cosmos.VS.ProjectSystem.PropertyPages
foreach (var pair in properties) foreach (var pair in properties)
{ {
string propertyName = pair.Key; string propertyName = pair.Key;
if (independentProperties.Contains(propertyName))
//if (independentProperties.Contains(propertyName))
// SetProjectProperty(pair.Key, pair.Value);
//else
// SetConfigProperty(pair.Key, pair.Value);
SetProjectProperty(pair.Key, pair.Value); SetProjectProperty(pair.Key, pair.Value);
else
SetConfigProperty(pair.Key, pair.Value);
} }
IsDirty = false; IsDirty = false;

View file

@ -2198,7 +2198,7 @@ namespace Microsoft.VisualStudio.Project
throw Marshal.GetExceptionForHR(VSConstants.OLE_E_PROMPTSAVECANCELLED); throw Marshal.GetExceptionForHR(VSConstants.OLE_E_PROMPTSAVECANCELLED);
} }
this.buildProject.SetProperty(propertyName, propertyValue); SetMSBuildProjectProperty(propertyName, propertyValue);
RaiseProjectPropertyChanged(propertyName, oldValue, propertyValue); RaiseProjectPropertyChanged(propertyName, oldValue, propertyValue);
// property cache will need to be updated // property cache will need to be updated
@ -2208,6 +2208,11 @@ namespace Microsoft.VisualStudio.Project
return; return;
} }
protected virtual void SetMSBuildProjectProperty(string propertyName, string propertyValue)
{
this.buildProject.SetProperty(propertyName, propertyValue);
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase")]
public virtual ProjectOptions GetProjectOptions(string config = null) public virtual ProjectOptions GetProjectOptions(string config = null)
{ {