From 92a1a608831ce1b68967ba43f0819274e0742638 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Sim=C3=B5es?= Date: Tue, 23 Apr 2019 09:08:33 +0100 Subject: [PATCH] Add AssemblyNativeVersionAttribute MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Simões --- .../CoreLibrary.nfproj | 3 ++ .../System/AssemblyInfo2.cs | 3 ++ .../System/Reflection/AssemblyAttributes.cs | 33 +++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/source/nanoFramework.CoreLibrary/CoreLibrary.nfproj b/source/nanoFramework.CoreLibrary/CoreLibrary.nfproj index 4b945850..f32172ef 100644 --- a/source/nanoFramework.CoreLibrary/CoreLibrary.nfproj +++ b/source/nanoFramework.CoreLibrary/CoreLibrary.nfproj @@ -313,6 +313,9 @@ false + + false + false diff --git a/source/nanoFramework.CoreLibrary/System/AssemblyInfo2.cs b/source/nanoFramework.CoreLibrary/System/AssemblyInfo2.cs index e1a1bda9..009f1b41 100644 --- a/source/nanoFramework.CoreLibrary/System/AssemblyInfo2.cs +++ b/source/nanoFramework.CoreLibrary/System/AssemblyInfo2.cs @@ -6,9 +6,12 @@ using System; using System.Reflection; +using System.Runtime.CompilerServices; [assembly: CLSCompliant(true)] [assembly: AssemblyTitle("mscorlib")] [assembly: AssemblyCompany("nanoFramework Contributors")] [assembly: AssemblyProduct("nanoFramework mscorlib")] [assembly: AssemblyCopyright("Copyright © nanoFramework Contributors 2017")] + +[assembly: AssemblyNativeVersion("1.1.1.")] diff --git a/source/nanoFramework.CoreLibrary/System/Reflection/AssemblyAttributes.cs b/source/nanoFramework.CoreLibrary/System/Reflection/AssemblyAttributes.cs index a6ffadf8..1186bdb6 100644 --- a/source/nanoFramework.CoreLibrary/System/Reflection/AssemblyAttributes.cs +++ b/source/nanoFramework.CoreLibrary/System/Reflection/AssemblyAttributes.cs @@ -226,4 +226,37 @@ public String Version get { return _version; } } } + + /// + /// Defines the required native version required for an assembly. + /// At deploy time this is used to check if the target device has the correct native version to support this assembly. + /// + /// + /// This attribute is specific of nanoFramework. + /// + [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class, Inherited = false)] + public sealed class AssemblyNativeVersionAttribute : Attribute + { + private readonly String _nativeVersion; + + /// + /// Initializes a new instance of the AssemblyNativeVersionAttribute class. + /// + /// The native version required for the assembly. + public AssemblyNativeVersionAttribute(String version) + { + _nativeVersion = version; + } + + /// + /// Gets the native version required for the assembly. + /// + /// + /// A string containing the native version. + /// + public String NativeVersion + { + get { return _nativeVersion; } + } + } }