Skip to content

MSBuild modernization: Central Package Management and project cleanup#1656

Open
ViktorHofer wants to merge 6 commits intodevlooped:mainfrom
ViktorHofer:msbuild-modernization
Open

MSBuild modernization: Central Package Management and project cleanup#1656
ViktorHofer wants to merge 6 commits intodevlooped:mainfrom
ViktorHofer:msbuild-modernization

Conversation

@ViktorHofer
Copy link

Summary

Modernizes the MSBuild infrastructure with Central Package Management and removes redundant/duplicated configuration from project files.

Changes

1. Implement Central Package Management

  • Create src/Directory.Packages.props centralizing all 16 package versions
  • Remove Version attributes from PackageReference items across all 4 projects
  • Eliminates version duplication and drift risk

2. Add PrivateAssets to NuGetizer

  • NuGetizer is a build-time tool that should not flow as a transitive dependency to consumers

3. Remove hardcoded LangVersion

  • Moq.csproj and Moq.Tests.csproj pinned LangVersion=10.0, overriding the global Latest from Directory.Build.props

4. Remove redundant DebugSymbols/DebugType from test projects

  • All 3 test projects set DebugSymbols=True and DebugType=portable, but Directory.Build.props already sets these globally

5. Simplify feature flag conditions

  • Replace Regex::IsMatch property function calls with simpler String.Contains() for conditional feature detection in Moq.Tests.csproj

6. Centralize FEATURE_DEFAULT_INTERFACE_IMPLEMENTATIONS

  • Move duplicated conditional from Moq.csproj and Moq.Tests.csproj into Directory.Build.targets
  • Covers all relevant TFMs (netstandard2.1, net6.0, net8.0) in a single location
  • Placed in .targets (not .props) because TargetFramework is not available in .props for single-targeting projects

Verification

All changes verified with clean dotnet build (0 warnings, 0 errors).

ViktorHofer and others added 6 commits February 17, 2026 21:57
Create Directory.Packages.props to centralize all NuGet package
versions in a single file, eliminating version duplication across
4 project files.

- Add src/Directory.Packages.props with all package versions
- Remove Version attributes from PackageReference items in all projects
- Suppress NU1507 warning for multiple package sources with CPM

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
NuGetizer is a build-time tool that should not flow as a transitive
dependency to package consumers.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Directory.Build.props already sets LangVersion=Latest globally.
The per-project LangVersion=10.0 overrides were unnecessarily
pinning to an older C# version.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Directory.Build.props already sets DebugType=embedded and
DebugSymbols=true globally. The per-project overrides to
portable were redundant.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace Regex::IsMatch property function calls with simpler
String.Contains() for conditional feature detection. Both are
functionally equivalent for these patterns but Contains() is
more readable and avoids regex overhead.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ld.targets

Move the duplicated FEATURE_DEFAULT_INTERFACE_IMPLEMENTATIONS
conditional from Moq.csproj and Moq.Tests.csproj into
Directory.Build.targets, covering all relevant TFMs (netstandard2.1,
net6.0, net8.0) in a single location. Placed in .targets (not .props)
because TargetFramework is not available in .props for single-targeting
projects. Uses Language property for VB delimiter handling.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@CLAassistant
Copy link

CLAassistant commented Feb 17, 2026

CLA assistant check
All committers have signed the CLA.

@ViktorHofer
Copy link
Author

Note for reviewer. This PR was created automatically by gh copilot cli to test our new msbuild skills (not yet shipping): https://github.com/ViktorHofer/dotnet-skills

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments