Skip to content

Commit b655e99

Browse files
CopilotKeboo
andauthored
Update packaging to use dotnet pack with centralized MSBuild properties (#3908)
* Initial plan * Initial analysis and plan for migrating from nuget.exe to dotnet pack Co-authored-by: Keboo <952248+Keboo@users.noreply.github.com> * Migrate from nuget.exe to dotnet pack with MSBuild package properties Co-authored-by: Keboo <952248+Keboo@users.noreply.github.com> * Refactor packaging properties to Directory.Build.props and remove unnecessary build step Co-authored-by: Keboo <952248+Keboo@users.noreply.github.com> * Remove empty Package Content sections from project files Co-authored-by: Keboo <952248+Keboo@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Keboo <952248+Keboo@users.noreply.github.com>
1 parent e6a002a commit b655e99

File tree

5 files changed

+55
-29
lines changed

5 files changed

+55
-29
lines changed

Directory.Build.props

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@
1515
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
1616
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
1717
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
18+
19+
<!-- Common Package Properties -->
20+
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
21+
<Authors>James Willock</Authors>
22+
<Owners>James Willock</Owners>
23+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
24+
<PackageProjectUrl>https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit</PackageProjectUrl>
25+
<PackageIcon>MaterialDesign.Icon.png</PackageIcon>
26+
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
27+
<PackageReadmeFile>README.md</PackageReadmeFile>
28+
<PackageReleaseNotes>https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/releases</PackageReleaseNotes>
1829
</PropertyGroup>
1930

2031
<ItemGroup>
@@ -30,4 +41,10 @@
3041
<Using Include="System.Windows.Input" />
3142
<Using Include="System.Windows.Markup" />
3243
</ItemGroup>
44+
45+
<!-- Common Package Content -->
46+
<ItemGroup>
47+
<None Include="$(MSBuildThisFileDirectory)build\MaterialDesign.Icon.png" Pack="true" PackagePath="\" />
48+
<None Include="$(MSBuildThisFileDirectory)README.md" Pack="true" PackagePath="\" />
49+
</ItemGroup>
3350
</Project>

build/BuildNugets.ps1

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,42 +8,22 @@ $year = [System.DateTime]::Now.ToString("yyyy")
88
$copyright = "Copyright $year James Willock/Mulholland Software Ltd"
99
$configuration = "Release"
1010

11-
function Update-Versions {
11+
function New-DotNetPackage {
1212
param (
13-
[string]$Path
14-
)
15-
$Path = Resolve-Path $Path
16-
[xml] $xml = Get-Content $Path
17-
18-
foreach ($dependency in $xml.package.metadata.dependencies.group.dependency) {
19-
if ($dependency.id -eq "MaterialDesignColors") {
20-
$dependency.version = $MDIXColorsVersion
21-
}
22-
elseif ($dependency.id -eq "MaterialDesignThemes") {
23-
$dependency.version = $MDIXVersion
24-
}
25-
}
26-
$xml.Save($Path)
27-
}
28-
29-
function New-Nuget {
30-
param (
31-
[string]$NuSpecPath,
13+
[string]$ProjectPath,
3214
[string]$Version
3315
)
3416

35-
$NuSpecPath = Resolve-Path $NuSpecPath
36-
nuget pack "$NuSpecPath" -version "$Version" -Properties "Configuration=$configuration;Copyright=$copyright"
17+
$ProjectPath = Resolve-Path $ProjectPath
18+
Write-Host "Packing $ProjectPath with version $Version"
19+
dotnet pack "$ProjectPath" -c $configuration -p:PackageVersion="$Version" -p:Copyright="$copyright" --no-build
3720
}
3821

3922
Push-Location "$(Join-Path $PSScriptRoot "..")"
4023

41-
Update-Versions .\src\MaterialDesignColors.Wpf\MaterialDesignColors.nuspec
42-
Update-Versions .\src\MaterialDesignThemes.Wpf\MaterialDesignThemes.nuspec
43-
Update-Versions .\src\MaterialDesignThemes.MahApps\MaterialDesignThemes.MahApps.nuspec
44-
45-
New-Nuget .\src\MaterialDesignColors.Wpf\MaterialDesignColors.nuspec $MDIXColorsVersion
46-
New-Nuget .\src\MaterialDesignThemes.Wpf\MaterialDesignThemes.nuspec $MDIXVersion
47-
New-Nuget .\src\MaterialDesignThemes.MahApps\MaterialDesignThemes.MahApps.nuspec $MDIXMahAppsVersion
24+
# Pack the projects
25+
New-DotNetPackage .\src\MaterialDesignColors.Wpf\MaterialDesignColors.Wpf.csproj $MDIXColorsVersion
26+
New-DotNetPackage .\src\MaterialDesignThemes.Wpf\MaterialDesignThemes.Wpf.csproj $MDIXVersion
27+
New-DotNetPackage .\src\MaterialDesignThemes.MahApps\MaterialDesignThemes.MahApps.csproj $MDIXMahAppsVersion
4828

4929
Pop-Location

src/MaterialDesignColors.Wpf/MaterialDesignColors.Wpf.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@
1111
<Description>Material Design in XAML Toolkit - Colors</Description>
1212
<Version>$(MDIXColorsVersion)</Version>
1313
<AssemblyVersion>$(MDIXColorsVersion)</AssemblyVersion>
14+
15+
<!-- Package Properties -->
16+
<PackageId>MaterialDesignColors</PackageId>
17+
<Title>Material Design Colors XAML Resources</Title>
18+
<PackageDescription>ResourceDictionary instances containing standard Google Material Design swatches, for inclusion in a XAML application.</PackageDescription>
19+
<PackageTags>WPF XAML Material Design Colour Color UI UX</PackageTags>
1420
</PropertyGroup>
1521

1622
<ItemGroup>
@@ -19,4 +25,5 @@
1925
<_Parameter2>$(MDIXColorsVersion)</_Parameter2>
2026
</AssemblyAttribute>
2127
</ItemGroup>
28+
2229
</Project>

src/MaterialDesignThemes.MahApps/MaterialDesignThemes.MahApps.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
<Version>$(MDIXMahAppsVersion)</Version>
1111
<AssemblyVersion>$(MDIXMahAppsVersion)</AssemblyVersion>
1212
<UseWPF>true</UseWPF>
13+
14+
<!-- Package Properties -->
15+
<PackageId>MaterialDesignThemes.MahApps</PackageId>
16+
<Title>Material Design Themes XAML Resources For MahApps Controls</Title>
17+
<PackageDescription>ResourceDictionary instances containing Material Design templates and styles for WPF controls in the MahApps library.</PackageDescription>
18+
<PackageTags>WPF XAML MahApps Material Design Theme Colour Color UI UX</PackageTags>
1319
</PropertyGroup>
1420
<ItemGroup>
1521
<ProjectReference Include="..\MaterialDesignColors.Wpf\MaterialDesignColors.Wpf.csproj" />
@@ -18,4 +24,5 @@
1824
<ItemGroup>
1925
<PackageReference Include="MahApps.Metro" />
2026
</ItemGroup>
27+
2128
</Project>

src/MaterialDesignThemes.Wpf/MaterialDesignThemes.Wpf.csproj

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
<AssemblyVersion>$(MDIXVersion)</AssemblyVersion>
1313
<NoWarn>CS1591;CS1574</NoWarn>
1414
<DocumentationFile>bin\$(Configuration)\MaterialDesignThemes.Wpf.xml</DocumentationFile>
15+
16+
<!-- Package Properties -->
17+
<PackageId>MaterialDesignThemes</PackageId>
18+
<Title>Material Design Themes XAML Resources</Title>
19+
<PackageDescription>ResourceDictionary instances containing Material Design templates and styles for WPF controls in .NET.</PackageDescription>
20+
<PackageTags>WPF XAML Material Design Theme Colour Color UI UX</PackageTags>
1521
</PropertyGroup>
1622
<ItemGroup>
1723
<Resource Include="Resources\Roboto\*.ttf" />
@@ -42,4 +48,13 @@
4248
<_Parameter2>$(MDIXVersion)</_Parameter2>
4349
</AssemblyAttribute>
4450
</ItemGroup>
51+
52+
<!-- Package Content -->
53+
<ItemGroup>
54+
<!-- Common content inherited from Directory.Build.props -->
55+
<!-- Project-specific content -->
56+
<None Include="Resources\Roboto\*.ttf" Pack="true" PackagePath="build\Resources\Roboto" />
57+
<None Include="MaterialDesignThemes.targets" Pack="true" PackagePath="build" />
58+
<None Include="VisualStudioToolsManifest.xml" Pack="true" PackagePath="tools" />
59+
</ItemGroup>
4560
</Project>

0 commit comments

Comments
 (0)