diff --git a/MetadataProcessor.MsBuildTask/MetaDataProcessorTask.cs b/MetadataProcessor.MsBuildTask/MetaDataProcessorTask.cs
new file mode 100644
index 0000000..9eb71f2
--- /dev/null
+++ b/MetadataProcessor.MsBuildTask/MetaDataProcessorTask.cs
@@ -0,0 +1,442 @@
+//
+// Copyright (c) .NET Foundation and Contributors
+// Portions Copyright (c) Microsoft Corporation. All rights reserved.
+// See LICENSE file in the project root for full license information.
+//
+
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+using System.ComponentModel;
+using System;
+using System.IO;
+using System.Linq;
+using System.Collections.Generic;
+using nanoFramework.Tools.Utilities;
+using System.Xml;
+using nanoFramework.Tools.MetadataProcessor.Core;
+using Mono.Cecil;
+
+namespace nanoFramework.Tools.MetadataProcessor.MsBuildTask
+{
+ [Description("MetaDataProcessorTaskEntry")]
+ public class MetaDataProcessorTask : Task
+ {
+
+ #region public properties for the task
+
+ ///
+ /// Array of nanoFramework assemblies to be passed to MetaDataProcessor in -loadHints switch
+ ///
+ public ITaskItem[] LoadHints { get; set; }
+
+ public ITaskItem[] IgnoreAssembly { get; set; }
+
+ public ITaskItem[] Load { get; set; }
+
+ public ITaskItem[] LoadDatabase { get; set; }
+
+ public string LoadStrings { get; set; }
+
+ public ITaskItem[] ExcludeClassByName { get; set; }
+
+ public ITaskItem[] ImportResources { get; set; }
+
+ public string Parse { get; set; }
+
+ public string GenerateStringsTable { get; set; }
+
+ public string Compile { get; set; }
+
+ public bool Verbose { get; set; }
+
+ public bool VerboseMinimize { get; set; }
+
+ public bool NoByteCode { get; set; }
+
+ public bool NoAttributes { get; set; }
+
+ public ITaskItem[] CreateDatabase { get; set; }
+
+ ///
+ /// Parameter to enable stubs generation step.
+ ///
+ public bool GenerateStubs { get; set; } = false;
+
+ public string GenerateSkeletonFile { get; set; }
+
+ public string GenerateSkeletonName { get; set; }
+
+ public string GenerateSkeletonProject { get; set; }
+
+ public string GenerateDependency { get; set; }
+
+ public string CreateDatabaseFile { get; set; }
+
+ ///
+ /// Option to generate skeleton project without Interop support.
+ /// This is required to generate Core Libraries.
+ /// Default is false, meaning that Interop support will be used.
+ ///
+ public bool SkeletonWithoutInterop { get; set; } = false;
+
+ public bool Resolve { get; set; }
+
+ public string SaveStrings { get; set; }
+
+ public bool DumpMetadata { get; set; }
+
+ public string DumpFile { get; set; }
+
+ public string DumpExports { get; set; }
+
+ ///
+ /// Flag to set when compiling a Core Library.
+ ///
+ public bool IsCoreLibrary { get; set; } = false;
+
+ private readonly List _filesWritten = new List();
+
+ [Output]
+ public ITaskItem[] FilesWritten { get { return _filesWritten.ToArray(); } }
+
+ [Output]
+ public ITaskItem NativeChecksum { get { return new TaskItem(_nativeChecksum); } }
+
+ #endregion
+
+ #region internal fields for MetadataProcessor
+
+ private AssemblyDefinition _assemblyDefinition;
+ private nanoAssemblyBuilder _assemblyBuilder;
+ private readonly IDictionary _loadHints =
+ new Dictionary(StringComparer.Ordinal);
+ private readonly List _classNamesToExclude = new List();
+ private string _nativeChecksum = "";
+
+ #endregion
+
+
+ public override bool Execute()
+ {
+ // report to VS output window what step the build is
+ Log.LogCommandLine(MessageImportance.Normal, "Starting nanoFramework MetadataProcessor...");
+
+ /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // developer note: to debug this task set an environment variable like this:
+ // set NFBUILD_TASKS_DEBUG=1
+ // this will cause the execution to pause bellow so a debugger can be attached
+ DebuggerHelper.WaitForDebuggerIfEnabled(TasksConstants.BuildTaskDebugVar);
+ /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+ try
+ {
+ // execution of the metadata processor have to be carried in the appropriate order
+ // failing to do so will most likely cause the task to fail
+
+ // load hints for referenced assemblies
+ if (LoadHints != null &&
+ LoadHints.Any())
+ {
+ if (Verbose) Log.LogCommandLine(MessageImportance.Normal, "Processing load hints...");
+
+ foreach (var hint in LoadHints)
+ {
+ var assemblyName = Path.GetFileNameWithoutExtension(hint.GetMetadata("FullPath"));
+ var assemblyPath = hint.GetMetadata("FullPath");
+
+ _loadHints[assemblyName] = assemblyPath;
+
+ if (Verbose) Log.LogCommandLine(MessageImportance.Normal, $"Adding load hint: {assemblyName} @ '{assemblyPath}'");
+ }
+ }
+
+ // class names to exclude from processing
+ if (ExcludeClassByName != null &&
+ ExcludeClassByName.Any())
+ {
+ if (Verbose) Log.LogCommandLine(MessageImportance.Normal, "Processing class exclusion list...");
+
+ foreach (var className in ExcludeClassByName)
+ {
+ _classNamesToExclude.Add(className.ToString());
+
+ if (Verbose) Log.LogCommandLine(MessageImportance.Normal, $"Adding '{className.ToString()}' to collection of classes to exclude");
+ }
+ }
+
+ // Analyses a .NET assembly
+ if (!string.IsNullOrEmpty(Parse))
+ {
+ if (Verbose) Log.LogCommandLine(MessageImportance.Normal, $"Analysing .NET assembly {Path.GetFileNameWithoutExtension(Parse)}...");
+
+ ExecuteParse(Parse);
+ }
+
+ // compiles an assembly into nanoCLR format
+ if (!string.IsNullOrEmpty(Compile))
+ {
+ // sanity check for missing parse
+ if (string.IsNullOrEmpty(Parse))
+ {
+ // can't compile without analysing first
+ throw new ArgumentException("Can't compile without first analysing a .NET Assembly. Check the targets file for a missing option invoking MetadataProcessor Task.");
+ }
+ else
+ {
+ if (Verbose) Log.LogCommandLine(MessageImportance.Normal, $"Compiling {Path.GetFileNameWithoutExtension(Compile)} into nanoCLR format...");
+
+ ExecuteCompile(Compile);
+ }
+ }
+
+ // generate skeleton files with stubs to add native code for an assembly
+ if (GenerateStubs)
+ {
+ if (string.IsNullOrEmpty(GenerateSkeletonFile))
+ {
+ // can't generate skeleton without GenerateSkeletonFile parameter
+ throw new ArgumentException("Can't generate skeleton project without 'GenerateSkeletonFile'. Check the targets file for a missing parameter when invoking MetadataProcessor Task.");
+ }
+
+ if (string.IsNullOrEmpty(GenerateSkeletonProject))
+ {
+ // can't generate skeleton without GenerateSkeletonProject parameter
+ throw new ArgumentException("Can't generate skeleton project without 'GenerateSkeletonProject'. Check the targets file for a missing parameter when invoking MetadataProcessor Task.");
+ }
+
+ if (string.IsNullOrEmpty(GenerateSkeletonName))
+ {
+ // can't generate skeleton without GenerateSkeletonName parameter
+ throw new ArgumentException("Can't generate skeleton project without 'GenerateSkeletonName'. Check the targets file for a missing parameter when invoking MetadataProcessor Task.");
+ }
+
+ // sanity check for missing compile (therefore parse too)
+ if (string.IsNullOrEmpty(Compile))
+ {
+ // can't generate skeleton without compiling first
+ throw new ArgumentException("Can't generate skeleton project without first compiling the .NET Assembly. Check the targets file for a missing option invoking MetadataProcessor Task.");
+ }
+ else
+ {
+ if (Verbose) Log.LogCommandLine(MessageImportance.Normal, $"Generating skeleton '{GenerateSkeletonName}' for {GenerateSkeletonProject} \r\nPlacing files @ '{GenerateSkeletonFile}'");
+
+ ExecuteGenerateSkeleton(
+ GenerateSkeletonFile,
+ GenerateSkeletonName,
+ GenerateSkeletonProject,
+ SkeletonWithoutInterop);
+ }
+ }
+
+ RecordFilesWritten();
+ }
+ catch (Exception ex)
+ {
+ Log.LogErrorFromException(ex, true);
+ }
+ finally
+ {
+ // need to dispose the AssemblyDefinition before leaving because Mono.Cecil assembly loading and resolution
+ // operations leave the assembly file locked in the AppDomain preventing it from being open on subsequent Tasks
+ // see https://github.com/nanoframework/Home/issues/553
+ if (_assemblyDefinition != null)
+ {
+ _assemblyDefinition.Dispose();
+ }
+ }
+
+ // if we've logged any errors that's because there were errors (WOW!)
+ return !Log.HasLoggedErrors;
+ }
+
+ private void RecordFileWritten(
+ string file)
+ {
+ if (!string.IsNullOrEmpty(file))
+ {
+ if (File.Exists(file))
+ {
+ _filesWritten.Add(new TaskItem(file));
+ }
+ }
+ }
+
+ private void RecordFilesWritten()
+ {
+ RecordFileWritten(SaveStrings);
+ RecordFileWritten(GenerateStringsTable);
+ RecordFileWritten(DumpFile);
+ RecordFileWritten(DumpExports);
+ RecordFileWritten(Compile);
+ RecordFileWritten(Path.ChangeExtension(Compile, "pdbx"));
+ RecordFileWritten(CreateDatabaseFile);
+ RecordFileWritten(GenerateDependency);
+ }
+
+ #region Metadata Processor helper methods
+
+ private void ExecuteParse(
+ string fileName)
+ {
+ try
+ {
+ if (Verbose) Log.LogCommandLine(MessageImportance.Normal, "Parsing assembly...");
+
+ _assemblyDefinition = AssemblyDefinition.ReadAssembly(fileName,
+ new ReaderParameters { AssemblyResolver = new LoadHintsAssemblyResolver(_loadHints) });
+ }
+ catch (Exception)
+ {
+ Log.LogError($"Unable to parse input assembly file '{fileName}' - check if path and file exists.");
+ }
+ }
+
+ private void ExecuteCompile(
+ string fileName)
+ {
+ try
+ {
+ // compile assembly (1st pass)
+ if (Verbose) Log.LogCommandLine(MessageImportance.Normal, "Compiling assembly...");
+
+ _assemblyBuilder = new nanoAssemblyBuilder(
+ _assemblyDefinition,
+ _classNamesToExclude,
+ Verbose,
+ IsCoreLibrary);
+
+ using (var stream = File.Open(Path.ChangeExtension(fileName, "tmp"), FileMode.Create, FileAccess.ReadWrite))
+ using (var writer = new BinaryWriter(stream))
+ {
+ _assemblyBuilder.Write(GetBinaryWriter(writer));
+ }
+ }
+ catch (Exception)
+ {
+ Log.LogError($"Unable to compile output assembly file '{fileName}' - check parse command results.");
+
+ throw;
+ }
+
+ try
+ {
+ // OK to delete tmp PE file
+ File.Delete(Path.ChangeExtension(fileName, "tmp"));
+
+ // minimize (has to be called after the 1st compile pass)
+ if (Verbose) Log.LogCommandLine(MessageImportance.Normal, "Minimizing assembly...");
+
+ _assemblyBuilder.Minimize();
+
+ // compile assembly (2nd pass after minimize)
+ if (Verbose) Log.LogCommandLine(MessageImportance.Normal, "Recompiling assembly...");
+
+ using (var stream = File.Open(fileName, FileMode.Create, FileAccess.ReadWrite))
+ using (var writer = new BinaryWriter(stream))
+ {
+ _assemblyBuilder.Write(GetBinaryWriter(writer));
+ }
+
+ // output PDBX
+ using (var writer = XmlWriter.Create(Path.ChangeExtension(fileName, "pdbx")))
+ {
+ _assemblyBuilder.Write(writer);
+ }
+
+ // output assembly metadata
+ if (DumpMetadata)
+ {
+ if (Verbose) Log.LogCommandLine(MessageImportance.Normal, "Dumping assembly metadata...");
+
+ DumpFile = Path.ChangeExtension(fileName, "dump.txt");
+
+ nanoDumperGenerator dumper = new nanoDumperGenerator(
+ _assemblyBuilder.TablesContext,
+ DumpFile);
+ dumper.DumpAll();
+ }
+
+ // set environment variable with assembly native checksum
+ Environment.SetEnvironmentVariable("AssemblyNativeChecksum", _assemblyBuilder.GetNativeChecksum(), EnvironmentVariableTarget.Process);
+
+ // store assembly native checksum
+ _nativeChecksum = _assemblyBuilder.GetNativeChecksum();
+ }
+ catch (ArgumentException ex)
+ {
+ Log.LogError($"Exception minimizing assembly: {ex.Message}.");
+ }
+ catch (Exception)
+ {
+ Log.LogError($"Exception minimizing assembly.");
+ throw;
+ }
+ }
+
+ private void AddClassToExclude(
+ string className)
+ {
+ _classNamesToExclude.Add(className);
+ }
+
+ private void ExecuteGenerateSkeleton(
+ string file,
+ string name,
+ string project,
+ bool withoutInteropCode)
+ {
+ try
+ {
+ if (Verbose) Log.LogCommandLine(MessageImportance.Normal, "Generating skeleton files...");
+
+ var skeletonGenerator = new nanoSkeletonGenerator(
+ _assemblyBuilder.TablesContext,
+ file,
+ name,
+ project,
+ withoutInteropCode,
+ IsCoreLibrary);
+
+ skeletonGenerator.GenerateSkeleton();
+ }
+ catch (Exception)
+ {
+ Log.LogError("Unable to generate skeleton files");
+
+ throw;
+ }
+ }
+
+ private void ExecuteGenerateDependency(
+ string fileName)
+ {
+ try
+ {
+ var dependencyGenerator = new nanoDependencyGenerator(
+ _assemblyDefinition,
+ _assemblyBuilder.TablesContext,
+ fileName);
+
+ using (var writer = XmlWriter.Create(fileName))
+ {
+ dependencyGenerator.Write(writer);
+ }
+ }
+ catch (Exception)
+ {
+ Log.LogError($"Unable to generate and write dependency graph for assembly file '{fileName}'.");
+
+ throw;
+ }
+ }
+
+ private nanoBinaryWriter GetBinaryWriter(
+ BinaryWriter writer)
+ {
+ return nanoBinaryWriter.CreateLittleEndianBinaryWriter(writer);
+ }
+
+ #endregion
+
+ }
+}
diff --git a/MetadataProcessor.MsBuildTask/MetadataProcessor.MsBuildTask.csproj b/MetadataProcessor.MsBuildTask/MetadataProcessor.MsBuildTask.csproj
new file mode 100644
index 0000000..df3b448
--- /dev/null
+++ b/MetadataProcessor.MsBuildTask/MetadataProcessor.MsBuildTask.csproj
@@ -0,0 +1,84 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {9B18784E-1BF2-47D1-BDD1-85B678F883F9}
+ Library
+ Properties
+ nanoFramework.Tools.MetadataProcessor.MsBuildTask
+ nanoFramework.Tools.MetadataProcessor.MsBuildTask
+ v4.7.2
+ 512
+
+
+ true
+ true
+ true
+ True
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ portable
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {e32f7d15-2499-440c-8026-4d5ee1c5ec3a}
+ MetadataProcessor.Core
+
+
+
+
+
+
+
+ 1.0.0
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+ 0.11.3
+
+
+ 1.0.0
+
+
+ 3.3.37
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+
+
\ No newline at end of file
diff --git a/MetadataProcessor.MsBuildTask/Properties/AssemblyInfo.cs b/MetadataProcessor.MsBuildTask/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..cb2ed57
--- /dev/null
+++ b/MetadataProcessor.MsBuildTask/Properties/AssemblyInfo.cs
@@ -0,0 +1,21 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle(".NET nanoFramework Metadata processor MSBuild Task library")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("nanoFramework")]
+[assembly: AssemblyProduct(".NET nanoFramework Metadata processor MSBuild Task library")]
+[assembly: AssemblyCopyright("Copyright © 2020 nanoFramework contributors")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
diff --git a/MetadataProcessor.MsBuildTask/TasksConstants.cs b/MetadataProcessor.MsBuildTask/TasksConstants.cs
new file mode 100644
index 0000000..3dc3415
--- /dev/null
+++ b/MetadataProcessor.MsBuildTask/TasksConstants.cs
@@ -0,0 +1,13 @@
+//
+// Copyright (c) .NET Foundation and Contributors
+// Portions Copyright (c) Microsoft Corporation. All rights reserved.
+// See LICENSE file in the project root for full license information.
+//
+
+namespace nanoFramework.Tools
+{
+ internal class TasksConstants
+ {
+ public const string BuildTaskDebugVar = "NFBUILD_TASKS_DEBUG";
+ }
+}
diff --git a/MetadataProcessor.MsBuildTask/Utilities/DebuggerHelper.cs b/MetadataProcessor.MsBuildTask/Utilities/DebuggerHelper.cs
new file mode 100644
index 0000000..48782fb
--- /dev/null
+++ b/MetadataProcessor.MsBuildTask/Utilities/DebuggerHelper.cs
@@ -0,0 +1,47 @@
+//
+// Copyright (c) .NET Foundation and Contributors
+// Portions Copyright (c) Microsoft Corporation. All rights reserved.
+// See LICENSE file in the project root for full license information.
+//
+
+using System;
+using System.Diagnostics;
+using System.Threading;
+
+namespace nanoFramework.Tools.Utilities
+{
+ internal static class DebuggerHelper
+ {
+ public static void WaitForDebuggerIfEnabled(string varName, int timeoutSeconds = 30)
+ {
+
+ // this wait should be only available on debug build
+ // to prevent unwanted wait on VS in machines where the variable is present
+#if DEBUG
+ TimeSpan waitForDebugToAttach = TimeSpan.FromSeconds(timeoutSeconds);
+
+ var debugEnabled = Environment.GetEnvironmentVariable(varName, EnvironmentVariableTarget.User);
+
+ if (!string.IsNullOrEmpty(debugEnabled) && debugEnabled.Equals("1", StringComparison.Ordinal))
+ {
+ Console.WriteLine($".NET nanoFramework Metadata Processor msbuild instrumentation task debugging is enabled. Waiting {timeoutSeconds} seconds for debugger attachment...");
+
+ var currentProcessId = Process.GetCurrentProcess().Id;
+ var currentProcessName = Process.GetProcessById(currentProcessId).ProcessName;
+ Console.WriteLine(
+ string.Format("Process Id: {0}, Name: {1}", currentProcessId, currentProcessName)
+ );
+
+ // wait N seconds for debugger to attach
+ while (!Debugger.IsAttached && waitForDebugToAttach.TotalSeconds > 0)
+ {
+ Thread.Sleep(1000);
+ waitForDebugToAttach -= TimeSpan.FromSeconds(1);
+ }
+
+ Debugger.Break();
+ }
+#endif
+ }
+ }
+}
diff --git a/MetadataProcessor.MsBuildTask/nanoFramework.Tools.MetadataProcessor.MsBuildTask.targets b/MetadataProcessor.MsBuildTask/nanoFramework.Tools.MetadataProcessor.MsBuildTask.targets
new file mode 100644
index 0000000..fea4bda
--- /dev/null
+++ b/MetadataProcessor.MsBuildTask/nanoFramework.Tools.MetadataProcessor.MsBuildTask.targets
@@ -0,0 +1,40 @@
+
+
+
+ MSBuild
+ nanoFramework\v1.0\
+ Always
+ true
+
+
+ MSBuild
+ nanoFramework\v1.0\
+ Always
+ true
+
+
+ MSBuild
+ nanoFramework\v1.0\
+ Always
+ true
+
+
+ MSBuild
+ nanoFramework\v1.0\
+ Always
+ true
+
+
+ MSBuild
+ nanoFramework\v1.0\
+ Always
+ true
+
+
+ MSBuild
+ nanoFramework\v1.0\
+ Always
+ true
+
+
+
diff --git a/MetadataProcessor.MsBuildTask/package.nuspec b/MetadataProcessor.MsBuildTask/package.nuspec
new file mode 100644
index 0000000..a12888b
--- /dev/null
+++ b/MetadataProcessor.MsBuildTask/package.nuspec
@@ -0,0 +1,34 @@
+
+
+
+ nanoFramework.Tools.MetadataProcessor.MsBuildTask
+ nanoFramework.Tools.MetadataProcessor.MsBuildTask
+ $version$
+ nanoFramework project contributors
+ nanoFramework project contributors,dotnetfoundation
+
+ Metadata Processor MSBuild task to be used internally by the VS nanoFramework extension.
+
+
+
+ https://github.com/nanoframework/metadata-processor
+ images\nf-logo.png
+ LICENSE.md
+ false
+
+ Copyright (c) .NET Foundation and Contributors
+
+ nanoFramework, nano Framework, NETNF, NETMF, Micro Framework, .net
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/MetadataProcessor.MsBuildTask/packages.lock.json b/MetadataProcessor.MsBuildTask/packages.lock.json
new file mode 100644
index 0000000..80429f3
--- /dev/null
+++ b/MetadataProcessor.MsBuildTask/packages.lock.json
@@ -0,0 +1,55 @@
+{
+ "version": 1,
+ "dependencies": {
+ ".NETFramework,Version=v4.7.2": {
+ "Microsoft.SourceLink.GitHub": {
+ "type": "Direct",
+ "requested": "[1.0.0, )",
+ "resolved": "1.0.0",
+ "contentHash": "aZyGyGg2nFSxix+xMkPmlmZSsnGQ3w+mIG23LTxJZHN+GPwTQ5FpPgDo7RMOq+Kcf5D4hFWfXkGhoGstawX13Q==",
+ "dependencies": {
+ "Microsoft.Build.Tasks.Git": "1.0.0",
+ "Microsoft.SourceLink.Common": "1.0.0"
+ }
+ },
+ "Mono.Cecil": {
+ "type": "Direct",
+ "requested": "[0.11.3, )",
+ "resolved": "0.11.3",
+ "contentHash": "DNYE+io5XfEE8+E+5padThTPHJARJHbz1mhbhMPNrrWGKVKKqj/KEeLvbawAmbIcT73NuxLV7itHZaYCZcVWGg=="
+ },
+ "mustache-sharp": {
+ "type": "Direct",
+ "requested": "[1.0.0, )",
+ "resolved": "1.0.0",
+ "contentHash": "+RTxWGLH5p0ibl7XDbb8pOznAdqwxH3zic40eL1gq5xl8jZt3CFc04KSLLFWM3PgvlTzfbzDJfjzF7rCglqGAA=="
+ },
+ "Nerdbank.GitVersioning": {
+ "type": "Direct",
+ "requested": "[3.3.37, )",
+ "resolved": "3.3.37",
+ "contentHash": "YlDKV/gSHQGDThWSGqVyPfKeNP/kx1fj/NPFFgGc/cxzgIbXv4jtYOcbFOz3ZIeAKtpCcSAmVNDOikBs3OxI/A=="
+ },
+ "Microsoft.Build.Tasks.Git": {
+ "type": "Transitive",
+ "resolved": "1.0.0",
+ "contentHash": "z2fpmmt+1Jfl+ZnBki9nSP08S1/tbEOxFdsK1rSR+LBehIJz1Xv9/6qOOoGNqlwnAGGVGis1Oj6S8Kt9COEYlQ=="
+ },
+ "Microsoft.SourceLink.Common": {
+ "type": "Transitive",
+ "resolved": "1.0.0",
+ "contentHash": "G8DuQY8/DK5NN+3jm5wcMcd9QYD90UV7MiLmdljSJixi3U/vNaeBKmmXUqI4DJCOeWizIUEh4ALhSt58mR+5eg=="
+ },
+ "metadataprocessor.core": {
+ "type": "Project",
+ "dependencies": {
+ "Mono.Cecil": "0.11.3",
+ "mustache-sharp": "1.0.0"
+ }
+ }
+ },
+ ".NETFramework,Version=v4.7.2/win": {},
+ ".NETFramework,Version=v4.7.2/win-x64": {},
+ ".NETFramework,Version=v4.7.2/win-x86": {}
+ }
+}
\ No newline at end of file
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 1ac12cb..b901a8d 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -121,6 +121,7 @@ jobs:
sourceFolder: $(Build.SourcesDirectory)
Contents: |
**\bin\Release\nanoFramework.Tools.MetaDataProcessor.exe
+ **\bin\Release\nanoFramework.Tools.MetadataProcessor.MsBuildTask.dll
TargetFolder: '$(Build.ArtifactStagingDirectory)'
flattenFolders: true
@@ -134,10 +135,10 @@ jobs:
- task: NuGetCommand@2
condition: succeeded()
- displayName: Pack NuGet witj MDP tool
+ displayName: Pack NuGet with MDP MSBuild task
inputs:
command: 'custom'
- arguments: 'pack MetadataProcessor.Core\package.nuspec -Version $(NBGV_NuGetPackageVersion) -properties commit="$(Build.SourceVersion)"'
+ arguments: 'pack MetadataProcessor.MsBuildTask\package.nuspec -Version $(NBGV_NuGetPackageVersion) -properties commit="$(Build.SourceVersion)"'
- task: CopyFiles@1
condition: succeeded()
diff --git a/azure-pipelines/update-dependencies.ps1 b/azure-pipelines/update-dependencies.ps1
index 3aeabfb..fb4d302 100644
--- a/azure-pipelines/update-dependencies.ps1
+++ b/azure-pipelines/update-dependencies.ps1
@@ -35,37 +35,29 @@ git checkout --quiet develop | Out-Null
####################
# VS 2017
-Write-Host "Updating nanoFramework.Tools.MetadataProcessor.Core package in VS2017 solution..."
+Write-Host "Updating nanoFramework.Tools.MetadataProcessor.MsBuildTask package in VS2017 solution..."
-dotnet remove Tools.BuildTasks\Tools.BuildTasks.csproj package nanoFramework.Tools.MetadataProcessor.Core
+dotnet remove VisualStudio.Extension\VisualStudio.Extension.csproj package nanoFramework.Tools.MetadataProcessor.MsBuildTask
-dotnet add Tools.BuildTasks\Tools.BuildTasks.csproj package nanoFramework.Tools.MetadataProcessor.Core --prerelease -s https://pkgs.dev.azure.com/nanoframework/feed/_packaging/sandbox/nuget/v3/index.json
-
-dotnet remove VisualStudio.Extension\VisualStudio.Extension.csproj package nanoFramework.Tools.MetadataProcessor.Core
-
-dotnet add VisualStudio.Extension\VisualStudio.Extension.csproj package nanoFramework.Tools.MetadataProcessor.Core --prerelease -s https://pkgs.dev.azure.com/nanoframework/feed/_packaging/sandbox/nuget/v3/index.json
+dotnet add VisualStudio.Extension\VisualStudio.Extension.csproj package nanoFramework.Tools.MetadataProcessor.MsBuildTask --prerelease -s https://pkgs.dev.azure.com/nanoframework/feed/_packaging/sandbox/nuget/v3/index.json
####################
# VS 2019
-Write-Host "Updating nanoFramework.Tools.MetadataProcessor.Core package in VS2019 solution..."
+Write-Host "Updating nanoFramework.Tools.MetadataProcessor.MsBuildTask package in VS2019 solution..."
-dotnet remove Tools.BuildTasks-2019\Tools.BuildTasks.csproj package nanoFramework.Tools.MetadataProcessor.Core
+dotnet remove VisualStudio.Extension-2019\VisualStudio.Extension.csproj package nanoFramework.Tools.MetadataProcessor.MsBuildTask
-dotnet add Tools.BuildTasks-2019\Tools.BuildTasks.csproj package nanoFramework.Tools.MetadataProcessor.Core --prerelease -s https://pkgs.dev.azure.com/nanoframework/feed/_packaging/sandbox/nuget/v3/index.json
-
-dotnet remove VisualStudio.Extension-2019\VisualStudio.Extension.csproj package nanoFramework.Tools.MetadataProcessor.Core
-
-dotnet add VisualStudio.Extension-2019\VisualStudio.Extension.csproj package nanoFramework.Tools.MetadataProcessor.Core --prerelease -s https://pkgs.dev.azure.com/nanoframework/feed/_packaging/sandbox/nuget/v3/index.json
+dotnet add VisualStudio.Extension-2019\VisualStudio.Extension.csproj package nanoFramework.Tools.MetadataProcessor.MsBuildTask --prerelease -s https://pkgs.dev.azure.com/nanoframework/feed/_packaging/sandbox/nuget/v3/index.json
#####################
-"Bumping MetadataProcessor.Core to $packageTargetVersion." | Write-Host -ForegroundColor Cyan
+"Bumping MetadataProcessor.MsBuildTask to $packageTargetVersion." | Write-Host -ForegroundColor Cyan
# build commit message
-$commitMessage += "Bumps MetadataProcessor.Core to $packageTargetVersion.`n"
+$commitMessage += "Bumps MetadataProcessor.MsBuildTask to $packageTargetVersion.`n"
# build PR title
-$prTitle = "Bumps MetadataProcessor.Core to $packageTargetVersion"
+$prTitle = "Bumps MetadataProcessor.MsBuildTask to $packageTargetVersion"
# need this line so nfbot flags the PR appropriately
$commitMessage += "`n[version update]`n`n"
diff --git a/nanoFramework.Tools.MetadataProcessor.sln b/nanoFramework.Tools.MetadataProcessor.sln
index 1ba555d..ec6bf1d 100644
--- a/nanoFramework.Tools.MetadataProcessor.sln
+++ b/nanoFramework.Tools.MetadataProcessor.sln
@@ -13,6 +13,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
version.json = version.json
EndProjectSection
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MetadataProcessor.MsBuildTask", "MetadataProcessor.MsBuildTask\MetadataProcessor.MsBuildTask.csproj", "{9B18784E-1BF2-47D1-BDD1-85B678F883F9}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -27,6 +29,10 @@ Global
{A9E02E14-7321-4B12-8AB5-9A0408ED8FD0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A9E02E14-7321-4B12-8AB5-9A0408ED8FD0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A9E02E14-7321-4B12-8AB5-9A0408ED8FD0}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9B18784E-1BF2-47D1-BDD1-85B678F883F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9B18784E-1BF2-47D1-BDD1-85B678F883F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9B18784E-1BF2-47D1-BDD1-85B678F883F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9B18784E-1BF2-47D1-BDD1-85B678F883F9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/version.json b/version.json
index d11075f..dbd463c 100644
--- a/version.json
+++ b/version.json
@@ -1,6 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
- "version": "2.31",
+ "version": "2.32",
"release": {
"branchName" : "release-v{version}",
"versionIncrement" : "build",