From fc14690c99aa72b99e22684a747cb245de9cdfcb Mon Sep 17 00:00:00 2001 From: cjundt Date: Thu, 16 Jan 2020 15:07:32 +0100 Subject: [PATCH] Target both netstandard2.0 and netstandard2.1 frameworks to preserve compatibility with .NET Framework 4.5+ --- CS-Load-Net48/App.config | 6 ++ CS-Load-Net48/CS-Load-Net48.csproj | 59 +++++++++++++++++++ CS-Load-Net48/Program.cs | 25 ++++++++ CS-Load-Net48/Properties/AssemblyInfo.cs | 36 +++++++++++ Gepsio.sln | 11 +++- .../JeffFerguson.Gepsio.csproj | 10 ++-- JeffFerguson.Gepsio/XbrlDocument.cs | 6 +- .../Implementations/SystemXmlLinq/Document.cs | 3 +- .../Xml/Interfaces/IDocument.cs | 3 +- 9 files changed, 149 insertions(+), 10 deletions(-) create mode 100644 CS-Load-Net48/App.config create mode 100644 CS-Load-Net48/CS-Load-Net48.csproj create mode 100644 CS-Load-Net48/Program.cs create mode 100644 CS-Load-Net48/Properties/AssemblyInfo.cs diff --git a/CS-Load-Net48/App.config b/CS-Load-Net48/App.config new file mode 100644 index 0000000..193aecc --- /dev/null +++ b/CS-Load-Net48/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/CS-Load-Net48/CS-Load-Net48.csproj b/CS-Load-Net48/CS-Load-Net48.csproj new file mode 100644 index 0000000..cc4f9bf --- /dev/null +++ b/CS-Load-Net48/CS-Load-Net48.csproj @@ -0,0 +1,59 @@ + + + + + Debug + AnyCPU + {0ECD24DE-FDBB-4B5D-A59E-4B2C24401095} + Exe + CS_Load_Net48 + CS-Load-Net48 + v4.8 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + {113daa29-48e6-4102-8519-21841817717b} + JeffFerguson.Gepsio + + + + \ No newline at end of file diff --git a/CS-Load-Net48/Program.cs b/CS-Load-Net48/Program.cs new file mode 100644 index 0000000..11e40b3 --- /dev/null +++ b/CS-Load-Net48/Program.cs @@ -0,0 +1,25 @@ +using JeffFerguson.Gepsio; + +namespace Load +{ + class Program + { + static void Main(string[] args) + { + LoadFromLocalFile(); + LoadFromUrl(); + } + + static void LoadFromLocalFile() + { + var xbrlDoc = new XbrlDocument(); + xbrlDoc.Load(@"..\..\..\JeffFerguson.Gepsio.Test\XBRL-CONF-2014-12-10\Common\300-instance\301-01-IdScopeValid.xml"); + } + + static void LoadFromUrl() + { + var xbrlDoc = new XbrlDocument(); + xbrlDoc.Load("http://xbrlsite.com/US-GAAP/BasicExample/2010-09-30/abc-20101231.xml"); + } + } +} diff --git a/CS-Load-Net48/Properties/AssemblyInfo.cs b/CS-Load-Net48/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..c36e38b --- /dev/null +++ b/CS-Load-Net48/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Les informations générales relatives à un assembly dépendent de +// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations +// associées à un assembly. +[assembly: AssemblyTitle("CS-Load-Net48")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CS-Load-Net48")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly +// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de +// COM, affectez la valeur true à l'attribut ComVisible sur ce type. +[assembly: ComVisible(false)] + +// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM +[assembly: Guid("0ecd24de-fdbb-4b5d-a59e-4b2c24401095")] + +// Les informations de version pour un assembly se composent des quatre valeurs suivantes : +// +// Version principale +// Version secondaire +// Numéro de build +// Révision +// +// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut +// en utilisant '*', comme indiqué ci-dessous : +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Gepsio.sln b/Gepsio.sln index a041a64..a32de14 100644 --- a/Gepsio.sln +++ b/Gepsio.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26730.16 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29613.14 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JeffFerguson.Gepsio", "JeffFerguson.Gepsio\JeffFerguson.Gepsio.csproj", "{113DAA29-48E6-4102-8519-21841817717B}" EndProject @@ -50,6 +50,8 @@ Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "VB-ValidityChecks", "Exampl EndProject Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FS-ValidityChecks", "Examples\FSharp\FS-ValidityChecks\FS-ValidityChecks.fsproj", "{240ACE45-827F-4BF4-A8B2-A665F60543D4}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CS-Load-Net48", "CS-Load-Net48\CS-Load-Net48.csproj", "{0ECD24DE-FDBB-4B5D-A59E-4B2C24401095}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -108,6 +110,10 @@ Global {240ACE45-827F-4BF4-A8B2-A665F60543D4}.Debug|Any CPU.Build.0 = Debug|Any CPU {240ACE45-827F-4BF4-A8B2-A665F60543D4}.Release|Any CPU.ActiveCfg = Release|Any CPU {240ACE45-827F-4BF4-A8B2-A665F60543D4}.Release|Any CPU.Build.0 = Release|Any CPU + {0ECD24DE-FDBB-4B5D-A59E-4B2C24401095}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0ECD24DE-FDBB-4B5D-A59E-4B2C24401095}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0ECD24DE-FDBB-4B5D-A59E-4B2C24401095}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0ECD24DE-FDBB-4B5D-A59E-4B2C24401095}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -129,6 +135,7 @@ Global {7BE7AC00-EE8A-443E-B4A7-513586C967C7} = {7455EAEB-9C1A-45FD-A081-995D03D3928B} {4466F96A-BA67-4AF1-99E4-42B0196CE126} = {2B52986E-F25A-4D24-AE8D-030E0D30000B} {240ACE45-827F-4BF4-A8B2-A665F60543D4} = {E85AD6CE-FD56-4964-B6B6-27155121CC06} + {0ECD24DE-FDBB-4B5D-A59E-4B2C24401095} = {BF2C0A53-F1C4-4F35-9C9A-E0216745A023} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {66D6765D-440E-4A82-BC6E-0628A4A0618C} diff --git a/JeffFerguson.Gepsio/JeffFerguson.Gepsio.csproj b/JeffFerguson.Gepsio/JeffFerguson.Gepsio.csproj index cbc2104..e1cd0ea 100644 --- a/JeffFerguson.Gepsio/JeffFerguson.Gepsio.csproj +++ b/JeffFerguson.Gepsio/JeffFerguson.Gepsio.csproj @@ -1,7 +1,7 @@ - + - netstandard2.1 + netstandard2.0;netstandard2.1 true Gepsio 2.1.0.15 @@ -20,11 +20,13 @@ - bin\Debug\netstandard2.0\JeffFerguson.Gepsio.xml + JeffFerguson.Gepsio.xml + bin\Debug - bin\Release\netstandard2.0\JeffFerguson.Gepsio.xml + JeffFerguson.Gepsio.xml + bin\Release diff --git a/JeffFerguson.Gepsio/XbrlDocument.cs b/JeffFerguson.Gepsio/XbrlDocument.cs index 0aa09ca..b875a00 100644 --- a/JeffFerguson.Gepsio/XbrlDocument.cs +++ b/JeffFerguson.Gepsio/XbrlDocument.cs @@ -180,6 +180,7 @@ public void Load(string Filename) Parse(SchemaValidXbrl); } +#if NETSTANDARD2_1 /// /// Asynchronously loads a local filesystem or Internet-accessible XBRL document containing /// XBRL data. @@ -205,7 +206,7 @@ public async Task LoadAsync(string Filename) this.Path = System.IO.Path.GetDirectoryName(this.Filename); Parse(SchemaValidXbrl); } - +#endif /// /// Synchronously loads an XBRL document containing XBRL data from a stream. /// @@ -288,6 +289,7 @@ public void Load(Stream dataStream) this.Path = string.Empty; Parse(SchemaValidXbrl); } +#if NETSTANDARD2_1 /// /// Asynchronously loads an XBRL document containing XBRL data from a stream. @@ -371,7 +373,7 @@ public async Task LoadAsync(Stream dataStream) this.Path = string.Empty; Parse(SchemaValidXbrl); } - +#endif /// /// Parse the document, looking for fragments that can be processed. /// diff --git a/JeffFerguson.Gepsio/Xml/Implementations/SystemXmlLinq/Document.cs b/JeffFerguson.Gepsio/Xml/Implementations/SystemXmlLinq/Document.cs index b617398..283f8f5 100644 --- a/JeffFerguson.Gepsio/Xml/Implementations/SystemXmlLinq/Document.cs +++ b/JeffFerguson.Gepsio/Xml/Implementations/SystemXmlLinq/Document.cs @@ -26,6 +26,7 @@ public void Load(Stream stream) doc = XDocument.Load(stream, LoadOptions.SetBaseUri); } +#if NETSTANDARD2_1 public async Task LoadAsync(string path) { if(File.Exists(path)) @@ -60,7 +61,7 @@ public async Task LoadAsync(Stream stream) var cancelToken = new CancellationToken(); doc = await XDocument.LoadAsync(stream, LoadOptions.SetBaseUri, cancelToken); } - +#endif public INodeList SelectNodes(string xpath, INamespaceManager namespaceManager) { var selectedElements = doc.XPathSelectElements(xpath, (namespaceManager as NamespaceManager).XmlNamespaceManager); diff --git a/JeffFerguson.Gepsio/Xml/Interfaces/IDocument.cs b/JeffFerguson.Gepsio/Xml/Interfaces/IDocument.cs index 74e02e0..65aa102 100644 --- a/JeffFerguson.Gepsio/Xml/Interfaces/IDocument.cs +++ b/JeffFerguson.Gepsio/Xml/Interfaces/IDocument.cs @@ -37,6 +37,7 @@ public interface IDocument /// void Load(Stream stream); +#if NETSTANDARD2_1 /// /// Loads an XBRL document asynchronously. /// @@ -52,7 +53,7 @@ public interface IDocument /// A stream containing the XBRL data to be loaded. /// Task LoadAsync(Stream stream); - +#endif /// /// Select a set of nodes from the document. ///