diff --git a/MvsSln/Core/ProjectItem.cs b/MvsSln/Core/ProjectItem.cs index 911385a..48803a3 100644 --- a/MvsSln/Core/ProjectItem.cs +++ b/MvsSln/Core/ProjectItem.cs @@ -73,17 +73,6 @@ public struct ProjectItem /// public ProjectType EpType; - /// - /// Evaluate project type via GUID. - /// - /// Project type GUID. - /// - [Obsolete("Use `Guids.ProjectTypeBy(string guid)` instead.", false)] - public static ProjectType ProjectTypeBy(string guid) - { - return Guids.ProjectTypeBy(guid); - } - public static bool operator ==(ProjectItem a, ProjectItem b) => a.Equals(b); public static bool operator !=(ProjectItem a, ProjectItem b) => !(a == b); diff --git a/MvsSln/Core/XProjectEnv.cs b/MvsSln/Core/XProjectEnv.cs index d9e3cf8..9b0f255 100644 --- a/MvsSln/Core/XProjectEnv.cs +++ b/MvsSln/Core/XProjectEnv.cs @@ -43,9 +43,6 @@ namespace net.r_eg.MvsSln.Core /// public class XProjectEnv: IXProjectEnv { - [Obsolete("Use " + nameof(PropertyNames), false)] - public const string PROP_VALUE_DEFAULT = PropertyNames.UNDEFINED; - /// /// Solution properties. /// diff --git a/MvsSln/EnvDTE/DProject.cs b/MvsSln/EnvDTE/DProject.cs deleted file mode 100644 index 5f18dba..0000000 --- a/MvsSln/EnvDTE/DProject.cs +++ /dev/null @@ -1,93 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2013-2021 Denis Kuzmin github/3F - * Copyright (c) MvsSln contributors https://github.com/3F/MvsSln/graphs/contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. -*/ - -using System; - -namespace net.r_eg.MvsSln.EnvDTE -{ - /// - /// Wrapper of dynamic EnvDTE.Project. - /// - [Obsolete("Scheduled for removal in future major releases: https://github.com/3F/MvsSln/issues/22")] - public class DProject - { - /// - /// Gets the full path and name of the EnvDTE.Project object's file. - /// - public string FullName - { - get => Raw?.FullName; - } - - /// - /// The references in the project. - /// - public dynamic References - { - get => Raw?.Object.References; - } - - /// - /// Dynamic access to EnvDTE.Project. - /// - public dynamic Raw - { - get; - protected set; - } - - /// - /// To check existence of references by name and PublicKeyToken. - /// https://msdn.microsoft.com/en-us/library/vslangproj.reference.aspx - /// - /// - /// - /// - public bool HasReference(string name, string pubkey = null) - { - foreach(var pRef in References) { - if(pRef.Name == name && (pubkey == null || pRef.PublicKeyToken == pubkey)) { - return true; - } - } - return false; - } - - /// - /// Saves the project or project item. - /// - /// Optional name in which to save the project or project item. - public void Save(string FileName = "") - { - Raw?.Save(FileName); - } - - /// - public DProject(dynamic pdte) - { - Raw = pdte; - } - } -} \ No newline at end of file diff --git a/MvsSln/EnvDTE/DynDteProject.cs b/MvsSln/EnvDTE/DynDteProject.cs deleted file mode 100644 index 0150010..0000000 --- a/MvsSln/EnvDTE/DynDteProject.cs +++ /dev/null @@ -1,127 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2013-2021 Denis Kuzmin github/3F - * Copyright (c) MvsSln contributors https://github.com/3F/MvsSln/graphs/contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. -*/ - -using System; -using System.Collections.Generic; -using System.Linq; -using net.r_eg.MvsSln.Core; - -namespace net.r_eg.MvsSln.EnvDTE -{ - /// - /// Helper for access to EnvDTE.Project without direct reference. - /// - [Obsolete("Scheduled for removal in future major releases: https://github.com/3F/MvsSln/issues/22")] - public class DynDteProject - { - /// - /// Environment with initialized xprojects. - /// - protected IEnvironment env; - - /// - /// EnvDTE.Project - /// - protected dynamic pdte; - - /// - /// EnvDTE.Projects wrapped by DProject. - /// https://msdn.microsoft.com/en-us/library/envdte.projects.aspx - /// - public IEnumerable Projects - { - get - { - foreach(var p in pdte?.Collection) { - yield return new DProject(p); - } - } - } - - /// - /// Access to each IXProject and saving data via EnvDTE. - /// - /// Optional meta-library file name without extension to filter. - /// PublicKeyToken of meta-library if used. - public IEnumerable GetAndSaveXProjects(string metalib = null, string metalibKey = null) - { - foreach(var dtePrj in Projects) - { - if((metalib != null && metalibKey != null) - && !dtePrj.HasReference(metalib, metalibKey)) - { - continue; - } - - var xprojects = env.UniqueByGuidProjects?.Where(p => - p.ProjectItem.project.fullPath.Equals(dtePrj.FullName, StringComparison.InvariantCultureIgnoreCase) - ); - - foreach(var xprj in xprojects) { - yield return xprj; - } - - dtePrj.Save(dtePrj.FullName); - } - } - - /// - /// To update property value for all available projects. - /// - /// The name of the property. - /// Value of the property. - /// Optional meta-library file name without extension to filter. - /// PublicKeyToken of meta-library if used. - public void UpdatePropertyForAllProjects(string name, string value, string metalib = null, string metalibKey = null) - { - CheckName(ref name); - - foreach(var prj in GetAndSaveXProjects(metalib, metalibKey)) - { - if(value != null) { - prj.SetProperty(name, value); - } - else { - prj.RemoveProperty(name); - } - } - } - - /// - /// - public DynDteProject(dynamic pdte, IEnvironment env) - { - this.pdte = pdte; - this.env = env ?? throw new ArgumentNullException(nameof(env), MsgResource.ValueNoEmptyOrNull); - } - - protected virtual void CheckName(ref string name) - { - if(String.IsNullOrWhiteSpace(name)) { - throw new ArgumentNullException(nameof(name), MsgResource.ValueNoEmptyOrNull); - } - } - } -} \ No newline at end of file