diff --git a/.gitignore b/.gitignore index 968dd1e..fd34573 100644 --- a/.gitignore +++ b/.gitignore @@ -1,27 +1,64 @@ -################# -## Visual Studio -################# - ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore # User-specific files *.suo *.user +*.userosscache *.sln.docstates -*.pidb -*.ncrunchproject -*.ncrunchsolution + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs # Build results [Dd]ebug/ +[Dd]ebugPublic/ [Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ +**/Properties/launchSettings.json + *_i.c *_p.c +*_i.h *.ilk *.meta *.obj *.pch +*.pdb *.pgc *.pgd *.rsp @@ -30,50 +67,240 @@ *.tli *.tlh *.tmp +*.tmp_proj +*.log *.vspscc +*.vssscc .builds -*.dotCover +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* -## If you have NuGet Package Restore enabled, uncomment this -packages/ -ForSample/ -NugetBuild/ +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb # Visual Studio profiler *.psess *.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState # ReSharper is a .NET coding add-in -_ReSharper* +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets +nugets/ + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ # Others -[Bb]in -[Oo]bj -sql -TestResults -*.Cache -ClientBin -stylecop.* +ClientBin/ ~$* +*~ *.dbmdl -Generated_Code #added for RIA/Silverlight projects +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ -# Backup & report files from converting an old project file to a newer -# Visual Studio version. Backup files are not needed, because we have git ;-) +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) _UpgradeReport_Files/ Backup*/ UpgradeLog*.XML +UpgradeLog*.htm +# SQL Server files +*.mdf +*.ldf +*.ndf -.vs/ +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Typescript v1 declaration files +typings/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config -############ -## Windows -############ +# Tabs Studio +*.tss -# Windows image file caches -Thumbs.db +# Telerik's JustMock configuration file +*.jmconfig -# Folder config file -Desktop.ini +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs +# OpenCover UI analysis results +OpenCover/ diff --git a/AssemblyToProcess/AssemblyToProcess.csproj b/AssemblyToProcess/AssemblyToProcess.csproj index 16a090f..d169947 100644 --- a/AssemblyToProcess/AssemblyToProcess.csproj +++ b/AssemblyToProcess/AssemblyToProcess.csproj @@ -1,99 +1,9 @@  - + - Debug - AnyCPU - {40939411-32F0-48DD-B17B-FA46DD5D9B25} - Library - Properties - AssemblyToProcess - AssemblyToProcess - v4.0 - Profile136 - 512 - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 10.0 - - - - - 4.0 + net452;netcoreapp2.0 - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - Code - - - Code - - - Code - - - Code - - - Code - - - - Code - - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - - {5D6191BF-F0EE-474D-B168-BB92418A0F3D} - AttributeAssembly - + - \ No newline at end of file diff --git a/AssemblyToProcess/ClassToMark.cs b/AssemblyToProcess/ClassToMark.cs index 5b65bf6..f8481aa 100644 --- a/AssemblyToProcess/ClassToMark.cs +++ b/AssemblyToProcess/ClassToMark.cs @@ -1,4 +1,8 @@ using System; +// ReSharper disable NotAccessedField.Local +// ReSharper disable EventNeverSubscribedTo.Global +#pragma warning disable 67 +#pragma warning disable 649 [ObsoleteEx(TreatAsErrorFromVersion = "2.0", RemoveInVersion = "4.0", Message = "Custom message.", ReplacementTypeOrMember = "NewThing")] public class ClassToMark @@ -9,21 +13,15 @@ public class ClassToMark [ObsoleteEx(TreatAsErrorFromVersion = "2.0", RemoveInVersion = "4.0", Message = "Custom message.", ReplacementTypeOrMember = "NewThing")] public string PropertyWithSetExceptionToMark { - get { return propertyWithSetExceptionToMark; } - set - { - throw new NotImplementedException(); - } + get => propertyWithSetExceptionToMark; + set => throw new NotImplementedException(); } [ObsoleteEx(TreatAsErrorFromVersion = "2.0", RemoveInVersion = "4.0", Message = "Custom message.", ReplacementTypeOrMember = "NewThing")] public string PropertyWithGetExceptionToMark { - get - { - throw new NotImplementedException(); - } - set { propertyWithGetExceptionToMark = value; } + get => throw new NotImplementedException(); + set => propertyWithGetExceptionToMark = value; } [ObsoleteEx(TreatAsErrorFromVersion = "2.0", RemoveInVersion = "4.0", Message = "Custom message.", ReplacementTypeOrMember = "NewThing")] diff --git a/AssemblyToProcess/ClassWithObsoleteOnGetSet.cs b/AssemblyToProcess/ClassWithObsoleteOnGetSet.cs index 22a09bf..ab0b3d2 100644 --- a/AssemblyToProcess/ClassWithObsoleteOnGetSet.cs +++ b/AssemblyToProcess/ClassWithObsoleteOnGetSet.cs @@ -1,6 +1,4 @@ public class ClassWithObsoleteOnGetSet { - public string PropertyToMark { [ObsoleteEx]get; [ObsoleteEx]set; } - } \ No newline at end of file diff --git a/AssemblyToProcess/EnumToMark.cs b/AssemblyToProcess/EnumToMark.cs index eb8eca8..0c3f358 100644 --- a/AssemblyToProcess/EnumToMark.cs +++ b/AssemblyToProcess/EnumToMark.cs @@ -1,13 +1,13 @@ [ObsoleteEx( - TreatAsErrorFromVersion = "2.0", - RemoveInVersion = "4.0", + TreatAsErrorFromVersion = "2.0", + RemoveInVersion = "4.0", Message = "Custom message.", ReplacementTypeOrMember = "NewThing")] enum EnumToMark { [ObsoleteEx( - TreatAsErrorFromVersion = "2.0", - RemoveInVersion = "4.0", + TreatAsErrorFromVersion = "2.0", + RemoveInVersion = "4.0", Message = "Custom message.", ReplacementTypeOrMember = "NewThing")] Foo, diff --git a/AssemblyToProcess/Sample.cs b/AssemblyToProcess/Sample.cs index 0e30129..63b58a9 100644 --- a/AssemblyToProcess/Sample.cs +++ b/AssemblyToProcess/Sample.cs @@ -22,4 +22,4 @@ namespace AfterVersion3 public class ClassToMark { } -} +} \ No newline at end of file diff --git a/AssemblyToProcess/StructToMark.cs b/AssemblyToProcess/StructToMark.cs index 0fb207c..9aa2465 100644 --- a/AssemblyToProcess/StructToMark.cs +++ b/AssemblyToProcess/StructToMark.cs @@ -1,4 +1,5 @@ using System; +#pragma warning disable 67 [ObsoleteEx(TreatAsErrorFromVersion = "2.0", RemoveInVersion = "4.0", Message = "Custom message.", ReplacementTypeOrMember = "NewThing")] public struct StructToMark @@ -6,7 +7,7 @@ public struct StructToMark [ObsoleteEx(TreatAsErrorFromVersion = "2.0", RemoveInVersion = "4.0", Message = "Custom message.", ReplacementTypeOrMember = "NewThing")] public string PropertyToMark { get; set; } - [ObsoleteEx(TreatAsErrorFromVersion = "2.0", RemoveInVersion = "4.0", Message = "Custom message.", ReplacementTypeOrMember = "NewThing")] + [ObsoleteEx(TreatAsErrorFromVersion = "2.0", RemoveInVersion = "4.0", Message = "Custom message.", ReplacementTypeOrMember = "NewThing")] public string FieldToMark; [ObsoleteEx(TreatAsErrorFromVersion = "2.0", RemoveInVersion = "4.0", Message = "Custom message.", ReplacementTypeOrMember = "NewThing")] diff --git a/AttributeAssembly/AttributeAssembly.csproj b/AttributeAssembly/AttributeAssembly.csproj deleted file mode 100644 index 79c5220..0000000 --- a/AttributeAssembly/AttributeAssembly.csproj +++ /dev/null @@ -1,63 +0,0 @@ - - - - obj\PCL - Debug - AnyCPU - {5D6191BF-F0EE-474D-B168-BB92418A0F3D} - Library - Properties - Obsolete - Obsolete - v4.0 - Profile328 - 512 - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - true - ..\key.snk - 10.0 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - bin\Debug\Obsolete.xml - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - bin\Release\Obsolete.xml - - - - - - - - - CommonAssemblyInfo.cs - - - - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - false - - - - \ No newline at end of file diff --git a/AttributeAssemblyNetStandard/AttributeAssemblyNetStandard.csproj b/AttributeAssemblyNetStandard/AttributeAssemblyNetStandard.csproj deleted file mode 100644 index d24b268..0000000 --- a/AttributeAssemblyNetStandard/AttributeAssemblyNetStandard.csproj +++ /dev/null @@ -1,27 +0,0 @@ - - - - netstandard1.4 - Obsolete - Obsolete - false - true - ..\key.snk - - - - bin\Release\ - bin\Release\netstandard1.4\Obsolete.xml - - - - bin\Debug\ - bin\Debug\netstandard1.4\Obsolete.xml - - - - - - - - \ No newline at end of file diff --git a/CommonAssemblyInfo.cs b/CommonAssemblyInfo.cs index bb9d0a4..a5179d1 100644 --- a/CommonAssemblyInfo.cs +++ b/CommonAssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; [assembly: AssemblyTitle("Obsolete")] [assembly: AssemblyProduct("Obsolete")] -[assembly: AssemblyVersion("4.3.2")] -[assembly: AssemblyFileVersion("4.3.2")] \ No newline at end of file +[assembly: AssemblyVersion("4.3.2")] \ No newline at end of file diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..bfc67ae --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,7 @@ + + + + true + false + + \ No newline at end of file diff --git a/Fody/Fody.csproj b/Fody/Fody.csproj deleted file mode 100644 index 2735c2a..0000000 --- a/Fody/Fody.csproj +++ /dev/null @@ -1,79 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {C3578A7B-09A6-4444-9383-0DEAFA4958BD} - Library - Properties - Obsolete.Fody - Obsolete.Fody - v4.5.2 - 512 - - - - - true - full - false - bin\Debug\ - TRACE;DEBUG - prompt - 4 - true - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - true - - - - ..\packages\FodyCecil.2.1.2\lib\net40\Mono.Cecil.dll - - - ..\packages\FodyCecil.2.1.2\lib\net40\Mono.Cecil.Mdb.dll - - - ..\packages\FodyCecil.2.1.2\lib\net40\Mono.Cecil.Pdb.dll - - - ..\packages\FodyCecil.2.1.2\lib\net40\Mono.Cecil.Rocks.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Icons/noun_project_3725.svg b/Icons/noun_project_3725.svg deleted file mode 100644 index 38b2d95..0000000 --- a/Icons/noun_project_3725.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Fody/AssemblyProcessor.cs b/Obsolete.Fody/AssemblyProcessor.cs similarity index 99% rename from Fody/AssemblyProcessor.cs rename to Obsolete.Fody/AssemblyProcessor.cs index 3c4c832..f37ef8f 100644 --- a/Fody/AssemblyProcessor.cs +++ b/Obsolete.Fody/AssemblyProcessor.cs @@ -1,6 +1,5 @@ public partial class ModuleWeaver { - public void ProcessAssembly() { foreach (var typeDefinition in ModuleDefinition.GetTypes()) @@ -24,5 +23,4 @@ public void ProcessAssembly() } } } - } \ No newline at end of file diff --git a/Fody/AttributeData.cs b/Obsolete.Fody/AttributeData.cs similarity index 100% rename from Fody/AttributeData.cs rename to Obsolete.Fody/AttributeData.cs diff --git a/Fody/AttributeExtensions.cs b/Obsolete.Fody/AttributeExtensions.cs similarity index 99% rename from Fody/AttributeExtensions.cs rename to Obsolete.Fody/AttributeExtensions.cs index c2cbe40..9b07b92 100644 --- a/Fody/AttributeExtensions.cs +++ b/Obsolete.Fody/AttributeExtensions.cs @@ -3,7 +3,6 @@ public static class AttributeExtensions { - public static string GetValue(this CustomAttribute obsoleteExAttribute, string propertyName) { var argument = obsoleteExAttribute.Properties.FirstOrDefault(x => x.Name == propertyName); diff --git a/Fody/AttributeFixer.cs b/Obsolete.Fody/AttributeFixer.cs similarity index 99% rename from Fody/AttributeFixer.cs rename to Obsolete.Fody/AttributeFixer.cs index 411e2b8..f674770 100644 --- a/Fody/AttributeFixer.cs +++ b/Obsolete.Fody/AttributeFixer.cs @@ -4,7 +4,6 @@ public partial class ModuleWeaver { - void ProcessAttributes(IMemberDefinition memberDefinition) { CheckForNormalAttribute(memberDefinition); diff --git a/Fody/BrowsableAttributeAdder.cs b/Obsolete.Fody/BrowsableAttributeAdder.cs similarity index 100% rename from Fody/BrowsableAttributeAdder.cs rename to Obsolete.Fody/BrowsableAttributeAdder.cs diff --git a/Fody/ConfigReader.cs b/Obsolete.Fody/ConfigReader.cs similarity index 100% rename from Fody/ConfigReader.cs rename to Obsolete.Fody/ConfigReader.cs diff --git a/Fody/DataFormatter.cs b/Obsolete.Fody/DataFormatter.cs similarity index 99% rename from Fody/DataFormatter.cs rename to Obsolete.Fody/DataFormatter.cs index 8e89459..63caa28 100644 --- a/Fody/DataFormatter.cs +++ b/Obsolete.Fody/DataFormatter.cs @@ -2,7 +2,6 @@ public partial class ModuleWeaver { - public string ConvertToMessage(AttributeData attributeData) { var stringBuilder = new StringBuilder(); diff --git a/Fody/DataReader.cs b/Obsolete.Fody/DataReader.cs similarity index 50% rename from Fody/DataReader.cs rename to Obsolete.Fody/DataReader.cs index df193d8..9516f9e 100644 --- a/Fody/DataReader.cs +++ b/Obsolete.Fody/DataReader.cs @@ -2,20 +2,18 @@ public static class DataReader { - public static AttributeData ReadAttributeData(CustomAttribute obsoleteExAttribute, bool throwsNotImplemented) { var treatAsErrorFromVersionString = obsoleteExAttribute.GetValue("TreatAsErrorFromVersion"); var removeInVersionString = obsoleteExAttribute.GetValue("RemoveInVersion"); return new AttributeData - { - Message = obsoleteExAttribute.GetValue("Message"), - Replacement = obsoleteExAttribute.GetValue("ReplacementTypeOrMember"), - TreatAsErrorFromVersion = treatAsErrorFromVersionString, - RemoveInVersion = removeInVersionString, - ThrowsNotImplemented = throwsNotImplemented + { + Message = obsoleteExAttribute.GetValue("Message"), + Replacement = obsoleteExAttribute.GetValue("ReplacementTypeOrMember"), + TreatAsErrorFromVersion = treatAsErrorFromVersionString, + RemoveInVersion = removeInVersionString, + ThrowsNotImplemented = throwsNotImplemented }; } - } \ No newline at end of file diff --git a/Fody/EditorBrowsableAttributeFinder.cs b/Obsolete.Fody/EditorBrowsableAttributeFinder.cs similarity index 66% rename from Fody/EditorBrowsableAttributeFinder.cs rename to Obsolete.Fody/EditorBrowsableAttributeFinder.cs index 9b09b04..853071b 100644 --- a/Fody/EditorBrowsableAttributeFinder.cs +++ b/Obsolete.Fody/EditorBrowsableAttributeFinder.cs @@ -14,9 +14,17 @@ void FindEditorBrowsableTypes(List typeDefinitions) { return; } - var attributeType = typeDefinitions.First(x => x.Name == "EditorBrowsableAttribute"); + var attributeType = typeDefinitions.FirstOrDefault(x => x.Name == "EditorBrowsableAttribute"); + if (attributeType == null) + { + throw new WeavingException("Could not find EditorBrowsableAttribute"); + } EditorBrowsableConstructor = ModuleDefinition.ImportReference(attributeType.Methods.First(IsDesiredConstructor)); - EditorBrowsableStateType = typeDefinitions.First(x => x.Name == "EditorBrowsableState"); + EditorBrowsableStateType = typeDefinitions.FirstOrDefault(x => x.Name == "EditorBrowsableState"); + if (EditorBrowsableStateType == null) + { + throw new WeavingException("Could not find EditorBrowsableAttribute"); + } var fieldDefinition = EditorBrowsableStateType.Fields.First(x => x.Name == "Advanced"); AdvancedStateConstant = (int) fieldDefinition.Constant; } @@ -33,5 +41,4 @@ static bool IsDesiredConstructor(MethodDefinition x) } return x.Parameters[0].ParameterType.Name == "EditorBrowsableState"; } - } \ No newline at end of file diff --git a/Fody/ModuleWeaver.cs b/Obsolete.Fody/ModuleWeaver.cs similarity index 94% rename from Fody/ModuleWeaver.cs rename to Obsolete.Fody/ModuleWeaver.cs index 4bbffe2..6f25fb5 100644 --- a/Fody/ModuleWeaver.cs +++ b/Obsolete.Fody/ModuleWeaver.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Xml.Linq; using Mono.Cecil; @@ -61,6 +62,7 @@ void AddAssemblyIfExists(string name, List types) if (msCoreLibDefinition != null) { types.AddRange(msCoreLibDefinition.MainModule.Types); + types.AddRange(msCoreLibDefinition.MainModule.ExportedTypes.Select(x => x.Resolve())); } } catch (AssemblyResolutionException) diff --git a/Obsolete.Fody/Obsolete.Fody.csproj b/Obsolete.Fody/Obsolete.Fody.csproj new file mode 100644 index 0000000..af47277 --- /dev/null +++ b/Obsolete.Fody/Obsolete.Fody.csproj @@ -0,0 +1,27 @@ + + + + net452;netcoreapp2.0 + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/NuGet/Obsolete.Fody.nuspec b/Obsolete.Fody/Obsolete.Fody.nuspec similarity index 90% rename from NuGet/Obsolete.Fody.nuspec rename to Obsolete.Fody/Obsolete.Fody.nuspec index 59b84b0..53759d7 100644 --- a/NuGet/Obsolete.Fody.nuspec +++ b/Obsolete.Fody/Obsolete.Fody.nuspec @@ -10,7 +10,7 @@ http://www.opensource.org/licenses/mit-license.php http://github.com/Fody/Obsolete false - https://raw.github.com/Fody/Obsolete/master/Icons/package_icon.png + https://raw.github.com/Fody/Obsolete/master/package_icon.png Allows a more expressive use of the ObsoleteAttribute. en-AU Obsolete, ObsoleteAttribute, ILWeaving, Fody, Cecil diff --git a/Fody/ObsoleteAttributeWarner.cs b/Obsolete.Fody/ObsoleteAttributeWarner.cs similarity index 99% rename from Fody/ObsoleteAttributeWarner.cs rename to Obsolete.Fody/ObsoleteAttributeWarner.cs index bc90ba8..3bc7c8b 100644 --- a/Fody/ObsoleteAttributeWarner.cs +++ b/Obsolete.Fody/ObsoleteAttributeWarner.cs @@ -3,7 +3,6 @@ public partial class ModuleWeaver { - public void CheckForNormalAttribute(IMemberDefinition memberDefinition) { var customAttributes = memberDefinition diff --git a/Fody/ObsoleteTypeFinder.cs b/Obsolete.Fody/ObsoleteTypeFinder.cs similarity index 75% rename from Fody/ObsoleteTypeFinder.cs rename to Obsolete.Fody/ObsoleteTypeFinder.cs index 861441b..ee3d3df 100644 --- a/Fody/ObsoleteTypeFinder.cs +++ b/Obsolete.Fody/ObsoleteTypeFinder.cs @@ -9,7 +9,11 @@ public partial class ModuleWeaver public void FindObsoleteType(List systemTypes) { var obsoleteDefinition = systemTypes - .Single(x => x.Name == "ObsoleteAttribute"); + .FirstOrDefault(x => x.Name == "ObsoleteAttribute"); + if (obsoleteDefinition == null) + { + throw new WeavingException("Could not find ObsoleteAttribute"); + } var constructor = obsoleteDefinition.Methods.First(x => x.Parameters.Count == 2 && x.Parameters[0].ParameterType.Name == "String" diff --git a/Fody/ReferenceCleaner.cs b/Obsolete.Fody/ReferenceCleaner.cs similarity index 99% rename from Fody/ReferenceCleaner.cs rename to Obsolete.Fody/ReferenceCleaner.cs index 82ceff7..af03450 100644 --- a/Fody/ReferenceCleaner.cs +++ b/Obsolete.Fody/ReferenceCleaner.cs @@ -2,7 +2,6 @@ public partial class ModuleWeaver { - public void CleanReferences() { var referenceToRemove = ModuleDefinition.AssemblyReferences.FirstOrDefault(x => x.Name == "Obsolete"); diff --git a/Fody/SemanticVersion.cs b/Obsolete.Fody/SemanticVersion.cs similarity index 91% rename from Fody/SemanticVersion.cs rename to Obsolete.Fody/SemanticVersion.cs index 5159db0..b265304 100644 --- a/Fody/SemanticVersion.cs +++ b/Obsolete.Fody/SemanticVersion.cs @@ -25,8 +25,7 @@ public static implicit operator string(SemanticVersion d) public static implicit operator SemanticVersion(string d) { - SemanticVersion semver; - if (TryParse(d, out semver)) + if (TryParse(d, out var semver)) { return semver; } @@ -53,8 +52,7 @@ public static bool TryParse(string versionString, out SemanticVersion semanticVe return false; } - int major; - if (!int.TryParse(stableParts[0], out major)) + if (!int.TryParse(stableParts[0], out var major)) { semanticVersion = null; return false; @@ -65,8 +63,7 @@ public static bool TryParse(string versionString, out SemanticVersion semanticVe }; if (stableParts.Length > 1) { - int minor; - if (!int.TryParse(stableParts[1], out minor)) + if (!int.TryParse(stableParts[1], out var minor)) { semanticVersion = null; return false; @@ -76,8 +73,7 @@ public static bool TryParse(string versionString, out SemanticVersion semanticVe if (stableParts.Length > 2) { - int patch; - if (!int.TryParse(stableParts[2], out patch)) + if (!int.TryParse(stableParts[2], out var patch)) { semanticVersion = null; return false; diff --git a/Fody/StepType.cs b/Obsolete.Fody/StepType.cs similarity index 100% rename from Fody/StepType.cs rename to Obsolete.Fody/StepType.cs diff --git a/Fody/VersionExtensions.cs b/Obsolete.Fody/VersionExtensions.cs similarity index 99% rename from Fody/VersionExtensions.cs rename to Obsolete.Fody/VersionExtensions.cs index 03766d1..f5696d6 100644 --- a/Fody/VersionExtensions.cs +++ b/Obsolete.Fody/VersionExtensions.cs @@ -3,7 +3,6 @@ public static class VersionExtensions { - public static SemanticVersion Decrement(this SemanticVersion target, StepType stepType) { switch (stepType) diff --git a/Fody/WeavingException.cs b/Obsolete.Fody/WeavingException.cs similarity index 100% rename from Fody/WeavingException.cs rename to Obsolete.Fody/WeavingException.cs diff --git a/Fody/packages.config b/Obsolete.Fody/packages.config similarity index 100% rename from Fody/packages.config rename to Obsolete.Fody/packages.config diff --git a/Obsolete.sln b/Obsolete.sln index bb2bb1d..44c18fb 100644 --- a/Obsolete.sln +++ b/Obsolete.sln @@ -1,26 +1,20 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26403.7 +VisualStudioVersion = 15.0.27004.2009 MinimumVisualStudioVersion = 14.0.22823.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Fody", "Fody\Fody.csproj", "{C3578A7B-09A6-4444-9383-0DEAFA4958BD}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssemblyToProcess", "AssemblyToProcess\AssemblyToProcess.csproj", "{40939411-32F0-48DD-B17B-FA46DD5D9B25}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AttributeAssembly", "AttributeAssembly\AttributeAssembly.csproj", "{5D6191BF-F0EE-474D-B168-BB92418A0F3D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{DAB36D28-050A-4F2A-AA93-B3163F92D71A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Obsolete.Fody", "Obsolete.Fody\Obsolete.Fody.csproj", "{C3578A7B-09A6-4444-9383-0DEAFA4958BD}" ProjectSection(ProjectDependencies) = postProject - {40939411-32F0-48DD-B17B-FA46DD5D9B25} = {40939411-32F0-48DD-B17B-FA46DD5D9B25} + {5D6191BF-F0EE-474D-B168-BB92418A0F3D} = {5D6191BF-F0EE-474D-B168-BB92418A0F3D} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AttributeAssemblyNetStandard", "AttributeAssemblyNetStandard\AttributeAssemblyNetStandard.csproj", "{D1756CE7-D9F7-4B39-A6F4-03364E52B888}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AssemblyToProcess", "AssemblyToProcess\AssemblyToProcess.csproj", "{40939411-32F0-48DD-B17B-FA46DD5D9B25}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nuget", "NuGet\Nuget.csproj", "{66DDADC1-1631-4EC7-8CB2-DD8080188234}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Obsolete", "Obsolete\Obsolete.csproj", "{5D6191BF-F0EE-474D-B168-BB92418A0F3D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "Tests\Tests.csproj", "{DAB36D28-050A-4F2A-AA93-B3163F92D71A}" ProjectSection(ProjectDependencies) = postProject - {C3578A7B-09A6-4444-9383-0DEAFA4958BD} = {C3578A7B-09A6-4444-9383-0DEAFA4958BD} - {5D6191BF-F0EE-474D-B168-BB92418A0F3D} = {5D6191BF-F0EE-474D-B168-BB92418A0F3D} - {D1756CE7-D9F7-4B39-A6F4-03364E52B888} = {D1756CE7-D9F7-4B39-A6F4-03364E52B888} + {40939411-32F0-48DD-B17B-FA46DD5D9B25} = {40939411-32F0-48DD-B17B-FA46DD5D9B25} EndProjectSection EndProject Global @@ -45,16 +39,11 @@ Global {DAB36D28-050A-4F2A-AA93-B3163F92D71A}.Debug|Any CPU.Build.0 = Debug|Any CPU {DAB36D28-050A-4F2A-AA93-B3163F92D71A}.Release|Any CPU.ActiveCfg = Release|Any CPU {DAB36D28-050A-4F2A-AA93-B3163F92D71A}.Release|Any CPU.Build.0 = Release|Any CPU - {D1756CE7-D9F7-4B39-A6F4-03364E52B888}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D1756CE7-D9F7-4B39-A6F4-03364E52B888}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D1756CE7-D9F7-4B39-A6F4-03364E52B888}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D1756CE7-D9F7-4B39-A6F4-03364E52B888}.Release|Any CPU.Build.0 = Release|Any CPU - {66DDADC1-1631-4EC7-8CB2-DD8080188234}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {66DDADC1-1631-4EC7-8CB2-DD8080188234}.Debug|Any CPU.Build.0 = Debug|Any CPU - {66DDADC1-1631-4EC7-8CB2-DD8080188234}.Release|Any CPU.ActiveCfg = Release|Any CPU - {66DDADC1-1631-4EC7-8CB2-DD8080188234}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {F52105BA-9977-433F-B466-7545FAE3A927} + EndGlobalSection EndGlobal diff --git a/Obsolete.sln.DotSettings b/Obsolete.sln.DotSettings index 463df29..1013fe6 100644 --- a/Obsolete.sln.DotSettings +++ b/Obsolete.sln.DotSettings @@ -1,4 +1,612 @@  - ERROR - <data><IncludeFilters /><ExcludeFilters /></data> - <data /> \ No newline at end of file + + CSharp71 + True + True + True + False + + True + SOLUTION + SUGGESTION + SUGGESTION + DO_NOT_SHOW + ERROR + DO_NOT_SHOW + DO_NOT_SHOW + DO_NOT_SHOW + DO_NOT_SHOW + WARNING + ERROR + ERROR + ERROR + ERROR + ERROR + DO_NOT_SHOW + DO_NOT_SHOW + DO_NOT_SHOW + DO_NOT_SHOW + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + DO_NOT_SHOW + DO_NOT_SHOW + ERROR + DO_NOT_SHOW + DO_NOT_SHOW + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + WARNING + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + SUGGESTION + SUGGESTION + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + SUGGESTION + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + WARNING + ERROR + ERROR + ERROR + DoHide + DoHide + DoHide + DoHide + DoHide + DoHide + DoHide + DoHide + DoHide + DoHide + DoHide + DoHide + DoHide + DoHide + DoHide + DoHide + DoHide + DoHide + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + ERROR + DO_NOT_SHOW + SUGGESTION + WARNING + WARNING + ERROR + HINT + WARNING + ERROR + ERROR + ERROR + <?xml version="1.0" encoding="utf-16"?><Profile name="Format My Code Using &quot;Particular&quot; conventions"><CSMakeFieldReadonly>True</CSMakeFieldReadonly><CSUseVar><BehavourStyle>CAN_CHANGE_TO_IMPLICIT</BehavourStyle><LocalVariableStyle>ALWAYS_IMPLICIT</LocalVariableStyle><ForeachVariableStyle>ALWAYS_IMPLICIT</ForeachVariableStyle></CSUseVar><CSOptimizeUsings><OptimizeUsings>True</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSReformatCode>True</CSReformatCode><CSReorderTypeMembers>True</CSReorderTypeMembers><JsInsertSemicolon>True</JsInsertSemicolon><JsReformatCode>True</JsReformatCode><CssReformatCode>True</CssReformatCode><CSArrangeThisQualifier>True</CSArrangeThisQualifier><RemoveCodeRedundancies>True</RemoveCodeRedundancies><CSUseAutoProperty>True</CSUseAutoProperty><HtmlReformatCode>True</HtmlReformatCode><CSShortenReferences>True</CSShortenReferences><CSharpFormatDocComments>True</CSharpFormatDocComments><CssAlphabetizeProperties>True</CssAlphabetizeProperties></Profile> + Default: Reformat Code + Format My Code Using "Particular" conventions + Implicit + Implicit + False + False + ALWAYS_ADD + ALWAYS_ADD + ALWAYS_ADD + ALWAYS_ADD + ALWAYS_ADD + False + NEVER + False + False + False + False + CHOP_ALWAYS + False + CHOP_ALWAYS + CHOP_ALWAYS + True + True + ZeroIndent + ZeroIndent + <?xml version="1.0" encoding="utf-16"?> +<Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns"> + <TypePattern DisplayName="COM interfaces or structs"> + <TypePattern.Match> + <Or> + <And> + <Kind Is="Interface" /> + <Or> + <HasAttribute Name="System.Runtime.InteropServices.InterfaceTypeAttribute" /> + <HasAttribute Name="System.Runtime.InteropServices.ComImport" /> + </Or> + </And> + <Kind Is="Struct" /> + </Or> + </TypePattern.Match> + </TypePattern> + <TypePattern DisplayName="NUnit Test Fixtures" RemoveRegions="All"> + <TypePattern.Match> + <And> + <Kind Is="Class" /> + <HasAttribute Name="NUnit.Framework.TestFixtureAttribute" Inherited="True" /> + <HasAttribute Name="NUnit.Framework.TestCaseFixtureAttribute" Inherited="True" /> + </And> + </TypePattern.Match> + <Entry DisplayName="Setup/Teardown Methods"> + <Entry.Match> + <And> + <Kind Is="Method" /> + <Or> + <HasAttribute Name="NUnit.Framework.SetUpAttribute" Inherited="True" /> + <HasAttribute Name="NUnit.Framework.TearDownAttribute" Inherited="True" /> + <HasAttribute Name="NUnit.Framework.FixtureSetUpAttribute" Inherited="True" /> + <HasAttribute Name="NUnit.Framework.FixtureTearDownAttribute" Inherited="True" /> + </Or> + </And> + </Entry.Match> + </Entry> + <Entry DisplayName="All other members" /> + <Entry DisplayName="Test Methods" Priority="100"> + <Entry.Match> + <And> + <Kind Is="Method" /> + <HasAttribute Name="NUnit.Framework.TestAttribute" /> + </And> + </Entry.Match> + <Entry.SortBy> + <Name /> + </Entry.SortBy> + </Entry> + </TypePattern> + <TypePattern DisplayName="Default Pattern"> + <Entry DisplayName="Public Delegates" Priority="100"> + <Entry.Match> + <And> + <Access Is="Public" /> + <Kind Is="Delegate" /> + </And> + </Entry.Match> + <Entry.SortBy> + <Name /> + </Entry.SortBy> + </Entry> + <Entry DisplayName="Public Enums" Priority="100"> + <Entry.Match> + <And> + <Access Is="Public" /> + <Kind Is="Enum" /> + </And> + </Entry.Match> + <Entry.SortBy> + <Name /> + </Entry.SortBy> + </Entry> + <Entry DisplayName="Constructors"> + <Entry.Match> + <Kind Is="Constructor" /> + </Entry.Match> + <Entry.SortBy> + <Static /> + </Entry.SortBy> + </Entry> + <Entry DisplayName="Properties, Indexers"> + <Entry.Match> + <Or> + <Kind Is="Property" /> + <Kind Is="Indexer" /> + </Or> + </Entry.Match> + </Entry> + <Entry DisplayName="Interface Implementations" Priority="100"> + <Entry.Match> + <And> + <Kind Is="Member" /> + <ImplementsInterface /> + </And> + </Entry.Match> + <Entry.SortBy> + <ImplementsInterface Immediate="True" /> + </Entry.SortBy> + </Entry> + <Entry DisplayName="All other members" /> + <Entry DisplayName="Fields"> + <Entry.Match> + <And> + <Kind Is="Field" /> + <Not> + <Static /> + </Not> + </And> + </Entry.Match> + <Entry.SortBy> + <Access /> + <Readonly /> + </Entry.SortBy> + </Entry> + <Entry DisplayName="Static Fields and Constants"> + <Entry.Match> + <Or> + <Kind Is="Constant" /> + <And> + <Kind Is="Field" /> + <Static /> + </And> + </Or> + </Entry.Match> + <Entry.SortBy> + <Kind Order="Constant Field" /> + </Entry.SortBy> + </Entry> + <Entry DisplayName="Nested Types"> + <Entry.Match> + <Kind Is="Type" /> + </Entry.Match> + </Entry> + </TypePattern> +</Patterns> + <?xml version="1.0" encoding="utf-8" ?> + +<!-- +I. Overall + +I.1 Each pattern can have <Match>....</Match> element. For the given type declaration, the pattern with the match, evaluated to 'true' with the largest weight, will be used +I.2 Each pattern consists of the sequence of <Entry>...</Entry> elements. Type member declarations are distributed between entries +I.3 If pattern has RemoveAllRegions="true" attribute, then all regions will be cleared prior to reordering. Otherwise, only auto-generated regions will be cleared +I.4 The contents of each entry is sorted by given keys (First key is primary, next key is secondary, etc). Then the declarations are grouped and en-regioned by given property + +II. Available match operands + +Each operand may have Weight="..." attribute. This weight will be added to the match weight if the operand is evaluated to 'true'. +The default weight is 1 + +II.1 Boolean functions: +II.1.1 <And>....</And> +II.1.2 <Or>....</Or> +II.1.3 <Not>....</Not> + +II.2 Operands +II.2.1 <Kind Is="..."/>. Kinds are: class, struct, interface, enum, delegate, type, constructor, destructor, property, indexer, method, operator, field, constant, event, member +II.2.2 <Name Is="..." [IgnoreCase="true/false"] />. The 'Is' attribute contains regular expression +II.2.3 <HasAttribute CLRName="..." [Inherit="true/false"] />. The 'CLRName' attribute contains regular expression +II.2.4 <Access Is="..."/>. The 'Is' values are: public, protected, internal, protected internal, private +II.2.5 <Static/> +II.2.6 <Abstract/> +II.2.7 <Virtual/> +II.2.8 <Override/> +II.2.9 <Sealed/> +II.2.10 <Readonly/> +II.2.11 <ImplementsInterface CLRName="..."/>. The 'CLRName' attribute contains regular expression +II.2.12 <HandlesEvent /> +--> + +<Patterns xmlns="urn:shemas-jetbrains-com:member-reordering-patterns"> + + <!--Do not reorder COM interfaces and structs marked by StructLayout attribute--> + <Pattern> + <Match> + <Or Weight="100"> + <And> + <Kind Is="interface"/> + <Or> + <HasAttribute CLRName="System.Runtime.InteropServices.InterfaceTypeAttribute"/> + <HasAttribute CLRName="System.Runtime.InteropServices.ComImport"/> + </Or> + </And> + <HasAttribute CLRName="System.Runtime.InteropServices.StructLayoutAttribute"/> + </Or> + </Match> + </Pattern> + + <!--Special formatting of NUnit test fixture--> + <Pattern RemoveAllRegions="true"> + <Match> + <And Weight="100"> + <Kind Is="class"/> + <HasAttribute CLRName="NUnit.Framework.TestFixtureAttribute" Inherit="true"/> + </And> + </Match> + + <!--Setup/Teardow--> + <Entry> + <Match> + <And> + <Kind Is="method"/> + <Or> + <HasAttribute CLRName="NUnit.Framework.SetUpAttribute" Inherit="true"/> + <HasAttribute CLRName="NUnit.Framework.TearDownAttribute" Inherit="true"/> + <HasAttribute CLRName="NUnit.Framework.FixtureSetUpAttribute" Inherit="true"/> + <HasAttribute CLRName="NUnit.Framework.FixtureTearDownAttribute" Inherit="true"/> + </Or> + </And> + </Match> + </Entry> + + <!--All other members--> + <Entry/> + + <!--Test methods--> + <Entry> + <Match> + <And Weight="100"> + <Kind Is="method"/> + <HasAttribute CLRName="NUnit.Framework.TestAttribute" Inherit="false"/> + </And> + </Match> + <Sort> + <Name/> + </Sort> + </Entry> + </Pattern> + + <!--Default pattern--> + <Pattern> + + <!--public delegate--> + <Entry> + <Match> + <And Weight="100"> + <Access Is="public"/> + <Kind Is="delegate"/> + </And> + </Match> + <Sort> + <Name/> + </Sort> + </Entry> + + <!--public enum--> + <Entry> + <Match> + <And Weight="100"> + <Access Is="public"/> + <Kind Is="enum"/> + </And> + </Match> + <Sort> + <Name/> + </Sort> + </Entry> + + <!--Constructors. Place static one first--> + <Entry> + <Match> + <Kind Is="constructor"/> + </Match> + <Sort> + <Static/> + </Sort> + </Entry> + + <!--properties, indexers--> + <Entry> + <Match> + <Or> + <Kind Is="property"/> + <Kind Is="indexer"/> + </Or> + </Match> + </Entry> + + <!--interface implementations--> + <Entry> + <Match> + <And Weight="100"> + <Kind Is="member"/> + <ImplementsInterface/> + </And> + </Match> + <Sort> + <ImplementsInterface Immediate="true"/> + </Sort> + </Entry> + + <!--all other members--> + <Entry/> + +<!--static fields and constants--> + <Entry> + <Match> + <Or> + <Kind Is="constant"/> + <And> + <Kind Is="field"/> + <Static/> + </And> + </Or> + </Match> + <Sort> + <Kind Order="constant field"/> + </Sort> + </Entry> + + <!--instance fields--> + <Entry> + <Match> + <And> + <Kind Is="field"/> + <Not> + <Static/> + </Not> + </And> + </Match> + <Sort> + <Readonly/> + <Name/> + </Sort> + </Entry> + + <!--nested types--> + <Entry> + <Match> + <Kind Is="type"/> + </Match> + <Sort> + <Name/> + </Sort> + </Entry> + </Pattern> + +</Patterns> + + CustomLayout + True + False + True + False + True + False + False + False + True + Automatic property + True + False + False + DB + DTC + ID + NSB + SLA + $object$_On$event$ + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="I" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="T" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="I" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="T" Suffix="" Style="AaBb" /> + $object$_On$event$ + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="I" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="T" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + True + True + True + True + True + True + True + True + True + True + True + True + True + + + + <data /> + <data><IncludeFilters /><ExcludeFilters /></data> \ No newline at end of file diff --git a/AttributeAssembly/DoNotWarnAboutObsoleteUsageAttribute.cs b/Obsolete/DoNotWarnAboutObsoleteUsageAttribute.cs similarity index 100% rename from AttributeAssembly/DoNotWarnAboutObsoleteUsageAttribute.cs rename to Obsolete/DoNotWarnAboutObsoleteUsageAttribute.cs diff --git a/Obsolete/Obsolete.csproj b/Obsolete/Obsolete.csproj new file mode 100644 index 0000000..0da1456 --- /dev/null +++ b/Obsolete/Obsolete.csproj @@ -0,0 +1,13 @@ + + + + net452;netstandard1.4 + true + ..\key.snk + true + + + + + + \ No newline at end of file diff --git a/AttributeAssembly/ObsoleteExAttribute.cs b/Obsolete/ObsoleteExAttribute.cs similarity index 100% rename from AttributeAssembly/ObsoleteExAttribute.cs rename to Obsolete/ObsoleteExAttribute.cs diff --git a/README.md b/README.md index 33c8d9d..fd2e58a 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ [![Chat on Gitter](https://img.shields.io/gitter/room/fody/fody.svg?style=flat)](https://gitter.im/Fody/Fody) [![NuGet Status](http://img.shields.io/nuget/v/Obsolete.Fody.svg?style=flat)](https://www.nuget.org/packages/Obsolete.Fody/) -## This is an add-in for [Fody](https://github.com/Fody/Fody/) +## This is an add-in for [Fody](https://github.com/Fody/Fody/) -![Icon](https://raw.github.com/Fody/Obsolete/master/Icons/package_icon.png) +![Icon](https://raw.github.com/Fody/Obsolete/master/package_icon.png) Helps keep usages of [ObsoleteAttribute](http://msdn.microsoft.com/en-us/library/fwz0y5c2) consistent. diff --git a/Tests/ConfigReaderTests.cs b/Tests/ConfigReaderTests.cs index 6471490..f471052 100644 --- a/Tests/ConfigReaderTests.cs +++ b/Tests/ConfigReaderTests.cs @@ -35,7 +35,7 @@ public void FalseHideObsoleteMembers() [Test] public void EmptyHideObsoleteMembers() { - var xElement = XElement.Parse(@""); + var xElement = XElement.Parse(""); var moduleWeaver = new ModuleWeaver {Config = xElement}; moduleWeaver.ReadConfig(); Assert.IsTrue(moduleWeaver.HideObsoleteMembers); diff --git a/Tests/IntegrationTests.cs b/Tests/IntegrationTests.cs index 030a84f..22028de 100644 --- a/Tests/IntegrationTests.cs +++ b/Tests/IntegrationTests.cs @@ -8,7 +8,6 @@ using NUnit.Framework; using ICustomAttributeProvider = System.Reflection.ICustomAttributeProvider; - [TestFixture] public class IntegrationTests { @@ -20,10 +19,7 @@ public class IntegrationTests public IntegrationTests() { - beforeAssemblyPath = Path.GetFullPath(Path.Combine(TestContext.CurrentContext.TestDirectory, @"..\..\..\AssemblyToProcess\bin\Debug\AssemblyToProcess.dll")); -#if (!DEBUG) - beforeAssemblyPath = beforeAssemblyPath.Replace("Debug", "Release"); -#endif + beforeAssemblyPath = Path.Combine(TestContext.CurrentContext.TestDirectory, "AssemblyToProcess.dll"); afterAssemblyPath = beforeAssemblyPath.Replace(".dll", "2.dll"); File.Copy(beforeAssemblyPath, afterAssemblyPath, true); diff --git a/Tests/SemanticVersionTests.cs b/Tests/SemanticVersionTests.cs index a9eb4c2..5643c21 100644 --- a/Tests/SemanticVersionTests.cs +++ b/Tests/SemanticVersionTests.cs @@ -3,22 +3,19 @@ [TestFixture] public class SemanticVersionTests { - - [Test] public void TryParse() { - SemanticVersion version; - SemanticVersion.TryParse("0.1", out version); + SemanticVersion.TryParse("0.1", out var version1); - Assert.AreEqual(version.Major,0); - Assert.AreEqual(version.Minor,1); - Assert.AreEqual(version.Patch,0); + Assert.AreEqual(version1.Major,0); + Assert.AreEqual(version1.Minor,1); + Assert.AreEqual(version1.Patch,0); - SemanticVersion.TryParse("0.1.0", out version); + SemanticVersion.TryParse("0.1.0", out var version2); - Assert.AreEqual(version.Major,0); - Assert.AreEqual(version.Minor,1); - Assert.AreEqual(version.Patch,0); + Assert.AreEqual(version2.Major,0); + Assert.AreEqual(version2.Minor,1); + Assert.AreEqual(version2.Patch,0); } } \ No newline at end of file diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj index cf0259b..18baa51 100644 --- a/Tests/Tests.csproj +++ b/Tests/Tests.csproj @@ -1,95 +1,17 @@  - - + - Debug - AnyCPU - {DAB36D28-050A-4F2A-AA93-B3163F92D71A} - Library - Properties - Tests - Tests - v4.6.2 - 512 - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - true - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false - true + net452;netcoreapp2.0 + true - - ..\packages\ApprovalTests.3.0.13\lib\net40\ApprovalTests.dll - True - - - ..\packages\ApprovalUtilities.3.0.13\lib\net45\ApprovalUtilities.dll - True - - - ..\packages\ApprovalUtilities.3.0.13\lib\net45\ApprovalUtilities.Net45.dll - True - - - ..\packages\FodyCecil.2.1.2\lib\net40\Mono.Cecil.dll - - - ..\packages\FodyCecil.2.1.2\lib\net40\Mono.Cecil.Mdb.dll - - - ..\packages\FodyCecil.2.1.2\lib\net40\Mono.Cecil.Pdb.dll - - - ..\packages\FodyCecil.2.1.2\lib\net40\Mono.Cecil.Rocks.dll - - - ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll - - - ..\packages\NUnit.3.7.1\lib\net45\nunit.framework.dll - - - ..\packages\ObjectApproval.1.6.0\lib\NET40\ObjectApproval.dll - True - - - - - - - - - - - - - - - - {C3578A7B-09A6-4444-9383-0DEAFA4958BD} - Fody - - - - + + + + + + + - \ No newline at end of file diff --git a/Tests/Verifier.cs b/Tests/Verifier.cs index f039467..6d4738b 100644 --- a/Tests/Verifier.cs +++ b/Tests/Verifier.cs @@ -1,11 +1,30 @@ using System; using System.Diagnostics; using System.IO; +using System.Linq; using System.Text.RegularExpressions; using NUnit.Framework; public static class Verifier { + static string exePath; + + static Verifier() + { + var windowsSdk = Environment.ExpandEnvironmentVariables(@"%programfiles(x86)%\Microsoft SDKs\Windows\"); + exePath = Directory.EnumerateFiles(windowsSdk, "PEVerify.exe", SearchOption.AllDirectories) + .OrderBy(x => + { + var fileVersionInfo = FileVersionInfo.GetVersionInfo(x); + return new Version(fileVersionInfo.FileMajorPart, fileVersionInfo.FileMinorPart, fileVersionInfo.FileBuildPart); + }) + .FirstOrDefault(); + if (exePath == null) + { + throw new Exception("Could not find path to PEVerify"); + } + } + public static void Verify(string beforeAssemblyPath, string afterAssemblyPath) { var before = Validate(beforeAssemblyPath); @@ -16,35 +35,20 @@ public static void Verify(string beforeAssemblyPath, string afterAssemblyPath) static string Validate(string assemblyPath2) { - var exePath = GetPathToPeVerify(); - if (!File.Exists(exePath)) - { - return string.Empty; - } - var process = Process.Start(new ProcessStartInfo(exePath, "\"" + assemblyPath2 + "\"") + using (var process = Process.Start(new ProcessStartInfo(exePath, $"\"{assemblyPath2}\"") { RedirectStandardOutput = true, UseShellExecute = false, CreateNoWindow = true - }); - - process.WaitForExit(10000); - return process.StandardOutput.ReadToEnd().Trim().Replace(assemblyPath2, ""); - } - - static string GetPathToPeVerify() - { - var exePath = Environment.ExpandEnvironmentVariables(@"%programfiles(x86)%\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\PEVerify.exe"); - - if (!File.Exists(exePath)) + })) { - exePath = Environment.ExpandEnvironmentVariables(@"%programfiles(x86)%\Microsoft SDKs\Windows\v8.0A\Bin\NETFX 4.0 Tools\PEVerify.exe"); + process.WaitForExit(10000); + return process.StandardOutput.ReadToEnd().Trim().Replace(assemblyPath2, ""); } - return exePath; } static string TrimLineNumbers(string foo) { - return Regex.Replace(foo, @"0x.*]", ""); + return Regex.Replace(foo, "0x.*]", ""); } } \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..deb548a --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,17 @@ +version: 1.0.{build} +image: Visual Studio 2017 +configuration: Release +platform: Any CPU +install: +- cmd: appveyor downloadfile https://dist.nuget.org/win-x86-commandline/latest/nuget.exe +before_build: +- ps: nuget restore +build: + verbosity: minimal +test_script: +- ps: >- + nunit3-console Tests\bin\Release\net452\Tests.dll + + dotnet test "Tests\Tests.csproj" --framework netcoreapp2.0 --configuration Release --no-build --output bin\Release\netcoreapp2.0 +artifacts: +- path: nugets\**\*.nupkg \ No newline at end of file diff --git a/Icons/package_icon.png b/package_icon.png similarity index 100% rename from Icons/package_icon.png rename to package_icon.png