Microsoft.VisualStudio.Project.ProjectConfig.ToPlatformName C# (CSharp) Method

ToPlatformName() public static method

Return the Platform Name as it display in VS GUI and used in .sln files.
public static ToPlatformName ( string platform ) : string
platform string Platform name in any form
return string
        public static string ToPlatformName(string platform)
        {
            var platformLowered = platform.ToLowerInvariant();

            switch (platformLowered)
            {
                case "anycpu":
                case "any cpu": return "Any CPU";
                case "itanium": return "Itanium";
                case "x86": return "x86";
                case "x64": return "x64";

                default: return platform;
            }
        }

Usage Example

        /// <summary>
        /// Proved access to an IDispatchable object being a list of configuration properties
        /// </summary>
        /// <param name="configurationName">Combined Name and Platform for the configuration requested</param>
        /// <param name="configurationProperties">The IDispatchcable object</param>
        /// <returns>S_OK if successful</returns>
        public virtual int GetAutomationObject(string configurationName, out object configurationProperties)
        {
            //Init out param
            configurationProperties = null;

            string name, platform;

            if (!ProjectConfig.TrySplitConfigurationCanonicalName(configurationName, out name, out platform))
            {
                return(VSConstants.E_INVALIDARG);
            }

            // Get the configuration
            IVsCfg cfg;

            ErrorHandler.ThrowOnFailure(this.GetCfgOfName(name, ProjectConfig.ToPlatformName(platform), out cfg));

            // Get the properties of the configuration
            configurationProperties = ((ProjectConfig)cfg).ConfigurationProperties;

            return(VSConstants.S_OK);
        }