From 6d7cd9e1dd74524751014d02a3242f577659d4fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Sim=C3=B5es?= Date: Fri, 21 May 2021 10:48:03 +0100 Subject: [PATCH] NBGV is now added only to regular projects --- .../BindingTemplateProject.nfproj | 8 +---- .../BindingTemplateProject/packages.config | 1 - .../Program.cs | 36 +++++++++++++++++-- 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/src/nanoFramework.IoT.Device.CodeConverter/BindingTemplateProject/BindingTemplateProject.nfproj b/src/nanoFramework.IoT.Device.CodeConverter/BindingTemplateProject/BindingTemplateProject.nfproj index 35769b09e..d3ec0c9c3 100644 --- a/src/nanoFramework.IoT.Device.CodeConverter/BindingTemplateProject/BindingTemplateProject.nfproj +++ b/src/nanoFramework.IoT.Device.CodeConverter/BindingTemplateProject/BindingTemplateProject.nfproj @@ -42,11 +42,5 @@ - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}. - - - + \ No newline at end of file diff --git a/src/nanoFramework.IoT.Device.CodeConverter/BindingTemplateProject/packages.config b/src/nanoFramework.IoT.Device.CodeConverter/BindingTemplateProject/packages.config index c8f022773..6198fb4f9 100644 --- a/src/nanoFramework.IoT.Device.CodeConverter/BindingTemplateProject/packages.config +++ b/src/nanoFramework.IoT.Device.CodeConverter/BindingTemplateProject/packages.config @@ -1,6 +1,5 @@  - \ No newline at end of file diff --git a/src/nanoFramework.IoT.Device.CodeConverter/Program.cs b/src/nanoFramework.IoT.Device.CodeConverter/Program.cs index 9b8ea7774..83cdd9b34 100644 --- a/src/nanoFramework.IoT.Device.CodeConverter/Program.cs +++ b/src/nanoFramework.IoT.Device.CodeConverter/Program.cs @@ -117,10 +117,22 @@ namespace nanoFramework.IoT.Device.CodeConverter // PROJECT FILE string[] oldProjectReferences; string projectGuid; - CreateProjectFile(projectType, projectName, targetDirectoryInfo, nfNugetPackages, searches, out oldProjectReferences, out projectGuid); + CreateProjectFile( + projectType, + projectName, + targetDirectoryInfo, + nfNugetPackages, + searches, + out oldProjectReferences, + out projectGuid); // PACKAGES - CreatePackagesConfig(targetDirectoryInfo, nfNugetPackages, searches, oldProjectReferences); + CreatePackagesConfig( + projectType, + targetDirectoryInfo, + nfNugetPackages, + searches, + oldProjectReferences); // SOLUTION File if (projectType == ProjectType.Regular) @@ -271,6 +283,19 @@ namespace nanoFramework.IoT.Device.CodeConverter projectReplacements.Add(_outputTypeReplacementToken, "Library"); } + if(projectType == ProjectType.Regular) + { + projectReplacements.Add("", + @" + + + This project references NuGet package(s) that are missing on this computer.Enable NuGet Package Restore to download them.For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}. + + + "); + + } + targetProjectFile.EditFile(projectReplacements); if (projectType != ProjectType.UnitTest) @@ -287,9 +312,11 @@ namespace nanoFramework.IoT.Device.CodeConverter assemblyInfoFile.EditFile(assemblyInfoReplacements); } + } private static void CreatePackagesConfig( + ProjectType projectType, DirectoryInfo targetDirectoryInfo, NugetPackages[] nfNugetPackages, Dictionary searches, @@ -306,6 +333,11 @@ namespace nanoFramework.IoT.Device.CodeConverter .Distinct() .Select(x => x.PackageConfigReferenceString); + if(projectType == ProjectType.Regular) + { + packageReferences = packageReferences.Append(@" "); + } + if (packageReferences.Any()) { var packageReferencesString = packageReferences.Distinct()