diff --git a/CodeGen/Generators/NanoFrameworkGen/NuspecGenerator.cs b/CodeGen/Generators/NanoFrameworkGen/NuspecGenerator.cs index ad5f6fd3bb..853f219787 100644 --- a/CodeGen/Generators/NanoFrameworkGen/NuspecGenerator.cs +++ b/CodeGen/Generators/NanoFrameworkGen/NuspecGenerator.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Text; using CodeGen.JsonTypes; @@ -8,11 +8,16 @@ namespace CodeGen.Generators.NanoFrameworkGen class NuspecGenerator : GeneratorBase { private readonly Quantity _quantity; + private readonly string _mscorlibNuGetVersion; private readonly string _mathNuGetVersion; - public NuspecGenerator(Quantity quantity, string mathNuGetVersion) + public NuspecGenerator( + Quantity quantity, + string mscorlibNuGetVersion, + string mathNuGetVersion) { _quantity = quantity ?? throw new ArgumentNullException(nameof(quantity)); + _mscorlibNuGetVersion = mscorlibNuGetVersion; _mathNuGetVersion = mathNuGetVersion; } @@ -37,7 +42,7 @@ public override string Generate() en-US nanoframework unit units measurement si metric imperial abbreviation abbreviations convert conversion parse c# .net immutable uwp uap winrt win10 windows runtime component {_quantity.Name.ToLower()} - "); + "); if(NanoFrameworkGenerator.ProjectsRequiringMath.Contains(_quantity.Name)) { diff --git a/CodeGen/Generators/NanoFrameworkGenerator.cs b/CodeGen/Generators/NanoFrameworkGenerator.cs index 54f97afe4c..013376c2c5 100644 --- a/CodeGen/Generators/NanoFrameworkGenerator.cs +++ b/CodeGen/Generators/NanoFrameworkGenerator.cs @@ -115,7 +115,13 @@ public static void Generate(string rootDir, Quantity[] quantities) var sb = new StringBuilder($"{quantity.Name}:".PadRight(AlignPad)); GeneratePackageConfig(projectPath, quantity.Name); - GenerateNuspec(projectPath, quantity, MathNuGetVersion); + + GenerateNuspec( + projectPath, + quantity, + MscorlibNuGetVersion, + MathNuGetVersion); + GenerateUnitType(sb, quantity, Path.Combine(outputUnits, $"{quantity.Name}Unit.g.cs")); GenerateQuantity(sb, quantity, Path.Combine(outputQuantitites, $"{quantity.Name}.g.cs")); GenerateProject(sb, quantity, projectPath); @@ -151,11 +157,19 @@ private static void GeneratePackageConfig(string projectPath, string quantityNam var content = GeneratePackageConfigFile(quantityName); File.WriteAllText(filePath, content, Encoding.UTF8); } - private static void GenerateNuspec(string projectPath, Quantity quantity, string mathNuGetVersion) + private static void GenerateNuspec( + string projectPath, + Quantity quantity, + string mscorlibNuGetVersion, + string mathNuGetVersion) { string filePath = Path.Combine(projectPath, $"UnitsNet.NanoFramework.{quantity.Name}.nuspec"); - var content = new NuspecGenerator(quantity, mathNuGetVersion).Generate(); + var content = new NuspecGenerator( + quantity, + mscorlibNuGetVersion, + mathNuGetVersion).Generate(); + File.WriteAllText(filePath, content, Encoding.UTF8); }