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"
[UninstallRun]
Filename: "{code:GetVsixInstallCommand}"; Parameters: "{code:GetVsixUninstallParams|Cosmos.VS.ProjectSystem}"
;Filename: "{code:GetVsixInstallCommand}"; Parameters: "{code:GetVsixUninstallParams|XSharp.VS}"
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: "{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]
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
public void ChangeReferences(uint operation, IVsReferenceProviderContext changedContext)

View file

@ -475,7 +475,6 @@ namespace Cosmos.VS.ProjectSystem.PropertyPages
else if (mProps.Profile == "PXE")
{
chckEnableDebugStub.Checked = false;
}
else if (mProps.Profile == "Bochs")
{
@ -695,7 +694,7 @@ namespace Cosmos.VS.ProjectSystem.PropertyPages
FillNetworkInterfaces();
}
protected BuildProperties mProps = new BuildProperties();
protected BuildProperties mProps = new BuildProperties();
public override PropertiesBase Properties
{

View file

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

View file

@ -2198,7 +2198,7 @@ namespace Microsoft.VisualStudio.Project
throw Marshal.GetExceptionForHR(VSConstants.OLE_E_PROMPTSAVECANCELLED);
}
this.buildProject.SetProperty(propertyName, propertyValue);
SetMSBuildProjectProperty(propertyName, propertyValue);
RaiseProjectPropertyChanged(propertyName, oldValue, propertyValue);
// property cache will need to be updated
@ -2208,6 +2208,11 @@ namespace Microsoft.VisualStudio.Project
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")]
public virtual ProjectOptions GetProjectOptions(string config = null)
{