Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,6 @@ jobs:
with:
dotnet-version: 10.x

- name: ✏️ Set abstractions version from CHANGELOG.md
shell: pwsh
run: ./scripts/Set-VersionFromChangelog.ps1 -ChangelogPath XrmPluginCore.Abstractions/CHANGELOG.md -CsprojPath XrmPluginCore.Abstractions/XrmPluginCore.Abstractions.csproj

- name: ✏️ Set source generator version from CHANGELOG.md
shell: pwsh
run: ./scripts/Set-VersionFromChangelog.ps1 -ChangelogPath XrmPluginCore/CHANGELOG.md -CsprojPath XrmPluginCore.SourceGenerator/XrmPluginCore.SourceGenerator.csproj

- name: ✏️ Set implementations version from CHANGELOG.md
shell: pwsh
run: ./scripts/Set-VersionFromChangelog.ps1 -ChangelogPath XrmPluginCore/CHANGELOG.md -CsprojPath XrmPluginCore/XrmPluginCore.csproj

- name: 📦 Install dependencies
run: dotnet restore

Expand Down
12 changes: 0 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,6 @@ jobs:
with:
dotnet-version: 10.x

- name: ✏️ Set abstractions version from CHANGELOG.md
shell: pwsh
run: ./scripts/Set-VersionFromChangelog.ps1 -ChangelogPath XrmPluginCore.Abstractions/CHANGELOG.md -CsprojPath XrmPluginCore.Abstractions/XrmPluginCore.Abstractions.csproj

- name: ✏️ Set source generator version from CHANGELOG.md
shell: pwsh
run: ./scripts/Set-VersionFromChangelog.ps1 -ChangelogPath XrmPluginCore/CHANGELOG.md -CsprojPath XrmPluginCore.SourceGenerator/XrmPluginCore.SourceGenerator.csproj

- name: ✏️ Set implementations version from CHANGELOG.md
shell: pwsh
run: ./scripts/Set-VersionFromChangelog.ps1 -ChangelogPath XrmPluginCore/CHANGELOG.md -CsprojPath XrmPluginCore/XrmPluginCore.csproj

- name: 📦 Restore dependencies
run: dotnet restore

Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ Version numbers are managed through CHANGELOG.md files:
- `XrmPluginCore/CHANGELOG.md` for the main library and source generator (both use the same version)
- `XrmPluginCore.Abstractions/CHANGELOG.md` for abstractions

The `Set-VersionFromChangelog.ps1` script updates .csproj files from CHANGELOG during CI/CD.
`Directory.Build.targets` derives each project's `<Version>` from the latest `### v...` entry in the relevant CHANGELOG.md at build time — no script or CI step required. Core and the source generator share `XrmPluginCore/CHANGELOG.md`; Abstractions overrides `ChangelogPath` in its .csproj to use its own changelog. An explicit `-p:Version=...` still overrides the derived value.

## Source Generator Development

Expand Down
43 changes: 41 additions & 2 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,10 +1,49 @@
<Project>
<!-- Package metadata for packable projects -->
<!-- Derive <Version> from the relevant CHANGELOG.md (keepachangelog format:
lines like "### v1.4.1 - 01 July 2026"). The main library and the source
generator are released in lockstep, so both share XrmPluginCore/CHANGELOG.md;
Abstractions versions independently and overrides ChangelogPath to its own.

This lives in .targets (not .props) so a csproj-level ChangelogPath override
(and IsPackable) is already evaluated. Version is set unconditionally from the
changelog (overriding the SDK's 1.0.0 default); an explicit command-line
-p:Version=... is a global property and still takes precedence. -->
<PropertyGroup Condition="!$(MSBuildProjectName.EndsWith('.Tests'))">
<ChangelogPath Condition="'$(ChangelogPath)' == ''">$(MSBuildThisFileDirectory)XrmPluginCore\CHANGELOG.md</ChangelogPath>
<_ChangelogVersionLine Condition="Exists('$(ChangelogPath)')">$([System.Text.RegularExpressions.Regex]::Match($([System.IO.File]::ReadAllText('$(ChangelogPath)')), '(?m)^### v[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9\-\.]+)?'))</_ChangelogVersionLine>
<!-- Strip the leading "### v" (5 chars) to leave just the version -->
<Version Condition="'$(_ChangelogVersionLine)' != ''">$(_ChangelogVersionLine.Substring(5))</Version>
<!-- Fallback when no changelog entry is found (e.g. a missing changelog) -->
<Version Condition="'$(_ChangelogVersionLine)' == ''">1.0.0-local</Version>
</PropertyGroup>

<!-- Package metadata shared by all packable projects. -->
<!-- This is in .targets (not .props) because it must evaluate AFTER project files set IsPackable=true -->
<PropertyGroup Condition="'$(IsPackable)' != 'false'">
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageProjectUrl>https://github.com/delegateas/XrmPluginCore</PackageProjectUrl>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageIcon>contextand.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Version Condition="'$(Version)' == ''">1.0.0-local</Version>
</PropertyGroup>

<!-- LICENSE / README / icon are packed by every packable project -->
<ItemGroup Condition="'$(IsPackable)' != 'false'">
<None Include="$(MSBuildThisFileDirectory)LICENSE" Pack="true" PackagePath="\" Visible="false" />
<None Include="$(MSBuildThisFileDirectory)README.md" Pack="true" PackagePath="\" Visible="false" />
<None Include="$(MSBuildThisFileDirectory)resources\contextand.png" Pack="true" PackagePath="\" Visible="false" />
</ItemGroup>

<!-- Echo the changelog-derived version during build for visual confirmation
(replaces the "Detected version" output the old version script printed).
Limited to shipped projects (packable + the bundled source generator) and to
inner builds (TargetFramework set) so a multi-targeted project prints once per TF
rather than repeating for the cross-targeting outer build. -->
<Target Name="ReportChangelogVersion"
BeforeTargets="Build"
Condition="('$(IsPackable)' != 'false' Or '$(IsRoslynComponent)' == 'true') And '$(TargetFramework)' != '' And '$(ChangelogPath)' != ''">
<Message Importance="high" Text="$(MSBuildProjectName) ($(TargetFramework)) version: $(Version) (from $([System.IO.Path]::GetFullPath('$(ChangelogPath)')))" />
</Target>
</Project>
20 changes: 2 additions & 18 deletions XrmPluginCore.Abstractions/XrmPluginCore.Abstractions.csproj
Original file line number Diff line number Diff line change
@@ -1,29 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<PackageId>XrmPluginCore.Abstractions</PackageId>
<Title>XrmPluginCore.Abstractions</Title>
<PackageProjectUrl>https://github.com/delegateas/XrmPluginCore</PackageProjectUrl>
<Description>Abstractions and shared Enums for the XrmPluginCore package</Description>
<PackageTags>xrm,crm,dataverse,daxif,delegate,context&amp;,contextand,xrmmockup</PackageTags>
<IncludeSymbols>True</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<RootNamespace>XrmPluginCore</RootNamespace>
<IsPackable>true</IsPackable>
<!-- Abstractions versions independently of the main library -->
<ChangelogPath>$(MSBuildProjectDirectory)\CHANGELOG.md</ChangelogPath>
</PropertyGroup>
<ItemGroup>
<None Include="..\LICENSE">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<None Include="..\README.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<None Include="..\resources\contextand.png">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>
</Project>
18 changes: 0 additions & 18 deletions XrmPluginCore/XrmPluginCore.csproj
Original file line number Diff line number Diff line change
@@ -1,32 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;net8</TargetFrameworks>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<UseDataverseSdk>true</UseDataverseSdk>
<PackageId>XrmPluginCore</PackageId>
<Title>XrmPluginCore</Title>
<Description>XrmPluginCore provides base functionality for developing plugins and custom APIs in Dynamics 365. It includes context wrappers and registration utilities to streamline the development process.</Description>
<PackageProjectUrl>https://github.com/delegateas/XrmPluginCore</PackageProjectUrl>
<PackageTags>xrm,crm,dataverse,daxif,delegate,context&amp;,contextand,xrmmockup,xrmsync</PackageTags>
<IncludeSymbols>True</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<IsPackable>true</IsPackable>
</PropertyGroup>
<ItemGroup>
<None Include="..\LICENSE">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<None Include="..\README.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<None Include="..\resources\contextand.png">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
Expand Down
6 changes: 2 additions & 4 deletions scripts/Pack-Local.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
./scripts/Set-VersionFromChangelog.ps1 -ChangelogPath .\XrmPluginCore\CHANGELOG.md -CsprojPath .\XrmPluginCore\XrmPluginCore.csproj
./scripts/Set-VersionFromChangelog.ps1 -ChangelogPath .\XrmPluginCore.SourceGenerator\CHANGELOG.md -CsprojPath .\XrmPluginCore.SourceGenerator\XrmPluginCore.SourceGenerator.csproj
./scripts/Set-VersionFromChangelog.ps1 -ChangelogPath .\XrmPluginCore.Abstractions\CHANGELOG.md -CsprojPath .\XrmPluginCore.Abstractions\XrmPluginCore.Abstractions.csproj

# Versions are derived automatically from each project's CHANGELOG.md by
# Directory.Build.targets, so no version-setting step is needed here.
dotnet build --configuration Release
dotnet pack
36 changes: 0 additions & 36 deletions scripts/Set-VersionFromChangelog.ps1

This file was deleted.

Loading