Compze.Build.FlexRef 0.6.0

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global Compze.Build.FlexRef --version 0.6.0
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local Compze.Build.FlexRef --version 0.6.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=Compze.Build.FlexRef&version=0.6.0
                    
nuke :add-package Compze.Build.FlexRef --version 0.6.0
                    

Compze.Build.FlexRef

Solution-aware MSBuild reference resolution for .NET projects.

The Problem

When a .NET solution contains many projects that are also published as NuGet packages, you face a choice:

  • ProjectReference — good for cross cutting development and refactoring across all projects, but requires all projects in the solution and builds are slow.
  • PackageReference — fast builds and lightweight solutions with any subset of projects, but you lose the above advantages.

Our Solution

A dotnet tool that generates the MSBuild boilerplate to turn your references into flex references, which become project references if the referenced project is in the solution, and package references if not.

Then you can set up any number of .slnx solutions to fit what you need at the moment.

Quick Start

Install the tool:

dotnet tool install --global Compze.Build.FlexRef

Initialize in your repository root:

flexref init

This scans for packable projects, creates FlexRef.config.xml, and writes build/FlexRef.props.

Review the generated config, then sync:

flexref sync

This updates Directory.Build.props, all .csproj files with flex references, and NCrunch solution files.

What It Generates

flexref sync manages the following files:

  • build/FlexRef.props — shared MSBuild infrastructure that reads the .slnx at build time to determine which projects are present.
  • Directory.Build.props — imports FlexRef.props and declares per-dependency detection properties.
  • .csproj files — conditional PackageReference / ProjectReference pairs for each flex reference.
  • .v3.ncrunchsolution files — NCrunch custom build properties makes this work in NCrunch.

Configuration

FlexRef.config.xml controls which packages become flex references:

<FlexRef>
  <AutoDiscover />
</FlexRef>

<AutoDiscover /> finds all packable projects automatically. To exclude specific packages:

<FlexRef>
  <AutoDiscover>
    <Exclude Name="Acme.Internal" />
  </AutoDiscover>
</FlexRef>

Or list packages explicitly instead:

<FlexRef>
  <Package Name="Acme.Core" />
  <Package Name="Acme.Utilities" />
</FlexRef>

Compatibility

Confirmed to work with:

  • Visual Studio 2026
  • JetBrains Rider
  • VS Code (C# Dev Kit and/or ReSharper)
  • dotnet build / dotnet restore CLI
  • NCrunch (via generated .v3.ncrunchsolution files)

Note: Only .slnx solution files are supported. Classic .sln files are not.

CLI / CI Overrides

dotnet build /p:UsePackageReference_Acme_Utilities=true

License

Apache License 2.0

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
0.7.0 105 5/29/2026
0.6.2 123 3/5/2026
0.6.1 104 3/1/2026
0.6.0 122 2/28/2026
0.5.0-alpha.1 60 2/22/2026
0.2.0-alpha.3 155 2/21/2026