diff --git a/deployment/cake/apps-uwp-tasks.cake b/deployment/cake/apps-uwp-tasks.cake index f4814c34..cb91971f 100644 --- a/deployment/cake/apps-uwp-tasks.cake +++ b/deployment/cake/apps-uwp-tasks.cake @@ -1,12 +1,6 @@ -#pragma warning disable 1998 - #l "apps-uwp-variables.cake" -#addin "nuget:?package=MagicChunks&version=2.0.0.119" -#addin "nuget:?package=Newtonsoft.Json&version=11.0.2" -#addin "nuget:?package=Microsoft.Azure.KeyVault.Core&version=1.0.0" -#addin "nuget:?package=WindowsAzure.Storage&version=9.1.1" -#addin "nuget:?package=Cake.WindowsAppStore&version=1.4.0" +#addin "nuget:?package=Cake.WindowsAppStore&version=2.0.0" //------------------------------------------------------------- @@ -212,4 +206,4 @@ public class UwpProcessor : ProcessorBase { } -} \ No newline at end of file +} diff --git a/deployment/cake/apps-web-tasks.cake b/deployment/cake/apps-web-tasks.cake index 973061d6..fca37432 100644 --- a/deployment/cake/apps-web-tasks.cake +++ b/deployment/cake/apps-web-tasks.cake @@ -1,12 +1,8 @@ -#pragma warning disable 1998 - #l "apps-web-variables.cake" #l "lib-octopusdeploy.cake" -#addin "nuget:?package=MagicChunks&version=2.0.0.119" -#addin "nuget:?package=Newtonsoft.Json&version=11.0.2" -#addin "nuget:?package=Microsoft.Azure.KeyVault.Core&version=1.0.0" -#addin "nuget:?package=WindowsAzure.Storage&version=9.1.1" +#addin "nuget:?package=Microsoft.Azure.KeyVault.Core&version=3.0.5" +#addin "nuget:?package=WindowsAzure.Storage&version=9.3.3" //------------------------------------------------------------- diff --git a/deployment/cake/apps-wpf-tasks.cake b/deployment/cake/apps-wpf-tasks.cake index e5e3ee9a..d89897e4 100644 --- a/deployment/cake/apps-wpf-tasks.cake +++ b/deployment/cake/apps-wpf-tasks.cake @@ -1,9 +1,6 @@ -#pragma warning disable 1998 - #l "apps-wpf-variables.cake" -#addin "nuget:?package=MagicChunks&version=2.0.0.119" -#tool "nuget:?package=AzureStorageSync&version=2.0.0-alpha0028&prerelease" +#tool "nuget:?package=AzureStorageSync&version=2.0.0-alpha0039&prerelease" //------------------------------------------------------------- diff --git a/deployment/cake/buildserver.cake b/deployment/cake/buildserver.cake index 297ea377..6d6837b3 100644 --- a/deployment/cake/buildserver.cake +++ b/deployment/cake/buildserver.cake @@ -1,8 +1,6 @@ // Customize this file when using a different build server #l "buildserver-continuaci.cake" -#addin "nuget:?package=MagicChunks&version=2.0.0.119" - using System.Runtime.InteropServices; public interface IBuildServer diff --git a/deployment/cake/components-tasks.cake b/deployment/cake/components-tasks.cake index c006f9d7..50c7e593 100644 --- a/deployment/cake/components-tasks.cake +++ b/deployment/cake/components-tasks.cake @@ -1,7 +1,5 @@ #l "components-variables.cake" -#addin "nuget:?package=Cake.FileHelpers&version=3.0.0" - using System.Xml.Linq; //------------------------------------------------------------- @@ -141,24 +139,20 @@ public class ComponentsProcessor : ProcessorBase { var repositoryUrl = BuildContext.General.Repository.Url; var repositoryCommitId = BuildContext.General.Repository.CommitId; - if (!BuildContext.General.SourceLink.IsDisabled && - !BuildContext.General.IsLocalBuild && - !string.IsNullOrWhiteSpace(repositoryUrl)) - { - CakeContext.Information("Repository url is specified, enabling SourceLink to commit '{0}/commit/{1}'", - repositoryUrl, repositoryCommitId); - - // TODO: For now we are assuming everything is git, we might need to change that in the future - // See why we set the values at https://github.com/dotnet/sourcelink/issues/159#issuecomment-427639278 - msBuildSettings.WithProperty("EnableSourceLink", "true"); - msBuildSettings.WithProperty("EnableSourceControlManagerQueries", "false"); - msBuildSettings.WithProperty("PublishRepositoryUrl", "true"); - msBuildSettings.WithProperty("RepositoryType", "git"); - msBuildSettings.WithProperty("RepositoryUrl", repositoryUrl); - msBuildSettings.WithProperty("RevisionId", repositoryCommitId); - - InjectSourceLinkInProjectFile(BuildContext, projectFileName); - } + + CakeContext.Information("Repository url is specified, enabling SourceLink to commit '{0}/commit/{1}'", + repositoryUrl, repositoryCommitId); + + // TODO: For now we are assuming everything is git, we might need to change that in the future + // See why we set the values at https://github.com/dotnet/sourcelink/issues/159#issuecomment-427639278 + msBuildSettings.WithProperty("EnableSourceLink", "true"); + msBuildSettings.WithProperty("EnableSourceControlManagerQueries", "false"); + msBuildSettings.WithProperty("PublishRepositoryUrl", "true"); + msBuildSettings.WithProperty("RepositoryType", "git"); + msBuildSettings.WithProperty("RepositoryUrl", repositoryUrl); + msBuildSettings.WithProperty("RevisionId", repositoryCommitId); + + InjectSourceLinkInProjectFile(BuildContext, projectFileName); } RunMsBuild(BuildContext, component, projectFileName, msBuildSettings); diff --git a/deployment/cake/dependencies-tasks.cake b/deployment/cake/dependencies-tasks.cake index 8ff292a7..5b591f3a 100644 --- a/deployment/cake/dependencies-tasks.cake +++ b/deployment/cake/dependencies-tasks.cake @@ -1,7 +1,5 @@ #l "dependencies-variables.cake" -#addin "nuget:?package=Cake.FileHelpers&version=3.0.0" - using System.Xml.Linq; //------------------------------------------------------------- @@ -30,10 +28,11 @@ public class DependenciesProcessor : ProcessorBase // is required to prevent issues with foreach foreach (var dependency in BuildContext.Dependencies.Items.ToList()) { - if (!ShouldProcessProject(BuildContext, dependency)) - { - BuildContext.Dependencies.Items.Remove(dependency); - } + // Note: dependencies should always be built + // if (!ShouldProcessProject(BuildContext, dependency)) + // { + // BuildContext.Dependencies.Items.Remove(dependency); + // } } } @@ -104,24 +103,20 @@ public class DependenciesProcessor : ProcessorBase { var repositoryUrl = BuildContext.General.Repository.Url; var repositoryCommitId = BuildContext.General.Repository.CommitId; - if (!BuildContext.General.SourceLink.IsDisabled && - !BuildContext.General.IsLocalBuild && - !string.IsNullOrWhiteSpace(repositoryUrl)) - { - CakeContext.Information("Repository url is specified, enabling SourceLink to commit '{0}/commit/{1}'", - repositoryUrl, repositoryCommitId); - - // TODO: For now we are assuming everything is git, we might need to change that in the future - // See why we set the values at https://github.com/dotnet/sourcelink/issues/159#issuecomment-427639278 - msBuildSettings.WithProperty("EnableSourceLink", "true"); - msBuildSettings.WithProperty("EnableSourceControlManagerQueries", "false"); - msBuildSettings.WithProperty("PublishRepositoryUrl", "true"); - msBuildSettings.WithProperty("RepositoryType", "git"); - msBuildSettings.WithProperty("RepositoryUrl", repositoryUrl); - msBuildSettings.WithProperty("RevisionId", repositoryCommitId); - - InjectSourceLinkInProjectFile(BuildContext, projectFileName); - } + + CakeContext.Information("Repository url is specified, enabling SourceLink to commit '{0}/commit/{1}'", + repositoryUrl, repositoryCommitId); + + // TODO: For now we are assuming everything is git, we might need to change that in the future + // See why we set the values at https://github.com/dotnet/sourcelink/issues/159#issuecomment-427639278 + msBuildSettings.WithProperty("EnableSourceLink", "true"); + msBuildSettings.WithProperty("EnableSourceControlManagerQueries", "false"); + msBuildSettings.WithProperty("PublishRepositoryUrl", "true"); + msBuildSettings.WithProperty("RepositoryType", "git"); + msBuildSettings.WithProperty("RepositoryUrl", repositoryUrl); + msBuildSettings.WithProperty("RevisionId", repositoryCommitId); + + InjectSourceLinkInProjectFile(BuildContext, projectFileName); } RunMsBuild(BuildContext, dependency, projectFileName, msBuildSettings); diff --git a/deployment/cake/docker-tasks.cake b/deployment/cake/docker-tasks.cake index 97bdcd61..725d4acd 100644 --- a/deployment/cake/docker-tasks.cake +++ b/deployment/cake/docker-tasks.cake @@ -1,9 +1,6 @@ -#pragma warning disable 1998 - #l "docker-variables.cake" #l "lib-octopusdeploy.cake" -#addin "nuget:?package=Cake.FileHelpers&version=3.0.0" #addin "nuget:?package=Cake.Docker&version=0.11.1" //------------------------------------------------------------- diff --git a/deployment/cake/generic-tasks.cake b/deployment/cake/generic-tasks.cake index 64d92c82..a2a3fe0f 100644 --- a/deployment/cake/generic-tasks.cake +++ b/deployment/cake/generic-tasks.cake @@ -1,11 +1,9 @@ #l "generic-variables.cake" -#addin "nuget:?package=MagicChunks&version=2.0.0.119" -#addin "nuget:?package=Cake.FileHelpers&version=3.0.0" -#addin "nuget:?package=Cake.DependencyCheck&version=1.2.0" +//#addin "nuget:?package=Cake.DependencyCheck&version=1.2.0" -#tool "nuget:?package=DependencyCheck.Runner.Tool&version=3.2.1&include=./**/dependency-check.sh&include=./**/dependency-check.bat" -#tool "nuget:?package=JetBrains.ReSharper.CommandLineTools&version=2018.1.3" +//#tool "nuget:?package=DependencyCheck.Runner.Tool&version=3.2.1&include=./**/dependency-check.sh&include=./**/dependency-check.bat" +//#tool "nuget:?package=JetBrains.ReSharper.CommandLineTools&version=2018.1.3" //------------------------------------------------------------- @@ -125,13 +123,31 @@ Task("RestorePackages") return; } - var csharpProjects = GetFiles("./**/*.csproj"); + //var csharpProjects = GetFiles("./**/*.csproj"); // var cProjects = GetFiles("./**/*.vcxproj"); var solutions = GetFiles("./**/*.sln"); - + var csharpProjects = new List(); + + foreach (var project in buildContext.AllProjects) + { + if (ShouldProcessProject(buildContext, project)) + { + var projectFileName = GetProjectFileName(buildContext, project); + if (projectFileName.EndsWith(".csproj")) + { + Information("Adding '{0}' as C# specific project to restore", project); + + csharpProjects.Add(projectFileName); + + // Inject source link *before* package restore + InjectSourceLinkInProjectFile(buildContext, projectFileName); + } + } + } + var allFiles = new List(); - allFiles.AddRange(solutions); - //allFiles.AddRange(csharpProjects); + //allFiles.AddRange(solutions); + allFiles.AddRange(csharpProjects); // //allFiles.AddRange(cProjects); foreach (var file in allFiles) diff --git a/deployment/cake/generic-variables.cake b/deployment/cake/generic-variables.cake index a2fc4828..726602f0 100644 --- a/deployment/cake/generic-variables.cake +++ b/deployment/cake/generic-variables.cake @@ -1,6 +1,6 @@ #l "buildserver.cake" -#tool "nuget:?package=GitVersion.CommandLine&version=5.3.7" +#tool "nuget:?package=GitVersion.CommandLine&version=5.6.6" //------------------------------------------------------------- diff --git a/deployment/cake/github-pages-tasks.cake b/deployment/cake/github-pages-tasks.cake index de148337..aa1d023a 100644 --- a/deployment/cake/github-pages-tasks.cake +++ b/deployment/cake/github-pages-tasks.cake @@ -1,6 +1,6 @@ #l "github-pages-variables.cake" -#addin "nuget:?package=Cake.Git&version=0.19.0" +#addin "nuget:?package=Cake.Git&version=1.0.0" //------------------------------------------------------------- diff --git a/deployment/cake/issuetrackers-github.cake b/deployment/cake/issuetrackers-github.cake index 5917b29c..809d04a4 100644 --- a/deployment/cake/issuetrackers-github.cake +++ b/deployment/cake/issuetrackers-github.cake @@ -1,4 +1,4 @@ -#tool "nuget:?package=gitreleasemanager&version=0.8.0" +#tool "nuget:?package=gitreleasemanager&version=0.11.0" //------------------------------------------------------------- diff --git a/deployment/cake/issuetrackers-jira.cake b/deployment/cake/issuetrackers-jira.cake index 07a9f94e..d467d9ad 100644 --- a/deployment/cake/issuetrackers-jira.cake +++ b/deployment/cake/issuetrackers-jira.cake @@ -1,4 +1,4 @@ -#tool "nuget:?package=JiraCli&version=1.2.0-beta0002&prerelease" +#tool "nuget:?package=JiraCli&version=1.3.0-alpha0338&prerelease" //------------------------------------------------------------- diff --git a/deployment/cake/lib-generic.cake b/deployment/cake/lib-generic.cake index b2bf1ce1..f0d3c15f 100644 --- a/deployment/cake/lib-generic.cake +++ b/deployment/cake/lib-generic.cake @@ -516,22 +516,43 @@ private static bool ShouldProcessProject(BuildContext buildContext, string proje return true; } + if (ShouldBuildProject(buildContext, projectName)) + { + // Always build + return true; + } + // Experimental mode where we ignore projects that are not on the deploy list when not in CI mode, but // it can only work if they are not part of unit tests (but that should never happen) - if (buildContext.Tests.Items.Count == 0) - { + // if (buildContext.Tests.Items.Count == 0) + // { if (checkDeployment && !ShouldDeployProject(buildContext, projectName)) { buildContext.CakeContext.Warning("Project '{0}' should not be processed because this is not a CI build, does not contain tests and the project should not be deployed, removing from projects to process", projectName); return false; } - } + //} return true; } //------------------------------------------------------------- +private static bool ShouldBuildProject(BuildContext buildContext, string projectName) +{ + // Allow the build server to configure this via "Build[ProjectName]" + var slug = GetProjectSlug(projectName); + var keyToCheck = string.Format("Build{0}", slug); + + var shouldBuild = buildContext.BuildServer.GetVariableAsBool(keyToCheck, true); + + buildContext.CakeContext.Information($"Value for '{keyToCheck}': {shouldBuild}"); + + return shouldBuild; +} + +//------------------------------------------------------------- + private static bool ShouldDeployProject(BuildContext buildContext, string projectName) { // Allow the build server to configure this via "Deploy[ProjectName]" diff --git a/deployment/cake/lib-logging.cake b/deployment/cake/lib-logging.cake new file mode 100644 index 00000000..7b319a1c --- /dev/null +++ b/deployment/cake/lib-logging.cake @@ -0,0 +1,51 @@ +// Note: code originally comes from https://stackoverflow.com/questions/50826394/how-to-print-tool-command-line-in-cake + +/// +/// Temporary sets logging verbosity. +/// +/// +/// +/// // Temporary sets logging verbosity to Diagnostic. +/// using(context.UseVerbosity(Verbosity.Diagnostic)) +/// { +/// context.DotNetCoreBuild(project, settings); +/// } +/// +/// +public static VerbosityChanger UseVerbosity(this ICakeContext context, Verbosity newVerbosity) => + new VerbosityChanger(context.Log, newVerbosity); + + +/// +/// Temporary sets logging verbosity to Diagnostic. +/// +/// +/// +/// // Temporary sets logging verbosity to Diagnostic. +/// using(context.UseDiagnosticVerbosity()) +/// { +/// context.DotNetCoreBuild(project, settings); +/// } +/// +/// +public static VerbosityChanger UseDiagnosticVerbosity(this ICakeContext context) => + context.UseVerbosity(Verbosity.Diagnostic); + +/// +/// Cake log verbosity changer. +/// Restores old verbosity on Dispose. +/// +public class VerbosityChanger : IDisposable +{ + ICakeLog _log; + Verbosity _oldVerbosity; + + public VerbosityChanger(ICakeLog log, Verbosity newVerbosity) + { + _log = log; + _oldVerbosity = log.Verbosity; + _log.Verbosity = newVerbosity; + } + + public void Dispose() => _log.Verbosity = _oldVerbosity; +} \ No newline at end of file diff --git a/deployment/cake/lib-nuget.cake b/deployment/cake/lib-nuget.cake index 76103139..4b5c2b4f 100644 --- a/deployment/cake/lib-nuget.cake +++ b/deployment/cake/lib-nuget.cake @@ -50,15 +50,33 @@ public static List GetNuGetServers(string urls, string apiKeys) private static void RestoreNuGetPackages(BuildContext buildContext, Cake.Core.IO.FilePath solutionOrProjectFileName) { - buildContext.CakeContext.Information("Restoring packages for {0}", solutionOrProjectFileName); + buildContext.CakeContext.LogSeparator("Restoring packages for '{0}'", solutionOrProjectFileName); + + var sources = SplitSeparatedList(buildContext.General.NuGet.PackageSources, ';'); + var runtimeIdentifiers = new List(new [] + { + "win-x64", + "browser-wasm" + }); + + RestoreNuGetPackagesUsingNuGet(buildContext, solutionOrProjectFileName, sources); + RestoreNuGetPackagesUsingDotnetRestore(buildContext, solutionOrProjectFileName, sources, runtimeIdentifiers); +} + +//------------------------------------------------------------- + +private static void RestoreNuGetPackagesUsingNuGet(BuildContext buildContext, Cake.Core.IO.FilePath solutionOrProjectFileName, List sources) +{ + buildContext.CakeContext.LogSeparator("Restoring packages for '{0}' using 'NuGet'", solutionOrProjectFileName); try { var nuGetRestoreSettings = new NuGetRestoreSettings { + DisableParallelProcessing = false, + NoCache = false, }; - - var sources = SplitSeparatedList(buildContext.General.NuGet.PackageSources, ';'); + if (sources.Count > 0) { nuGetRestoreSettings.Source = sources; @@ -70,4 +88,76 @@ private static void RestoreNuGetPackages(BuildContext buildContext, Cake.Core.IO { // Ignore } +} + +//------------------------------------------------------------- + +private static void RestoreNuGetPackagesUsingDotnetRestore(BuildContext buildContext, Cake.Core.IO.FilePath solutionOrProjectFileName, List sources, List runtimeIdentifiers) +{ + buildContext.CakeContext.LogSeparator("Restoring packages for '{0}' using 'dotnet restore'", solutionOrProjectFileName); + + var projectFileContents = System.IO.File.ReadAllText(solutionOrProjectFileName.FullPath)?.ToLower(); + + var supportedRuntimeIdentifiers = new List(); + + foreach (var runtimeIdentifier in runtimeIdentifiers) + { + if (!string.IsNullOrWhiteSpace(runtimeIdentifier)) + { + if (!projectFileContents.Contains(runtimeIdentifier.ToLower())) + { + buildContext.CakeContext.Information("Project '{0}' does not support runtime identifier '{1}', skipping restore for this runtime identifier", solutionOrProjectFileName, runtimeIdentifier); + continue; + } + } + + supportedRuntimeIdentifiers.Add(runtimeIdentifier); + } + + if (supportedRuntimeIdentifiers.Count == 0) + { + // Default + supportedRuntimeIdentifiers.Add(string.Empty); + } + + foreach (var runtimeIdentifier in supportedRuntimeIdentifiers) + { + try + { + buildContext.CakeContext.LogSeparator("Restoring packages for '{0}' using 'dotnet restore' using runtime identifier '{1}'", solutionOrProjectFileName, runtimeIdentifier); + + var restoreSettings = new DotNetCoreRestoreSettings + { + DisableParallel = false, + Force = false, + ForceEvaluate = false, + IgnoreFailedSources = true, + NoCache = false, + NoDependencies = false, // use true to speed up things + Verbosity = DotNetCoreVerbosity.Normal + }; + + if (!string.IsNullOrWhiteSpace(runtimeIdentifier)) + { + // This is a explicit supported runtime identifier, force re-evaluation + restoreSettings.Force = true; + restoreSettings.ForceEvaluate = true; + restoreSettings.Runtime = runtimeIdentifier; + } + + if (sources.Count > 0) + { + restoreSettings.Sources = sources; + } + + using (buildContext.CakeContext.UseDiagnosticVerbosity()) + { + buildContext.CakeContext.DotNetCoreRestore(solutionOrProjectFileName.FullPath, restoreSettings); + } + } + catch (Exception) + { + // Ignore + } + } } \ No newline at end of file diff --git a/deployment/cake/lib-octopusdeploy.cake b/deployment/cake/lib-octopusdeploy.cake index f1c9d3ce..2c883c14 100644 --- a/deployment/cake/lib-octopusdeploy.cake +++ b/deployment/cake/lib-octopusdeploy.cake @@ -1,4 +1,4 @@ -#tool "nuget:?package=OctopusTools&version=6.8.1" +#tool "nuget:?package=OctopusTools&version=7.4.6" public class OctopusDeployIntegration : IntegrationBase { diff --git a/deployment/cake/lib-sourcelink.cake b/deployment/cake/lib-sourcelink.cake index c891b1ab..52142bcb 100644 --- a/deployment/cake/lib-sourcelink.cake +++ b/deployment/cake/lib-sourcelink.cake @@ -1,11 +1,32 @@ public static bool IsSourceLinkSupported(BuildContext buildContext, string projectFileName) { + if (buildContext.General.SourceLink.IsDisabled) + { + return false; + } + + if (buildContext.General.IsLocalBuild) + { + return false; + } + + if (string.IsNullOrWhiteSpace(buildContext.General.Repository.Url)) + { + return false; + } + // Only support C# projects if (!projectFileName.EndsWith(".csproj")) { return false; } + // Only support when running a real build, e.g. ot for 'Package' only + if (!buildContext.General.Target.ToLower().Contains("build")) + { + return false; + } + return true; } @@ -69,7 +90,4 @@ public static void InjectSourceLinkInProjectFile(BuildContext buildContext, stri projectElement.Add(sourceRootItemGroup); xmlDocument.Save(projectFileName); - - // Restore packages again for the dynamic package - RestoreNuGetPackages(buildContext, projectFileName); } \ No newline at end of file diff --git a/deployment/cake/notifications-msteams.cake b/deployment/cake/notifications-msteams.cake index 6a4514ec..9d514a70 100644 --- a/deployment/cake/notifications-msteams.cake +++ b/deployment/cake/notifications-msteams.cake @@ -1,4 +1,4 @@ -#addin "nuget:?package=Cake.MicrosoftTeams&version=0.9.0" +#addin "nuget:?package=Cake.MicrosoftTeams&version=1.0.0" //------------------------------------------------------------- diff --git a/deployment/cake/sourcecontrol-github.cake b/deployment/cake/sourcecontrol-github.cake index 2d60d5fd..b844c34e 100644 --- a/deployment/cake/sourcecontrol-github.cake +++ b/deployment/cake/sourcecontrol-github.cake @@ -1,5 +1,5 @@ #addin "nuget:?package=Cake.GitHub&version=0.1.0" -#addin "nuget:?package=Octokit&version=0.36.0" +#addin "nuget:?package=Octokit&version=0.48.0" //------------------------------------------------------------- diff --git a/deployment/cake/tasks.cake b/deployment/cake/tasks.cake index cc8218d4..9add3145 100644 --- a/deployment/cake/tasks.cake +++ b/deployment/cake/tasks.cake @@ -1,4 +1,7 @@ +#pragma warning disable CS1998 + #l "lib-generic.cake" +#l "lib-logging.cake" #l "lib-msbuild.cake" #l "lib-nuget.cake" #l "lib-signing.cake" @@ -20,9 +23,11 @@ #l "tests.cake" #l "templates-tasks.cake" -#addin "nuget:?package=System.Net.Http&version=4.3.3" -#addin "nuget:?package=Newtonsoft.Json&version=11.0.2" +#addin "nuget:?package=Cake.FileHelpers&version=3.3.0" #addin "nuget:?package=Cake.Sonar&version=1.1.25" +#addin "nuget:?package=MagicChunks&version=2.0.0.119" +#addin "nuget:?package=Newtonsoft.Json&version=12.0.3" +#addin "nuget:?package=System.Net.Http&version=4.3.4" // Note: the SonarQube tool must be installed as a global .NET tool: // `dotnet tool install --global dotnet-sonarscanner --ignore-failed-sources` @@ -75,7 +80,6 @@ public class BuildContext : BuildContextBase public Dictionary Parameters { get; set; } public Dictionary Variables { get; private set; } - // Integrations public BuildServerIntegration BuildServer { get; set; } public IssueTrackerIntegration IssueTracker { get; set; } @@ -137,12 +141,12 @@ Setup(setupContext => buildContext.Dependencies = InitializeDependenciesContext(buildContext, buildContext); buildContext.DockerImages = InitializeDockerImagesContext(buildContext, buildContext); buildContext.GitHubPages = InitializeGitHubPagesContext(buildContext, buildContext); + buildContext.Templates = InitializeTemplatesContext(buildContext, buildContext); buildContext.Tools = InitializeToolsContext(buildContext, buildContext); buildContext.Uwp = InitializeUwpContext(buildContext, buildContext); buildContext.VsExtensions = InitializeVsExtensionsContext(buildContext, buildContext); buildContext.Web = InitializeWebContext(buildContext, buildContext); buildContext.Wpf = InitializeWpfContext(buildContext, buildContext); - buildContext.Templates = InitializeTemplatesContext(buildContext, buildContext); // All projects, but dependencies first & tests last buildContext.AllProjects.AddRange(buildContext.Dependencies.Items); @@ -181,6 +185,13 @@ Setup(setupContext => buildContext.Processors.Add(new WebProcessor(buildContext)); buildContext.Processors.Add(new WpfProcessor(buildContext)); + setupContext.LogSeparator("Registering variables for templates"); + + // Preparing variables for templates + buildContext.Variables["GitVersion_MajorMinorPatch"] = buildContext.General.Version.MajorMinorPatch; + buildContext.Variables["GitVersion_FullSemVer"] = buildContext.General.Version.FullSemVer; + buildContext.Variables["GitVersion_NuGetVersion"] = buildContext.General.Version.NuGet; + setupContext.LogSeparator("Build context is ready, displaying state info"); buildContext.LogStateInfo(); @@ -220,10 +231,6 @@ Task("Initialize") { buildContext.BuildServer.SetVariable(variableToUpdate.Key, variableToUpdate.Value); } - - buildContext.Variables["GitVersion_MajorMinorPatch"] = buildContext.General.Version.MajorMinorPatch; - buildContext.Variables["GitVersion_FullSemVer"] = buildContext.General.Version.FullSemVer; - buildContext.Variables["GitVersion_NuGetVersion"] = buildContext.General.Version.NuGet; }); //------------------------------------------------------------- diff --git a/deployment/cake/templates-tasks.cake b/deployment/cake/templates-tasks.cake index 01dcbda6..baa39edf 100644 --- a/deployment/cake/templates-tasks.cake +++ b/deployment/cake/templates-tasks.cake @@ -14,28 +14,33 @@ public class TemplatesProcessor : ProcessorBase public TemplatesProcessor(BuildContext buildContext) : base(buildContext) { - } + var templatesRelativePath = "./deployment/templates"; - public override bool HasItems() - { - return BuildContext.Templates.Items.Count > 0; - } - - public override async Task PrepareAsync() - { - var templatesRelativePath = "deployment/templates"; if (CakeContext.DirectoryExists(templatesRelativePath)) { var currentDirectoryPath = System.IO.Directory.GetCurrentDirectory(); var templateAbsolutePath = System.IO.Path.Combine(currentDirectoryPath, templatesRelativePath); var files = System.IO.Directory.GetFiles(templateAbsolutePath, "*.*", System.IO.SearchOption.AllDirectories); + + CakeContext.Information($"Found '{files.Count()}' template files"); + foreach (var file in files) - { + { BuildContext.Templates.Items.Add(file.Substring(templateAbsolutePath.Length + 1)); } } } + public override bool HasItems() + { + return BuildContext.Templates.Items.Count > 0; + } + + public override async Task PrepareAsync() + { + + } + public override async Task UpdateInfoAsync() { if (!HasItems()) @@ -47,18 +52,26 @@ public class TemplatesProcessor : ProcessorBase foreach (var template in BuildContext.Templates.Items) { - CakeContext.Information("Updating file '{0}'", template); - - var templateFile = $"deployment/templates/{template}"; - var content = CakeContext.FileReadText(templateFile); - var variableNames = variableRegex.Matches(content).OfType().Select(m => m.Groups[1].Value).Distinct().ToList(); + CakeContext.Information($"Updating template file '{template}'"); - foreach (var variableName in variableNames) + var templateSourceFile = $"./deployment/templates/{template}"; + var content = CakeContext.FileReadText(templateSourceFile); + + var matches = variableRegex.Matches(content); + + foreach (var match in matches.Cast()) { - if(BuildContext.Variables.TryGetValue(variableName, out var replacement)) + var variableName = match.Groups[1].Value; + + CakeContext.Information($"Found usage of variable '{variableName}'"); + + if (!BuildContext.Variables.TryGetValue(variableName, out var replacement)) { - content = content.Replace($"${{{variableName}}}", replacement); + CakeContext.Error($"Could not find value for variable '{variableName}'"); + continue; } + + content = content.Replace($"${{{variableName}}}", replacement); } CakeContext.FileWriteText($"{template}", content); @@ -67,18 +80,14 @@ public class TemplatesProcessor : ProcessorBase public override async Task BuildAsync() { - if (!HasItems()) - { - return; - } + // Run templates every time + await UpdateInfoAsync(); } public override async Task PackageAsync() { - if (!HasItems()) - { - return; - } + // Run templates every time + await UpdateInfoAsync(); } public override async Task DeployAsync() diff --git a/deployment/cake/tests-nunit.cake b/deployment/cake/tests-nunit.cake index 6d1ce1cb..06fb12de 100644 --- a/deployment/cake/tests-nunit.cake +++ b/deployment/cake/tests-nunit.cake @@ -1,4 +1,4 @@ -#tool "nuget:?package=NUnit.ConsoleRunner&version=3.11.1" +#tool "nuget:?package=NUnit.ConsoleRunner&version=3.12.0" //------------------------------------------------------------- diff --git a/deployment/cake/tools-tasks.cake b/deployment/cake/tools-tasks.cake index 11341d86..351c3ca8 100644 --- a/deployment/cake/tools-tasks.cake +++ b/deployment/cake/tools-tasks.cake @@ -1,7 +1,5 @@ #l "tools-variables.cake" -#addin "nuget:?package=Cake.FileHelpers&version=3.0.0" - using System.Xml.Linq; //------------------------------------------------------------- @@ -398,11 +396,18 @@ SHA512 CHECKSUMS GENERATED BY BUILD TOOL: // nuget sign MyPackage.nupkg -CertificateSubjectName -Timestamper var filesToSign = CakeContext.GetFiles($"{BuildContext.General.OutputRootDirectory}/*.nupkg"); - var signToolCommand = string.Format("sign /a /t {0} /n {1}", BuildContext.General.CodeSign.TimeStampUri, - BuildContext.General.CodeSign.CertificateSubjectName); + foreach (var fileToSign in filesToSign) + { + CakeContext.Information($"Signing NuGet package '{fileToSign}' using certificate subject '{BuildContext.General.CodeSign.CertificateSubjectName}'"); - SignFiles(BuildContext, signToolCommand, filesToSign); - } + var exitCode = CakeContext.StartProcess(BuildContext.General.NuGet.Executable, new ProcessSettings + { + Arguments = $"sign \"{fileToSign}\" -CertificateSubjectName \"{BuildContext.General.CodeSign.CertificateSubjectName}\" -Timestamper \"{BuildContext.General.CodeSign.TimeStampUri}\"" + }); + + CakeContext.Information("Signing NuGet package exited with '{0}'", exitCode); + } + } } public override async Task DeployAsync() diff --git a/deployment/cake/vsextensions-tasks.cake b/deployment/cake/vsextensions-tasks.cake index a35f7116..980d01f3 100644 --- a/deployment/cake/vsextensions-tasks.cake +++ b/deployment/cake/vsextensions-tasks.cake @@ -1,7 +1,5 @@ #l "vsextensions-variables.cake" -#addin "nuget:?package=Cake.FileHelpers&version=3.0.0" - using System.Xml.Linq; //------------------------------------------------------------- diff --git a/scripts - Update NuGet.bat b/scripts - Update NuGet.bat deleted file mode 100644 index 9c2369b9..00000000 --- a/scripts - Update NuGet.bat +++ /dev/null @@ -1 +0,0 @@ -tools\nuget\nuget.exe update -self diff --git a/src/Catel.Fody.TestAssembly.Catel5/Catel.Fody.TestAssembly.Catel5.csproj b/src/Catel.Fody.TestAssembly.Catel5/Catel.Fody.TestAssembly.Catel5.csproj index 29c84e45..f57e13f3 100644 --- a/src/Catel.Fody.TestAssembly.Catel5/Catel.Fody.TestAssembly.Catel5.csproj +++ b/src/Catel.Fody.TestAssembly.Catel5/Catel.Fody.TestAssembly.Catel5.csproj @@ -1,6 +1,6 @@  - netcoreapp3.1 + net5.0-windows Catel.Fody.TestAssembly.Catel5 Catel.Fody.TestAssembly en-US @@ -15,6 +15,7 @@ + diff --git a/src/Catel.Fody.TestAssembly.Catel6/Catel.Fody.TestAssembly.Catel6.csproj b/src/Catel.Fody.TestAssembly.Catel6/Catel.Fody.TestAssembly.Catel6.csproj index 94d3f29a..b40ca912 100644 --- a/src/Catel.Fody.TestAssembly.Catel6/Catel.Fody.TestAssembly.Catel6.csproj +++ b/src/Catel.Fody.TestAssembly.Catel6/Catel.Fody.TestAssembly.Catel6.csproj @@ -1,6 +1,6 @@  - netcoreapp3.1 + net5.0-windows Catel.Fody.TestAssembly.Catel6 Catel.Fody.TestAssembly en-US @@ -15,6 +15,7 @@ + diff --git a/src/Catel.Fody.TestAssembly.NetStandard.Catel5/Catel.Fody.TestAssembly.NetStandard.Catel5.csproj b/src/Catel.Fody.TestAssembly.NetStandard.Catel5/Catel.Fody.TestAssembly.NetStandard.Catel5.csproj new file mode 100644 index 00000000..7abedba1 --- /dev/null +++ b/src/Catel.Fody.TestAssembly.NetStandard.Catel5/Catel.Fody.TestAssembly.NetStandard.Catel5.csproj @@ -0,0 +1,30 @@ + + + netstandard2.0 + Catel.Fody.TestAssembly.NetStandard.Catel5 + Catel.Fody.TestAssembly + en-US + Catel.Fody.TestAssembly.NetStandard + 1.0.0-alpha0001 + Catel.Fody.TestAssembly.NetStandard library. + + true + true + $(DefineConstants);CATEL_5 + + + + + + + + + + + + + + + + + diff --git a/src/Catel.Fody.TestAssembly.NetStandard.Catel6/Catel.Fody.TestAssembly.NetStandard.Catel6.csproj b/src/Catel.Fody.TestAssembly.NetStandard.Catel6/Catel.Fody.TestAssembly.NetStandard.Catel6.csproj new file mode 100644 index 00000000..ba2a406d --- /dev/null +++ b/src/Catel.Fody.TestAssembly.NetStandard.Catel6/Catel.Fody.TestAssembly.NetStandard.Catel6.csproj @@ -0,0 +1,30 @@ + + + netstandard2.0 + Catel.Fody.TestAssembly.NetStandard.Catel6 + Catel.Fody.TestAssembly + en-US + Catel.Fody.TestAssembly.NetStandard + 1.0.0-alpha0001 + Catel.Fody.TestAssembly.NetStandard library. + + true + true + $(DefineConstants);CATEL_6 + + + + + + + + + + + + + + + + + diff --git a/src/Catel.Fody.TestAssembly.NetStandard.Shared/FodyWeavers.xml b/src/Catel.Fody.TestAssembly.NetStandard.Shared/FodyWeavers.xml new file mode 100644 index 00000000..0d8b8223 --- /dev/null +++ b/src/Catel.Fody.TestAssembly.NetStandard.Shared/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/Catel.Fody.TestAssembly.NetStandard.Shared/NetStandardModel.cs b/src/Catel.Fody.TestAssembly.NetStandard.Shared/NetStandardModel.cs new file mode 100644 index 00000000..218c013f --- /dev/null +++ b/src/Catel.Fody.TestAssembly.NetStandard.Shared/NetStandardModel.cs @@ -0,0 +1,9 @@ +namespace Catel.Fody.TestAssembly +{ + using Data; + + public class NetStandardModel : ModelBase + { + public bool BoolProperty { get; set; } + } +} diff --git a/src/Catel.Fody.TestAssembly.NetStandard.Shared/app.config b/src/Catel.Fody.TestAssembly.NetStandard.Shared/app.config new file mode 100644 index 00000000..2ee3d43a --- /dev/null +++ b/src/Catel.Fody.TestAssembly.NetStandard.Shared/app.config @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/Catel.Fody.TestAssembly.Shared/Bugs/GH0295.cs b/src/Catel.Fody.TestAssembly.Shared/Bugs/GH0295.cs new file mode 100644 index 00000000..82640ee1 --- /dev/null +++ b/src/Catel.Fody.TestAssembly.Shared/Bugs/GH0295.cs @@ -0,0 +1,11 @@ +namespace Catel.Fody.TestAssembly.Bugs.GH0295 +{ + using System; + using System.Collections.Generic; + using System.Linq; + using Catel.Data; + + public class ModelReferencingNetStandard : NetStandardModel + { + } +} diff --git a/src/Catel.Fody.TestExternalTypesAssembly.Catel5/Catel.Fody.TestExternalTypesAssembly.Catel5.csproj b/src/Catel.Fody.TestExternalTypesAssembly.Catel5/Catel.Fody.TestExternalTypesAssembly.Catel5.csproj index dedd782f..f29b8db2 100644 --- a/src/Catel.Fody.TestExternalTypesAssembly.Catel5/Catel.Fody.TestExternalTypesAssembly.Catel5.csproj +++ b/src/Catel.Fody.TestExternalTypesAssembly.Catel5/Catel.Fody.TestExternalTypesAssembly.Catel5.csproj @@ -1,6 +1,6 @@  - netcoreapp3.1 + net5.0-windows Catel.Fody.TestExternalTypesAssembly.Catel5 Catel.Fody.TestExternalTypesAssembly en-US @@ -14,7 +14,7 @@ - + diff --git a/src/Catel.Fody.TestExternalTypesAssembly.Catel6/Catel.Fody.TestExternalTypesAssembly.Catel6.csproj b/src/Catel.Fody.TestExternalTypesAssembly.Catel6/Catel.Fody.TestExternalTypesAssembly.Catel6.csproj index e9d289ff..f0c5885e 100644 --- a/src/Catel.Fody.TestExternalTypesAssembly.Catel6/Catel.Fody.TestExternalTypesAssembly.Catel6.csproj +++ b/src/Catel.Fody.TestExternalTypesAssembly.Catel6/Catel.Fody.TestExternalTypesAssembly.Catel6.csproj @@ -1,6 +1,6 @@  - netcoreapp3.1 + net5.0-windows Catel.Fody.TestExternalTypesAssembly.Catel6 Catel.Fody.TestExternalTypesAssembly en-US @@ -9,12 +9,12 @@ Catel.Fody.TestExternalTypesAssembly library. true - true - $(DefineConstants);CATEL_6 + true + $(DefineConstants);CATEL_6 - + @@ -24,7 +24,7 @@ - + diff --git a/src/Catel.Fody.Tests.Catel5/Catel.Fody.Tests.Catel5.csproj b/src/Catel.Fody.Tests.Catel5/Catel.Fody.Tests.Catel5.csproj index 21e2922f..d7d42c62 100644 --- a/src/Catel.Fody.Tests.Catel5/Catel.Fody.Tests.Catel5.csproj +++ b/src/Catel.Fody.Tests.Catel5/Catel.Fody.Tests.Catel5.csproj @@ -1,6 +1,6 @@  - netcoreapp3.1 + net5.0-windows Catel.Fody.Tests.Catel5 Catel.Fody.Tests en-US @@ -17,8 +17,8 @@ - - + + diff --git a/src/Catel.Fody.Tests.Catel6/Catel.Fody.Tests.Catel6.csproj b/src/Catel.Fody.Tests.Catel6/Catel.Fody.Tests.Catel6.csproj index 8490fa5f..dff36e42 100644 --- a/src/Catel.Fody.Tests.Catel6/Catel.Fody.Tests.Catel6.csproj +++ b/src/Catel.Fody.Tests.Catel6/Catel.Fody.Tests.Catel6.csproj @@ -1,6 +1,6 @@  - netcoreapp3.1 + net5.0-windows Catel.Fody.Tests.Catel6 Catel.Fody.Tests en-US @@ -17,8 +17,8 @@ - - + + diff --git a/src/Catel.Fody.Tests.Shared/AssemblyWeaver.cs b/src/Catel.Fody.Tests.Shared/AssemblyWeaver.cs index 318b783b..4173887c 100644 --- a/src/Catel.Fody.Tests.Shared/AssemblyWeaver.cs +++ b/src/Catel.Fody.Tests.Shared/AssemblyWeaver.cs @@ -11,9 +11,7 @@ using System.Reflection; using System.Xml.Linq; using Catel.Fody; -using Catel.Fody.TestAssembly; using Catel.Fody.Tests; -using Catel.Reflection; using Fody; using Mono.Cecil; @@ -30,22 +28,31 @@ public class AssemblyWeaver #region Constructors static AssemblyWeaver() { - Instance = new AssemblyWeaver(); + var catelVersion = "unknown"; + +#if CATEL_5 + catelVersion = "5"; +#elif CATEL_6 + catelVersion = "6"; +#endif + + Instance_NetStandard = new AssemblyWeaver($"Catel.Fody.TestAssembly.NetStandard.Catel{catelVersion}.dll"); + Instance = new AssemblyWeaver($"Catel.Fody.TestAssembly.Catel{catelVersion}.dll"); } - public AssemblyWeaver(List referenceAssemblyPaths = null) + public AssemblyWeaver(string assemblyLocation, List referenceAssemblyPaths = null) { if (referenceAssemblyPaths is null) { referenceAssemblyPaths = new List(); } - //Force ref since MSTest is a POS - var type = typeof(ViewModelBaseTest); + ////Force ref since MSTest is a POS + //var type = typeof(ViewModelBaseTest); - BeforeAssemblyPath = type.GetAssemblyEx().Location; - //BeforeAssemblyPath = Path.GetFullPath("Catel.Fody.TestAssembly.dll"); - AfterAssemblyPath = BeforeAssemblyPath.Replace(".dll", "2.dll"); + //BeforeAssemblyPath = type.GetAssemblyEx().Location; + BeforeAssemblyPath = Path.GetFullPath(assemblyLocation); + AfterAssemblyPath = BeforeAssemblyPath.Replace(".dll", "_2.dll"); var oldPdb = Path.ChangeExtension(BeforeAssemblyPath, "pdb"); var newPdb = Path.ChangeExtension(AfterAssemblyPath, "pdb"); @@ -88,19 +95,19 @@ public AssemblyWeaver(List referenceAssemblyPaths = null) moduleDefinition.Write(AfterAssemblyPath); } -// if (Debugger.IsAttached) -// { -//#if DEBUG -// var output = "debug"; -//#else -// var output = "release"; -//#endif + // if (Debugger.IsAttached) + // { + //#if DEBUG + // var output = "debug"; + //#else + // var output = "release"; + //#endif -// var targetFile = $@"C:\Source\Catel.Fody\output\{output}\Catel.Fody.Tests\Catel.Fody.TestAssembly2.dll"; -// var targetDirectory = Path.GetDirectoryName(targetFile); -// Directory.CreateDirectory(targetDirectory); -// File.Copy(AfterAssemblyPath, targetFile, true); -// } + // var targetFile = $@"C:\Source\Catel.Fody\output\{output}\Catel.Fody.Tests\Catel.Fody.TestAssembly2.dll"; + // var targetDirectory = Path.GetDirectoryName(targetFile); + // Directory.CreateDirectory(targetDirectory); + // File.Copy(AfterAssemblyPath, targetFile, true); + // } Assembly = Assembly.LoadFile(AfterAssemblyPath); } @@ -108,6 +115,8 @@ public AssemblyWeaver(List referenceAssemblyPaths = null) public static AssemblyWeaver Instance { get; private set; } + public static AssemblyWeaver Instance_NetStandard { get; private set; } + #region Methods private void LogError(string error) { diff --git a/src/Catel.Fody.Tests.Shared/Repros/GH0295.cs b/src/Catel.Fody.Tests.Shared/Repros/GH0295.cs new file mode 100644 index 00000000..3806a28d --- /dev/null +++ b/src/Catel.Fody.Tests.Shared/Repros/GH0295.cs @@ -0,0 +1,23 @@ +namespace Catel.Fody.Tests.Repros +{ + using System; + using NUnit.Framework; + + [TestFixture] + public class GH0295TestFixture + { + [TestCase] + public void NetStandardWeaving() + { + var type = AssemblyWeaver.Instance.Assembly.GetType("Catel.Fody.TestAssembly.Bugs.GH0295.ModelReferencingNetStandard"); + var instance = Activator.CreateInstance(type) as dynamic; + + Assert.IsNotNull(instance); + + var netStandardType = AssemblyWeaver.Instance_NetStandard.Assembly.GetType("Catel.Fody.TestAssembly.NetStandardModel"); + var netStandardInstance = Activator.CreateInstance(netStandardType) as dynamic; + + Assert.IsNotNull(netStandardInstance); + } + } +} diff --git a/src/Catel.Fody.sln b/src/Catel.Fody.sln index 3e229df3..8d2c9ea2 100644 --- a/src/Catel.Fody.sln +++ b/src/Catel.Fody.sln @@ -44,6 +44,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Catel.Fody.TestExternalType EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Catel.Fody.TestAssembly.Catel6", "Catel.Fody.TestAssembly.Catel6\Catel.Fody.TestAssembly.Catel6.csproj", "{ADBE4D28-6090-44D9-AEBC-62E404FDFE56}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Catel.Fody.TestAssembly.NetStandard.Catel5", "Catel.Fody.TestAssembly.NetStandard.Catel5\Catel.Fody.TestAssembly.NetStandard.Catel5.csproj", "{BEA9E01A-9C36-43A6-BB89-ED85A191ADD0}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Catel.Fody.TestAssembly.NetStandard.Catel6", "Catel.Fody.TestAssembly.NetStandard.Catel6\Catel.Fody.TestAssembly.NetStandard.Catel6.csproj", "{96E63FEE-DCE2-48D5-8D0D-6B25AA3E35A5}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -99,6 +103,18 @@ Global {ADBE4D28-6090-44D9-AEBC-62E404FDFE56}.Release|Any CPU.Build.0 = Release|Any CPU {ADBE4D28-6090-44D9-AEBC-62E404FDFE56}.Test|Any CPU.ActiveCfg = Release|Any CPU {ADBE4D28-6090-44D9-AEBC-62E404FDFE56}.Test|Any CPU.Build.0 = Release|Any CPU + {BEA9E01A-9C36-43A6-BB89-ED85A191ADD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BEA9E01A-9C36-43A6-BB89-ED85A191ADD0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BEA9E01A-9C36-43A6-BB89-ED85A191ADD0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BEA9E01A-9C36-43A6-BB89-ED85A191ADD0}.Release|Any CPU.Build.0 = Release|Any CPU + {BEA9E01A-9C36-43A6-BB89-ED85A191ADD0}.Test|Any CPU.ActiveCfg = Debug|Any CPU + {BEA9E01A-9C36-43A6-BB89-ED85A191ADD0}.Test|Any CPU.Build.0 = Debug|Any CPU + {96E63FEE-DCE2-48D5-8D0D-6B25AA3E35A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {96E63FEE-DCE2-48D5-8D0D-6B25AA3E35A5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {96E63FEE-DCE2-48D5-8D0D-6B25AA3E35A5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {96E63FEE-DCE2-48D5-8D0D-6B25AA3E35A5}.Release|Any CPU.Build.0 = Release|Any CPU + {96E63FEE-DCE2-48D5-8D0D-6B25AA3E35A5}.Test|Any CPU.ActiveCfg = Debug|Any CPU + {96E63FEE-DCE2-48D5-8D0D-6B25AA3E35A5}.Test|Any CPU.Build.0 = Debug|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -116,6 +132,8 @@ Global {C17937EF-234C-4C73-9EDD-1698591E17E1} = {945DAB30-25E0-4A99-834A-AA32D81E6FCE} {2046F93A-E20A-4CC9-8721-00EC27C01915} = {CCF3EB63-3689-4699-BF21-04C28B53DF62} {ADBE4D28-6090-44D9-AEBC-62E404FDFE56} = {CCF3EB63-3689-4699-BF21-04C28B53DF62} + {BEA9E01A-9C36-43A6-BB89-ED85A191ADD0} = {945DAB30-25E0-4A99-834A-AA32D81E6FCE} + {96E63FEE-DCE2-48D5-8D0D-6B25AA3E35A5} = {CCF3EB63-3689-4699-BF21-04C28B53DF62} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {B8FBD666-DAD3-4467-90B2-A3D54DA5FE4D} diff --git a/src/Catel.Fody/Extensions/CecilExtensions.assembly.cs b/src/Catel.Fody/Extensions/CecilExtensions.assembly.cs index 858e923e..c41ba675 100644 --- a/src/Catel.Fody/Extensions/CecilExtensions.assembly.cs +++ b/src/Catel.Fody/Extensions/CecilExtensions.assembly.cs @@ -38,8 +38,12 @@ public static Version GetVersion(this AssemblyDefinition assemblyDefinition) public static bool IsNetCoreLibrary(this AssemblyDefinition assemblyDefinition) { - var mainModule = assemblyDefinition.MainModule; + if (IsNetStandardLibrary(assemblyDefinition)) + { + return false; + } + var mainModule = assemblyDefinition.MainModule; if (mainModule.Types.Count == 1) { return true; diff --git a/src/global.json b/src/global.json index b09416c4..4bd12a9c 100644 --- a/src/global.json +++ b/src/global.json @@ -1,5 +1,10 @@ { "msbuild-sdks": { - "MSBuild.Sdk.Extras": "2.1.2" + "MSBuild.Sdk.Extras": "3.0.23" + }, + "sdk": { + "version": "5.0.0", + "rollForward": "latestMinor", + "allowPrerelease": false } } \ No newline at end of file diff --git a/tools/nuget.exe b/tools/nuget.exe index ad35fa4b..ea492dbc 100644 Binary files a/tools/nuget.exe and b/tools/nuget.exe differ diff --git a/tools/packages.config b/tools/packages.config index 2e4bb760..194a7e12 100644 --- a/tools/packages.config +++ b/tools/packages.config @@ -1,5 +1,5 @@ - - + +