public static FrameworkName GetTargetFrameworkName(IProjectStore projectStore) { if (projectStore == null) { return(null); } if (!ProjectStoreHelper.IsKnownLanguage(ProjectStoreHelper.GetProjectLanguage(projectStore))) { return(null); } string property = projectStore.GetProperty("TargetFrameworkIdentifier"); string str = projectStore.GetProperty("TargetFrameworkVersion"); string property1 = projectStore.GetProperty("TargetFrameworkProfile"); Version version30 = null; if (!string.IsNullOrEmpty(str)) { char[] chrArray = new char[] { 'v' }; if (!Version.TryParse(str.TrimStart(chrArray), out version30)) { version30 = null; } } if (projectStore.StoreVersion == CommonVersions.Version2_0 && version30 == CommonVersions.Version2_0 && ProjectStoreHelper.UsesWpf(projectStore)) { version30 = CommonVersions.Version3_0; } if (string.IsNullOrEmpty(property) || property.Equals("Silverlight", StringComparison.OrdinalIgnoreCase)) { Version silverlightVersion = ProjectStoreHelper.GetSilverlightVersion(projectStore); if (silverlightVersion != null) { property = "Silverlight"; version30 = silverlightVersion; } else { property = ".NETFramework"; } } if (version30 == null) { return(null); } return(ProjectStoreHelper.GenerateFrameworkName(property, version30, property1)); }
public override bool IsValidTypeForProject(IProjectStore projectStore) { Version storeVersion = projectStore.StoreVersion; if (!(projectStore is MSBuildBasedProjectStore) || !(storeVersion != null) || !(storeVersion == CommonVersions.Version4_0) || !ProjectStoreHelper.IsKnownLanguage(projectStore)) { return(false); } return(this.IsValidIfSketchFlow(projectStore)); }
private void PromptWithUnsupportedProjectDetails(IProjectStore projectStore, IProjectCreateError projectCreateError) { string invalidStoreUnsupportedError = StringTable.InvalidStoreUnsupportedError; string identifier = null; if (projectStore is InvalidProjectStore) { string safeExtension = Microsoft.Expression.Framework.Documents.PathHelper.GetSafeExtension(projectStore.DocumentReference.Path); if (!string.IsNullOrEmpty(safeExtension)) { identifier = string.Concat("DoNotWarnAboutExtension", safeExtension.ToUpperInvariant()); } } else if (projectCreateError != null) { invalidStoreUnsupportedError = projectCreateError.Message; identifier = projectCreateError.Identifier; } else if (projectStore.StoreVersion != CommonVersions.Version4_0) { CultureInfo currentUICulture = CultureInfo.CurrentUICulture; string invalidStoreBadToolsVersion = StringTable.InvalidStoreBadToolsVersion; object[] objArray = new object[] { "4.0" }; invalidStoreUnsupportedError = string.Format(currentUICulture, invalidStoreBadToolsVersion, objArray); identifier = "DoNotWarnAboutBadToolsVersion"; } else if (!ProjectStoreHelper.IsKnownLanguage(projectStore)) { invalidStoreUnsupportedError = StringTable.InvalidStoreUnknownLanguage; identifier = "DoNotWarnAboutUnknownLanguage"; } else if (!WindowsExecutableProjectType.IsSupportedOutputType(projectStore)) { invalidStoreUnsupportedError = StringTable.InvalidStoreUnsupportedOutputType; identifier = "DoNotWarnAboutUnsupportedOutputType"; } else if (ProjectStoreHelper.IsSketchFlowProject(projectStore)) { FrameworkName targetFrameworkName = ProjectStoreHelper.GetTargetFrameworkName(projectStore); if (targetFrameworkName == null || targetFrameworkName.Version != CommonVersions.Version4_0) { CultureInfo cultureInfo = CultureInfo.CurrentUICulture; string invalidStoreUnsupportedSketchflow = StringTable.InvalidStoreUnsupportedSketchflow; object[] objArray1 = new object[] { (targetFrameworkName.Identifier == "Silverlight" ? "Silverlight 4" : ".NET Framework 4.0") }; invalidStoreUnsupportedError = string.Format(cultureInfo, invalidStoreUnsupportedSketchflow, objArray1); identifier = "DoNotWarnAboutUnsupportedSketchflowProject"; } } CultureInfo currentUICulture1 = CultureInfo.CurrentUICulture; string unsupportedProjectWithDescription = StringTable.UnsupportedProjectWithDescription; object[] displayName = new object[] { projectStore.DocumentReference.DisplayName, invalidStoreUnsupportedError }; string str = string.Format(currentUICulture1, unsupportedProjectWithDescription, displayName); if (string.IsNullOrEmpty(identifier)) { this.Services.MessageDisplayService().ShowError(str); return; } IServiceProvider services = this.Services; MessageBoxArgs messageBoxArg = new MessageBoxArgs() { Button = MessageBoxButton.OK, Image = MessageBoxImage.Exclamation, Message = str, AutomationId = "UnsupportedProjectErrorDialog" }; services.ShowSuppressibleWarning(messageBoxArg, identifier, MessageBoxResult.OK); }
public static bool IsKnownLanguage(IProjectStore projectStore) { return(ProjectStoreHelper.IsKnownLanguage(ProjectStoreHelper.GetProjectLanguage(projectStore))); }