Skip to content

Commit

Permalink
refactor: set target to net462, net6 and net8
Browse files Browse the repository at this point in the history
  • Loading branch information
punker76 committed Dec 5, 2024
1 parent 2e203bc commit 1ac2daa
Show file tree
Hide file tree
Showing 17 changed files with 125 additions and 80 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"cake.tool": {
"version": "3.1.0",
"version": "4.0.0",
"commands": [
"dotnet-cake"
]
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
5.x
6.x
8.x
9.x
- name: List dotnet sdks
run: dotnet --list-sdks
run: dotnet --info
- name: Run the Cake script
uses: cake-build/cake-action@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion GitVersion.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
assembly-versioning-scheme: Major
assembly-file-versioning-scheme: MajorMinorPatchTag
next-version: 3.2.0
next-version: 4.0.0
mode: ContinuousDeployment
branches:
master:
Expand Down
5 changes: 5 additions & 0 deletions NuGet.Config
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</activePackageSource>
<packageSourceMapping>
<packageSource key="nuget.org">
<package pattern="*" />
</packageSource>
</packageSourceMapping>
</configuration>
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
An easy to use drag'n'drop framework for WPF.
</p>
<p>
Supporting .NET Framework 4.6.2+, .NET Core 3.1, .NET 5 and .NET 6 (on Windows)
Supporting .NET Framework 4.6.2 and later, .NET 6 and later (on Windows)
</p>

<a href="https://gitter.im/punker76/gong-wpf-dragdrop">
Expand Down
22 changes: 8 additions & 14 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ branches:
- main

environment:
# bad, but without this, gitversion doesn't work anymore
IGNORE_NORMALISATION_GIT_HEAD_MOVE: 1
azure-key-vault-url:
secure: 1mKS/HfCVq+iYNRVSrrN8NEowOkKt3knrpMzw+SOy3g=
azure-key-vault-client-id:
Expand All @@ -17,28 +19,20 @@ environment:
azure-key-vault-certificate:
secure: BSPdW2TgnQtoQXXbeDECug==

skip_tags: true
image: Visual Studio 2022
test: off

install:
# Appveyor uses git checkout -qf FETCH_HEAD but all GitVersion versions above 5.6.3 doesn't support this detached header
# This is a workaround for this issue
- ps: |
if ($env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT -ne "")
{
git checkout -qf $($env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT)
}
test: false

# install:
# - ps: Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile 'dotnet-install.ps1'
# - ps: ./dotnet-install.ps1 -Version 6.0.100 -InstallDir "C:\Program Files\dotnet"
# - ps: ./dotnet-install.ps1 -Version 8.0.403 -InstallDir "C:\Program Files\dotnet"

pull_requests:
do_not_increment_build_number: false

build_script:
- ps: dotnet --list-sdks
- ps: dotnet --info
- ps: gitversion /version
- ps: .\build.ps1 --target=ci #--verbosity=diagnostic
- ps: .\build.ps1 --target=ci --verbosity=diagnostic

artifacts:
- path: \Publish\*.*
Expand Down
37 changes: 19 additions & 18 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
///////////////////////////////////////////////////////////////////////////////

#tool dotnet:?package=NuGetKeyVaultSignTool&version=3.2.3
#tool dotnet:?package=AzureSignTool&version=4.0.1
#tool dotnet:?package=GitReleaseManager.Tool&version=0.15.0
#tool dotnet:?package=AzureSignTool&version=6.0.0
#tool dotnet:?package=GitReleaseManager.Tool&version=0.17.0
#tool dotnet:?package=XamlStyler.Console&version=3.2206.4

#tool nuget:?package=GitVersion.CommandLine&version=5.12.0

#addin nuget:?package=Cake.Figlet&version=2.0.1

///////////////////////////////////////////////////////////////////////////////
// ARGUMENTS
///////////////////////////////////////////////////////////////////////////////
Expand All @@ -37,8 +35,8 @@ public class BuildData
public DotNetVerbosity DotNetVerbosity { get; }
public bool IsLocalBuild { get; set; }
public bool IsPullRequest { get; set; }
public bool IsDevelopBranch { get; set; }
public bool IsReleaseBranch { get; set; }
public bool IsPrerelease { get; set; }
public bool IsRunningOnCI { get; set; }
public GitVersion GitVersion { get; set; }

public BuildData(
Expand All @@ -55,9 +53,7 @@ public class BuildData
public void SetGitVersion(GitVersion gitVersion)
{
GitVersion = gitVersion;

IsDevelopBranch = StringComparer.OrdinalIgnoreCase.Equals("develop", GitVersion.BranchName);
IsReleaseBranch = StringComparer.OrdinalIgnoreCase.Equals("main", GitVersion.BranchName);
IsPrerelease = GitVersion.NuGetVersion.Contains("-");
}
}

Expand All @@ -72,10 +68,9 @@ Setup<BuildData>(ctx =>
throw new NotImplementedException($"{repoName} will only build on Windows because it's not possible to target WPF and Windows Forms from UNIX.");
}

Information(Figlet(repoName));
Spectre.Console.AnsiConsole.Write(new Spectre.Console.FigletText(repoName));

var gitVersionPath = Context.Tools.Resolve("gitversion.exe");

Information("GitVersion : {0}", gitVersionPath);

var buildData = new BuildData(
Expand All @@ -85,6 +80,7 @@ Setup<BuildData>(ctx =>
)
{
IsLocalBuild = BuildSystem.IsLocalBuild,
IsRunningOnCI = BuildSystem.GitHubActions.IsRunningOnGitHubActions || BuildSystem.AppVeyor.IsRunningOnAppVeyor,
IsPullRequest =
(BuildSystem.GitHubActions.IsRunningOnGitHubActions && BuildSystem.GitHubActions.Environment.PullRequest.IsPullRequest)
|| (BuildSystem.AppVeyor.IsRunningOnAppVeyor && BuildSystem.AppVeyor.Environment.PullRequest.IsPullRequest)
Expand All @@ -97,15 +93,19 @@ Setup<BuildData>(ctx =>
}
buildData.SetGitVersion(GitVersion(new GitVersionSettings { ToolPath = gitVersionPath, OutputType = GitVersionOutput.Json }));

Information("GitVersion : {0}", gitVersionPath);
Information("Branch : {0}", buildData.GitVersion.BranchName);
Information("Configuration : {0}", buildData.Configuration);
Information("IsLocalBuild : {0}", buildData.IsLocalBuild);
Information("IsRunningOnCI : {0}", buildData.IsRunningOnCI);
Information("IsPrerelease : {0}", buildData.IsPrerelease);
Information("IsPrerelease : {0}", buildData.IsPrerelease);
Information("Informational Version: {0}", buildData.GitVersion.InformationalVersion);
Information("SemVer Version: {0}", buildData.GitVersion.SemVer);
Information("AssemblySemVer Version: {0}", buildData.GitVersion.AssemblySemVer);
Information("MajorMinorPatch Version: {0}", buildData.GitVersion.MajorMinorPatch);
Information("NuGet Version: {0}", buildData.GitVersion.NuGetVersion);
Information("Verbosity : {0}", buildData.Verbosity);
Information("Publish folder : {0}", publishDir);

return buildData;
});
Expand Down Expand Up @@ -141,11 +141,11 @@ Task("Build")
var msbuildSettings = new DotNetMSBuildSettings
{
MaxCpuCount = 0,
Version = data.IsReleaseBranch ? data.GitVersion.MajorMinorPatch : data.GitVersion.NuGetVersion,
Version = data.GitVersion.NuGetVersion,
AssemblyVersion = data.GitVersion.AssemblySemVer,
FileVersion = data.GitVersion.AssemblySemFileVer,
InformationalVersion = data.GitVersion.InformationalVersion,
ContinuousIntegrationBuild = data.IsReleaseBranch,
ContinuousIntegrationBuild = data.IsRunningOnCI,
ArgumentCustomization = args => args.Append("/m").Append("/nr:false") // The /nr switch tells msbuild to quite once it's done
};
// msbuildSettings.FileLoggers.Add(
Expand Down Expand Up @@ -177,10 +177,11 @@ Task("Pack")
var msbuildSettings = new DotNetMSBuildSettings
{
MaxCpuCount = 0,
Version = data.IsReleaseBranch ? data.GitVersion.MajorMinorPatch : data.GitVersion.NuGetVersion,
Version = data.GitVersion.NuGetVersion,
AssemblyVersion = data.GitVersion.AssemblySemVer,
FileVersion = data.GitVersion.AssemblySemFileVer,
InformationalVersion = data.GitVersion.InformationalVersion
InformationalVersion = data.GitVersion.InformationalVersion,
ContinuousIntegrationBuild = data.IsRunningOnCI
}
.WithProperty("IncludeBuildOutput", "true")
.WithProperty("RepositoryBranch", data.GitVersion.BranchName)
Expand Down Expand Up @@ -211,7 +212,7 @@ Task("Pack")
Task("Sign")
.WithCriteria<BuildData>((context, data) => !data.IsPullRequest)
.ContinueOnError()
.Does(() =>
.Does<BuildData>(data =>
{
var files = GetFiles("./src/GongSolutions.WPF.DragDrop/bin/**/*/GongSolutions.WPF.DragDrop.dll");
SignFiles(files, "GongSolutions.WPF.DragDrop, an easy to use drag'n'drop framework for WPF applications.");
Expand Down Expand Up @@ -312,7 +313,7 @@ Task("CreateRelease")
GitReleaseManagerCreate(token, "punker76", repoName, new GitReleaseManagerCreateSettings {
Milestone = data.GitVersion.MajorMinorPatch,
Name = data.GitVersion.AssemblySemFileVer,
Prerelease = data.IsDevelopBranch,
Prerelease = data.IsPrerelease,
TargetCommitish = data.GitVersion.BranchName,
WorkingDirectory = "."
});
Expand Down
1 change: 1 addition & 0 deletions cake.config
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ Modules=./tools/Modules
[Settings]
SkipVerification=false
SkipPackageVersionCheck=true
ShowProcessCommandLine=true
7 changes: 7 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"sdk": {
"version": "9.0.100",
"rollForward": "latestFeature",
"allowPrerelease": false
}
}
2 changes: 1 addition & 1 deletion src/Directory.build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<!-- Project properties -->
<PropertyGroup>
<TargetFrameworks>net462;net47;net48;net5.0-windows;net6.0-windows</TargetFrameworks>
<TargetFrameworks>net8.0-windows;net6.0-windows;net462</TargetFrameworks>
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<AutoGenerateBindingRedirects Condition="$(DefineConstants.Contains(NETCOREAPP)) == false">true</AutoGenerateBindingRedirects>
Expand Down
13 changes: 5 additions & 8 deletions src/Directory.build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,16 @@
<Description>An easy to use drag'n'drop framework for WPF applications.</Description>

<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<Version>3.0.0.0</Version>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<FileVersion>3.0.0.0</FileVersion>
<InformationalVersion>3.0.0.0</InformationalVersion>
<Version>4.0.0.0</Version>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<FileVersion>4.0.0.0</FileVersion>
<InformationalVersion>4.0.0.0</InformationalVersion>
</PropertyGroup>

<ItemGroup>
<Page Update="@(Page)" SubType="Designer" Generator="MSBuild:Compile" />
</ItemGroup>

<PropertyGroup>
<TargetFrameworkMonikerAssemblyAttributesPath>$([System.IO.Path]::Combine('$(IntermediateOutputPath)','$(TargetFrameworkMoniker).AssemblyAttributes$(DefaultLanguageSourceExtension)'))</TargetFrameworkMonikerAssemblyAttributesPath>
</PropertyGroup>

<ItemGroup>
<EmbeddedFiles Include="$(GeneratedAssemblyInfoFile)" />
</ItemGroup>
Expand Down
20 changes: 14 additions & 6 deletions src/Directory.packages.props
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
<Project>
<!--
This enabled central package management.
This allows for controling all NuGet packages within the Directory.Packages.props file
See https://learn.microsoft.com/nuget/consume-packages/Central-Package-Management?WT.mc_id=DT-MVP-5003472
-->

<PropertyGroup>
<!-- This property enables the Central Package Management feature -->
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<!-- https://learn.microsoft.com/nuget/consume-packages/Central-Package-Management?WT.mc_id=DT-MVP-5003472#transitive-pinning -->
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
</PropertyGroup>

<ItemGroup Label="Build">
<PackageVersion Include="JetBrains.Annotations" Version="2023.2.0" />
<PackageVersion Include="JetBrains.Annotations" Version="2024.3.0" />

<PackageVersion Include="MahApps.Metro.IconPacks.FeatherIcons" Version="4.11.0" />
<PackageVersion Include="MahApps.Metro.IconPacks.Material" Version="4.11.0" />
<PackageVersion Include="MahApps.Metro.IconPacks.Octicons" Version="4.11.0" />
<PackageVersion Include="Faker.Net" Version="2.0.154" />
<PackageVersion Include="Costura.Fody" Version="5.7.0" />
<PackageVersion Include="MahApps.Metro.IconPacks.FeatherIcons" Version="5.1.0" />
<PackageVersion Include="MahApps.Metro.IconPacks.Material" Version="5.1.0" />
<PackageVersion Include="MahApps.Metro.IconPacks.Octicons" Version="5.1.0" />
<PackageVersion Include="Faker.Net" Version="2.0.163" />
<PackageVersion Include="Costura.Fody" Version="6.0.0" />

<PackageVersion Include="WpfAnalyzers" Version="4.1.1" />
</ItemGroup>
Expand Down
12 changes: 10 additions & 2 deletions src/GongSolutions.WPF.DragDrop.sln
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28729.10
# Visual Studio Version 17
VisualStudioVersion = 17.12.35514.174
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GongSolutions.WPF.DragDrop", "GongSolutions.WPF.DragDrop\GongSolutions.WPF.DragDrop.csproj", "{CB5BFDCE-284B-4B1E-A99A-ED4764D26E74}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Showcase.WPF.DragDrop", "Showcase\Showcase.WPF.DragDrop.csproj", "{4E15F482-1FE9-4614-98F7-31256B643462}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{DBB1D473-7CDE-4C02-9081-7EBC3C6C429A}"
ProjectSection(SolutionItems) = preProject
..\build.cake = ..\build.cake
Directory.build.props = Directory.build.props
Directory.build.targets = Directory.build.targets
Directory.packages.props = Directory.packages.props
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
43 changes: 39 additions & 4 deletions src/Showcase/FodyWeavers.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,27 @@
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged32Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with line breaks.</xs:documentation>
<xs:documentation>Obsolete, use UnmanagedWinX86Assemblies instead</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="UnmanagedWinX86Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged X86 (32 bit) assembly names to include, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged64Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with line breaks.</xs:documentation>
<xs:documentation>Obsolete, use UnmanagedWinX64Assemblies instead.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="UnmanagedWinX64Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged X64 (64 bit) assembly names to include, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="UnmanagedWinArm64Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged Arm64 (64 bit) assembly names to include, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="PreloadOrder" type="xs:string">
Expand Down Expand Up @@ -73,6 +88,11 @@
<xs:documentation>As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DisableEventSubscription" type="xs:boolean">
<xs:annotation>
<xs:documentation>The attach method no longer subscribes to the `AppDomain.AssemblyResolve` (.NET 4.x) and `AssemblyLoadContext.Resolving` (.NET 6.0+) events.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="LoadAtModuleInit" type="xs:boolean">
<xs:annotation>
<xs:documentation>Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code.</xs:documentation>
Expand Down Expand Up @@ -105,12 +125,27 @@
</xs:attribute>
<xs:attribute name="Unmanaged32Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with |.</xs:documentation>
<xs:documentation>Obsolete, use UnmanagedWinX86Assemblies instead</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="UnmanagedWinX86Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged X86 (32 bit) assembly names to include, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Unmanaged64Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with |.</xs:documentation>
<xs:documentation>Obsolete, use UnmanagedWinX64Assemblies instead</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="UnmanagedWinX64Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged X64 (64 bit) assembly names to include, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="UnmanagedWinArm64Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged Arm64 (64 bit) assembly names to include, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="PreloadOrder" type="xs:string">
Expand Down
Loading

0 comments on commit 1ac2daa

Please sign in to comment.