protected virtual void OnHandleConfigurationRelatedGlobalProperties(object sender,
ActiveConfigurationChangedEventArgs eventArgs)
{
Debug.Assert(eventArgs != null, "Wrong hierarchy passed as event arg for the configuration change listener.");
// If (eventArgs.Hierarchy == NULL) then we received this event because the solution configuration
// was changed.
// If it is not null we got the event because a project in teh configuration manager has changed its active configuration.
// We care only about our project in the default implementation.
if (eventArgs == null || eventArgs.Hierarchy == null ||
!Utilities.IsSameComObject(eventArgs.Hierarchy, InteropSafeIVsHierarchy))
{
return;
}
string name, platform;
if (!Utilities.TryGetActiveConfigurationAndPlatform(Site, InteropSafeIVsHierarchy, out name, out platform))
{
throw new InvalidOperationException();
}
buildProject.SetGlobalProperty(GlobalProperty.Configuration.ToString(), name);
// If the platform is "Any CPU" then it should be set to AnyCPU, since that is the property value in MsBuild terms.
if (string.Compare(platform, ConfigProvider.AnyCPUPlatform, StringComparison.Ordinal) == 0)
{
platform = ProjectFileValues.AnyCPU;
}
buildProject.SetGlobalProperty(GlobalProperty.Platform.ToString(), platform);
}