diff --git a/.devcontainer/unitsnet-modular/devcontainer.json b/.devcontainer/unitsnet-modular/devcontainer.json
index 86d459a883..9220886a28 100644
--- a/.devcontainer/unitsnet-modular/devcontainer.json
+++ b/.devcontainer/unitsnet-modular/devcontainer.json
@@ -1,26 +1,26 @@
{
"name": "UnitsNet.Modular playground",
"image": "mcr.microsoft.com/devcontainers/dotnet:10.0-noble",
- "postCreateCommand": "dotnet build UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/UnitsNet.Modular.Playground.csproj",
+ "postCreateCommand": "dotnet build UnitsNet.Modular/Samples/ModularPlayground/ModularPlayground.csproj -p:Platform=ProjectReferences",
"customizations": {
"vscode": {
"extensions": [
"ms-dotnettools.csdevkit"
],
"settings": {
- "dotnet.defaultSolution": "UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/UnitsNet.Modular.Playground.slnx",
+ "dotnet.defaultSolution": "UnitsNet.Modular/Samples/ModularPlayground/ModularPlayground.slnx",
"csharp.debug.console": "integratedTerminal",
- "terminal.integrated.cwd": "${workspaceFolder}/UnitsNet.Modular/Samples/UnitsNet.Modular.Playground"
+ "terminal.integrated.cwd": "${workspaceFolder}/UnitsNet.Modular/Samples/ModularPlayground"
}
},
"codespaces": {
"openFiles": [
- "UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/README.md",
- "UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/Program.cs",
- "UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/ApplicationUnits.cs",
- "UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/GameScore.unitsnet.json",
- "UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/Properties/launchSettings.json",
- "UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/UnitsNet.Modular.Playground.csproj"
+ "UnitsNet.Modular/Samples/ModularPlayground/README.md",
+ "UnitsNet.Modular/Samples/ModularPlayground/Program.cs",
+ "UnitsNet.Modular/Samples/ModularPlayground/ApplicationUnits.cs",
+ "UnitsNet.Modular/Samples/ModularPlayground/ParcelCount.unitsnet.json",
+ "UnitsNet.Modular/Samples/ModularPlayground/Properties/launchSettings.json",
+ "UnitsNet.Modular/Samples/ModularPlayground/ModularPlayground.csproj"
]
}
}
diff --git a/.github/workflows/unitsnet-modular-ci.yml b/.github/workflows/unitsnet-modular-ci.yml
index d32ef685ce..6b262610e0 100644
--- a/.github/workflows/unitsnet-modular-ci.yml
+++ b/.github/workflows/unitsnet-modular-ci.yml
@@ -78,33 +78,44 @@ jobs:
dotnet-version: 10.0.x
- name: Restore
- run: dotnet restore UnitsNet.Modular.slnx -p:UnitsNetModularSampleUpdateLocalPackagesOnBuild=true
+ run: dotnet restore UnitsNet.Modular.slnx -p:Platform=ProjectReferences
- name: Build
- run: dotnet build UnitsNet.Modular.slnx --configuration Release --no-restore --no-incremental -p:UnitsNetModularSampleUpdateLocalPackagesOnBuild=true
+ run: dotnet build UnitsNet.Modular.slnx --configuration Release --no-restore --no-incremental -p:Platform=ProjectReferences
- name: Test
- run: dotnet test UnitsNet.Modular.slnx --configuration Release --no-build -p:UnitsNetModularSampleUpdateLocalPackagesOnBuild=false
+ run: dotnet test UnitsNet.Modular.slnx --configuration Release --no-build -p:Platform=ProjectReferences
- name: Native AOT smoke test
run: |
- dotnet publish UnitsNet.Modular/Samples/UnitsNet.Modular.Lean.Sample/UnitsNet.Modular.Lean.Sample.csproj \
+ dotnet publish UnitsNet.Modular/Samples/QuantitySelectionSample/QuantitySelectionSample.csproj \
--configuration Release \
--framework net10.0 \
--runtime linux-x64 \
--self-contained true \
-p:PublishAot=true \
- -p:UnitsNetModularSampleUpdateLocalPackagesOnBuild=false \
+ -p:Platform=ProjectReferences \
--output Artifacts/UnitsNet.Modular.AotSmoke
- ./Artifacts/UnitsNet.Modular.AotSmoke/UnitsNet.Modular.Lean.Sample
+ ./Artifacts/UnitsNet.Modular.AotSmoke/QuantitySelectionSample
- name: Run getting-started NuGet consumer
shell: pwsh
- run: ./UnitsNet.Modular/Samples/UnitsNet.Modular.GettingStarted.Sample/run.ps1
-
- - name: Run custom-definition NuGet consumer
- shell: pwsh
- run: ./UnitsNet.Modular/Samples/UnitsNet.Modular.NuGet.Sample/run.ps1
+ run: ./UnitsNet.Modular/Samples/GettingStartedSample/run.ps1
+
+ - name: Run custom-definition NuGet consumer with isolated cache
+ run: >-
+ dotnet run
+ --project UnitsNet.Modular/Samples/CustomQuantitySample/CustomQuantitySample.csproj
+ --configuration Debug
+ -p:Platform=LocalPackages
+ -p:RestorePackagesPath=${{ runner.temp }}/unitsnet-modular-custom-packages-${{ github.run_id }}-${{ github.run_attempt }}
+
+ - name: Run published-package consumer
+ run: >-
+ dotnet run
+ --project UnitsNet.Modular/Samples/GettingStartedSample/GettingStartedSample.csproj
+ --configuration Release
+ -p:Platform=PublishedPackages
- name: Pack
run: dotnet pack UnitsNet.Modular/UnitsNet.Modular/UnitsNet.Modular.csproj --configuration Release --no-build --output Artifacts/UnitsNet.Modular.CI -p:UnitsNetModularPackForPublish=true
diff --git a/.vscode/launch.json b/.vscode/launch.json
index f108342b52..aef2dd4fb1 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -2,10 +2,10 @@
"version": "0.2.0",
"configurations": [
{
- "name": "C#: UnitsNet.Modular.Playground",
+ "name": "C#: ModularPlayground",
"type": "dotnet",
"request": "launch",
- "projectPath": "${workspaceFolder}/UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/UnitsNet.Modular.Playground.csproj"
+ "projectPath": "${workspaceFolder}/UnitsNet.Modular/Samples/ModularPlayground/ModularPlayground.csproj"
}
]
}
diff --git a/Directory.Build.props b/Directory.Build.props
index 23ce05c6ca..4ead857691 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -31,9 +31,4 @@
true
snupkg
-
-
-
-
-
diff --git a/Directory.Build.targets b/Directory.Build.targets
new file mode 100644
index 0000000000..9ded9b351a
--- /dev/null
+++ b/Directory.Build.targets
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Directory.Solution.targets b/Directory.Solution.targets
new file mode 100644
index 0000000000..966654a49f
--- /dev/null
+++ b/Directory.Solution.targets
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
diff --git a/UnitsNet.Modular.slnx b/UnitsNet.Modular.slnx
index 56a09a187f..809a294f30 100644
--- a/UnitsNet.Modular.slnx
+++ b/UnitsNet.Modular.slnx
@@ -1,20 +1,81 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/UnitsNet.Modular/ARCHITECTURE.md b/UnitsNet.Modular/ARCHITECTURE.md
index d60c6f1eae..49aab465e7 100644
--- a/UnitsNet.Modular/ARCHITECTURE.md
+++ b/UnitsNet.Modular/ARCHITECTURE.md
@@ -198,47 +198,34 @@ directly references it.
incrementality, and all relationship shapes.
- `UnitsNet.Modular.Tests`: generated API and runtime behavior tests.
- `UnitsNet.Modular.Compatibility.Tests`: linked-output, full-catalog public API, enum, conversion,
- parsing, formatting, behavior, and registry comparisons against unchanged UnitsNet.
-- `Samples/UnitsNet.Modular.AllSi.Sample`: the SI quantity chain from Length and Duration through Speed,
- Acceleration, Force, Pressure, Energy, and Power.
-- `Samples/UnitsNet.Modular.Representative.Sample`: a varied catalog selection and conditional
- cross-quantity operators.
-- `Samples/UnitsNet.Modular.Lean.Sample`: filtered Length and Information unit sets.
-- `Samples/UnitsNet.Modular.Compatibility.UnitsNet.Sample`: the shared compatibility consumer using
- UnitsNet v6.
-- `Samples/UnitsNet.Modular.Compatibility.Generated.Sample`: the exact same linked consumer source using
- generated quantities.
-- `Samples/UnitsNet.Modular.Custom.Sample`: a fictional `HowMuch` quantity in its own namespace.
-- `Samples/UnitsNet.Modular.GettingStarted.Sample`: the package-based two-file quick start with
+ parsing, formatting, behavior, and registry comparisons against unchanged UnitsNet. Private
+ fixture projects compile the same compatibility scenario against each implementation.
+- `Samples/GettingStartedSample`: the two-file quick start with
Length, Duration, Speed, and their generated relationship.
-- `Samples/UnitsNet.Modular.NuGet.Sample`: an isolated real-consumer scenario using only a locally packed
- `PackageReference` and consumer-owned JSON.
-- `Samples/DefinitionPackages/Fictional.Measurements.Definitions`: a packable definition-only NuGet
- containing quantity specs, JSON definitions, localization, and structured relationships.
-- `Samples/ConsumerOwned/ConsumerOwned.Units`: the package-facing application-owned generation
- boundary. It consumes locally packed runtime and definition packages.
-- `Samples/ConsumerOwned/ConsumerOwned.Units.ProjectReferences`: a maintainer-facing twin that
- compiles the same linked module declaration with direct project references and explicit
- definition files.
-- `Samples/ConsumerOwned/ConsumerOwned.Domain` and `ConsumerOwned.Reporting`: two downstream
- consumers sharing the exact generated CLR types from `ConsumerOwned.Units`.
-
-Feature and compatibility samples use project references because they exercise generated behavior
-inside this repository. `UnitsNet.Modular.GettingStarted.Sample`,
-`UnitsNet.Modular.NuGet.Sample`, and `ConsumerOwned.Units` deliberately cross the local package
-boundary: the first mirrors the documentation quick start, the second covers a minimal
-consumer-owned definition, and the last composes separately packed quantity specs into a shared
-application assembly.
+- `Samples/QuantitySelectionSample`: filtered Length and Information unit sets.
+- `Samples/CustomQuantitySample`: a fictional `HowMuch` quantity in its own namespace.
+- `Samples/Profiles/AllSiProfileSample`: the `AllSiProfile` relationship chain from Length and
+ Duration through Speed, Acceleration, Force, Pressure, Energy, and Power.
+- `Samples/ModularPlayground`: a broad interactive scenario covering parsing, metadata,
+ serialization, relationships, and an application-specific definition.
+- `Samples/SharedUnitsLibrarySample`: one generated quantity library shared by domain and app
+ projects, plus a packable definition provider containing specs, JSON, localization, and
+ structured relationships.
+
+Every sample uses the solution platform as its dependency mode. `ProjectReferences` exercises the
+current runtime and generator projects, `LocalPackages` crosses the repository-local NuGet boundary,
+and `PublishedPackages` consumes the pinned public package. This keeps dependency source separate
+from the normal Debug and Release configurations without duplicating scenario projects.
The compatibility test project uses aliased references to compare both implementations' selected
public API and unit names without introducing concrete-type ambiguity. It compares against the
unchanged UnitsNet project. Whether any contracts can genuinely be shared with UnitsNet remains a
-separate investigation. The projects live in their own solution and do not participate in the
-existing UnitsNet solution.
+separate investigation. The fixtures participate only in the Modular compatibility test graph and
+do not participate in the existing UnitsNet solution.
## Compatibility boundaries
-The linked-source samples establish source compatibility for factories, properties, unit enums,
+The linked-source test fixtures establish source compatibility for factories, properties, unit enums,
conversions, parsing, formatting, collection extensions, and operators. Catalog-wide compatibility
tests compare all 129 generated quantities and their unit enums with the unchanged UnitsNet source.
They exercise every unit's conversion through its base unit, base-unit formatting and parsing,
@@ -374,24 +361,25 @@ architecture is still being evaluated. A separate contracts package should be ex
future legacy/modular integration finds a genuinely shared interface set or another independently
versioned consumer of the runtime contracts.
-The package-facing samples import one repository-only MSBuild target that incrementally packs
-changed UnitsNet.Modular or generator sources before restore, then refreshes their floating
-`6.0.0-local.dev.*` dependencies before compilation. `ConsumerOwned.Units` registers the fictional
-definition provider as an additional package, so the automation packs the runtime first and the
-definition-spec package second with the same unique version. Restore is restricted to the shared
-`Artifacts/Nugets` development feed and can never fall back to a published package.
+Samples built with the `LocalPackages` platform import one repository-only MSBuild target that
+incrementally packs changed UnitsNet.Modular or generator sources before restore, then refreshes
+their floating `6.0.0-local.dev.*` dependencies before compilation. The shared-units library
+registers its fictional definition provider as an additional package, so the automation packs the
+runtime first and the definition package second with the same unique version. Restore is restricted
+to the shared `Artifacts/Nugets` development feed and cannot fall back to a published package.
The dependency can also be invoked explicitly:
```powershell
dotnet msbuild `
- UnitsNet.Modular/Samples/UnitsNet.Modular.NuGet.Sample/UnitsNet.Modular.NuGet.Sample.csproj `
+ UnitsNet.Modular/Samples/CustomQuantitySample/CustomQuantitySample.csproj `
+ -p:Platform=LocalPackages `
-t:UpdateLocalUnitsNetModularPackages
```
-This repository-only automation defaults on for Debug builds and off for other configurations. Set
-`UnitsNetModularSampleUpdateLocalPackagesOnBuild=true` or `false` explicitly to override the default.
-The older singular property and target names remain aliases for existing local commands.
+This repository-only automation defaults on whenever `LocalPackages` is selected. Set
+`UnitsNetModularSampleUpdateLocalPackagesOnBuild=false` to use packages already present in the local
+feed. The older singular property and target names remain aliases for existing local commands.
`RepositoryLocalNuGetFeed` in the root `Directory.Build.props` gives every repository project the
shared `Artifacts/Nugets` path. The repository-level `NuGet.Config` exposes it to solution-wide IDE
@@ -404,15 +392,14 @@ after packing. Pass
`-p:UnitsNetModularPackForPublish=true` to create the MinVer-derived publish version instead; CI sets
this explicitly.
-Run either package-facing sample from the repository root:
+Run the minimal package-facing sample from the repository root:
```powershell
-pwsh UnitsNet.Modular/Samples/UnitsNet.Modular.GettingStarted.Sample/run.ps1
-pwsh UnitsNet.Modular/Samples/UnitsNet.Modular.NuGet.Sample/run.ps1
+pwsh UnitsNet.Modular/Samples/GettingStartedSample/run.ps1
```
-Each script provides an isolated package cache and disables repository `Directory.Build.*` imports;
-the sample build dependency performs the pack and restore before executing the consumer.
+The script selects `Debug | LocalPackages`, provides an isolated package cache, and lets the sample
+build dependency pack and restore before executing the consumer.
## Versioning and CI
diff --git a/UnitsNet.Modular/Directory.Build.props b/UnitsNet.Modular/Directory.Build.props
index ded3eccf4d..7def4d3b70 100644
--- a/UnitsNet.Modular/Directory.Build.props
+++ b/UnitsNet.Modular/Directory.Build.props
@@ -10,6 +10,9 @@
+
+ AnyCPU
+
portable
true
true
diff --git a/UnitsNet.Modular/Directory.Build.targets b/UnitsNet.Modular/Directory.Build.targets
index e948acfcac..2a8faf3d65 100644
--- a/UnitsNet.Modular/Directory.Build.targets
+++ b/UnitsNet.Modular/Directory.Build.targets
@@ -1,4 +1,7 @@
+
+
+
diff --git a/UnitsNet.Modular/Directory.Packages.props b/UnitsNet.Modular/Directory.Packages.props
index 18101077ca..d7791266f8 100644
--- a/UnitsNet.Modular/Directory.Packages.props
+++ b/UnitsNet.Modular/Directory.Packages.props
@@ -11,12 +11,15 @@
10.0.0
10.0.0
4.6.3
+ 6.0.0-alpha.2
+
diff --git a/UnitsNet.Modular/README.md b/UnitsNet.Modular/README.md
index 1757bde6bf..f0c137fb37 100644
--- a/UnitsNet.Modular/README.md
+++ b/UnitsNet.Modular/README.md
@@ -947,13 +947,13 @@ separate assembly boundary. See the [migration guide](MIGRATION.md) for compatib
| Start here | Scenario |
|---|---|
-| [Getting started](Samples/UnitsNet.Modular.GettingStarted.Sample) | Minimal package-based `Length`, `Duration`, and `Speed` application matching the quick start |
-| [Lean selection](Samples/UnitsNet.Modular.Lean.Sample) | Select individual quantities and filter their units |
-| [Custom quantity](Samples/UnitsNet.Modular.Custom.Sample) | Generate an application-owned quantity from JSON |
-| [Playground](Samples/UnitsNet.Modular.Playground) | Explore relationships, aggregation, metadata, serialization, and custom definitions |
-| [Consumer-owned units](Samples/ConsumerOwned) | Share one generated quantity assembly across several projects |
-| [Definition package](Samples/DefinitionPackages/Fictional.Measurements.Definitions) | Publish reusable specs and definitions without compiled quantity structs |
-| [Compatibility pair](Samples/UnitsNet.Modular.Compatibility.Shared) | Compile the same consumer source against UnitsNet and UnitsNet.Modular |
+| [Samples overview](Samples) | Choose a focused scenario and switch between project references, local packages, and published packages |
+| [Getting started](Samples/GettingStartedSample) | Minimal `Length`, `Duration`, and `Speed` application matching the quick start |
+| [Quantity selection](Samples/QuantitySelectionSample) | Select individual quantities and filter their units |
+| [Custom quantity](Samples/CustomQuantitySample) | Generate an application-owned quantity from JSON |
+| [All SI profile](Samples/Profiles/AllSiProfileSample) | Exercise the quantities and relationships selected by `AllSiProfile` |
+| [Playground](Samples/ModularPlayground) | Explore relationships, aggregation, metadata, serialization, and custom definitions |
+| [Shared units library](Samples/SharedUnitsLibrarySample) | Share one generated quantity assembly across several projects |
For design rationale and compatibility details, continue with
[Architecture](ARCHITECTURE.md) and [Migration notes](MIGRATION.md).
diff --git a/UnitsNet.Modular/Samples/ConsumerOwned/ConsumerOwned.Units.ProjectReferences/ConsumerOwned.Units.ProjectReferences.csproj b/UnitsNet.Modular/Samples/ConsumerOwned/ConsumerOwned.Units.ProjectReferences/ConsumerOwned.Units.ProjectReferences.csproj
deleted file mode 100644
index 6fa5bf0450..0000000000
--- a/UnitsNet.Modular/Samples/ConsumerOwned/ConsumerOwned.Units.ProjectReferences/ConsumerOwned.Units.ProjectReferences.csproj
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
- net10.0
- latest
- enable
- enable
- true
- $(BaseIntermediateOutputPath)Generated
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/UnitsNet.Modular/Samples/ConsumerOwned/ConsumerOwned.Units/ConsumerOwned.Units.csproj b/UnitsNet.Modular/Samples/ConsumerOwned/ConsumerOwned.Units/ConsumerOwned.Units.csproj
deleted file mode 100644
index 995fc33a76..0000000000
--- a/UnitsNet.Modular/Samples/ConsumerOwned/ConsumerOwned.Units/ConsumerOwned.Units.csproj
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
- net10.0
- latest
- enable
- enable
- true
- $(BaseIntermediateOutputPath)Generated
- false
-
-
- true
-
-
-
-
-
-
- $(UnitsNetModularSampleLocalFeed)
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/UnitsNet.Modular/Samples/ConsumerOwned/Directory.Build.props b/UnitsNet.Modular/Samples/ConsumerOwned/Directory.Build.props
deleted file mode 100644
index e471d34a10..0000000000
--- a/UnitsNet.Modular/Samples/ConsumerOwned/Directory.Build.props
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
- true
- false
-
-
diff --git a/UnitsNet.Modular/Samples/ConsumerOwned/README.md b/UnitsNet.Modular/Samples/ConsumerOwned/README.md
deleted file mode 100644
index 817cb03907..0000000000
--- a/UnitsNet.Modular/Samples/ConsumerOwned/README.md
+++ /dev/null
@@ -1,26 +0,0 @@
-# Consumer-owned generation samples
-
-`ConsumerOwned.Units` is the canonical consumer setup. It references locally packed `UnitsNet.Modular`
-and `Fictional.Measurements.Definitions` packages, and the definition package contributes its JSON
-and relationships through `build/*.props`, just as it would for an external consumer.
-
-`ConsumerOwned.Units.ProjectReferences` is the repository-maintainer setup. It compiles the exact
-same linked `ApplicationUnits.cs`, but references the runtime, generator, and definition provider
-projects directly. Because a `ProjectReference` does not import a NuGet package's `build/*.props`,
-this project also includes the provider's definition and relation files explicitly.
-
-`ConsumerOwned.Domain` and `ConsumerOwned.Reporting` reference the canonical package-facing units
-project. They demonstrate that an application generates its quantities in one assembly and shares
-those exact CLR types between downstream projects.
-
-Build both dependency modes:
-
-```powershell
-dotnet build UnitsNet.Modular/Samples/ConsumerOwned/ConsumerOwned.Units/ConsumerOwned.Units.csproj
-dotnet build `
- UnitsNet.Modular/Samples/ConsumerOwned/ConsumerOwned.Units.ProjectReferences/ConsumerOwned.Units.ProjectReferences.csproj
-```
-
-Debug builds of the package-facing project incrementally repack changed local sources before
-restore. Set `UnitsNetModularSampleUpdateLocalPackagesOnBuild=true` for another configuration or
-`false` to use the newest packages already present in `Artifacts/Nugets`.
diff --git a/UnitsNet.Modular/Samples/UnitsNet.Modular.Custom.Sample/UnitsNet.Modular.Custom.Sample.csproj b/UnitsNet.Modular/Samples/CustomQuantitySample/CustomQuantitySample.csproj
similarity index 52%
rename from UnitsNet.Modular/Samples/UnitsNet.Modular.Custom.Sample/UnitsNet.Modular.Custom.Sample.csproj
rename to UnitsNet.Modular/Samples/CustomQuantitySample/CustomQuantitySample.csproj
index 9a52b591b6..f8b3248a96 100644
--- a/UnitsNet.Modular/Samples/UnitsNet.Modular.Custom.Sample/UnitsNet.Modular.Custom.Sample.csproj
+++ b/UnitsNet.Modular/Samples/CustomQuantitySample/CustomQuantitySample.csproj
@@ -5,17 +5,11 @@
latest
enable
enable
+ true
true
- $(BaseIntermediateOutputPath)Generated
-
-
-
-
diff --git a/UnitsNet.Modular/Samples/UnitsNet.Modular.Custom.Sample/HowMuch.unitsnet.json b/UnitsNet.Modular/Samples/CustomQuantitySample/HowMuch.unitsnet.json
similarity index 100%
rename from UnitsNet.Modular/Samples/UnitsNet.Modular.Custom.Sample/HowMuch.unitsnet.json
rename to UnitsNet.Modular/Samples/CustomQuantitySample/HowMuch.unitsnet.json
diff --git a/UnitsNet.Modular/Samples/UnitsNet.Modular.Custom.Sample/Program.cs b/UnitsNet.Modular/Samples/CustomQuantitySample/Program.cs
similarity index 100%
rename from UnitsNet.Modular/Samples/UnitsNet.Modular.Custom.Sample/Program.cs
rename to UnitsNet.Modular/Samples/CustomQuantitySample/Program.cs
diff --git a/UnitsNet.Modular/Samples/CustomQuantitySample/README.md b/UnitsNet.Modular/Samples/CustomQuantitySample/README.md
new file mode 100644
index 0000000000..b26cc75eb0
--- /dev/null
+++ b/UnitsNet.Modular/Samples/CustomQuantitySample/README.md
@@ -0,0 +1,9 @@
+# Custom quantity sample
+
+This focused sample generates the application-owned `Fictional.Measurements.HowMuch` quantity from
+`HowMuch.unitsnet.json`. It demonstrates custom namespaces, linear and nonlinear conversions,
+localization, parsing, and generated factory methods.
+
+Choose the dependency source with the solution platform described in the
+[samples overview](../README.md). The former separate local-NuGet custom-quantity sample is now this
+same project built with the `LocalPackages` platform.
diff --git a/UnitsNet.Modular/Samples/Directory.Build.props b/UnitsNet.Modular/Samples/Directory.Build.props
new file mode 100644
index 0000000000..9299957adc
--- /dev/null
+++ b/UnitsNet.Modular/Samples/Directory.Build.props
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+ ProjectReferences;LocalPackages;PublishedPackages
+
+
+ ProjectReferences
+ $(Platform)
+
+
+ true
+ true
+
+ $(RepositoryLocalNuGetFeed)
+ https://api.nuget.org/v3/index.json
+
+
+ obj/
+ obj/$(UnitsNetModularSampleDependencyMode)/
+ $(MSBuildThisFileDirectory)..\..\Artifacts\$(MSBuildProjectName)\$(UnitsNetModularSampleDependencyMode)
+
+
diff --git a/UnitsNet.Modular/Samples/Directory.Build.targets b/UnitsNet.Modular/Samples/Directory.Build.targets
new file mode 100644
index 0000000000..7a80a377b1
--- /dev/null
+++ b/UnitsNet.Modular/Samples/Directory.Build.targets
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+ $(MSBuildProjectDirectory)/obj/$(UnitsNetModularSampleDependencyMode)/$(Configuration)/$(TargetFramework)/Generated
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/UnitsNet.Modular/Samples/UnitsNet.Modular.GettingStarted.Sample/ApplicationUnits.cs b/UnitsNet.Modular/Samples/GettingStartedSample/ApplicationUnits.cs
similarity index 100%
rename from UnitsNet.Modular/Samples/UnitsNet.Modular.GettingStarted.Sample/ApplicationUnits.cs
rename to UnitsNet.Modular/Samples/GettingStartedSample/ApplicationUnits.cs
diff --git a/UnitsNet.Modular/Samples/GettingStartedSample/GettingStartedSample.csproj b/UnitsNet.Modular/Samples/GettingStartedSample/GettingStartedSample.csproj
new file mode 100644
index 0000000000..289c5644a1
--- /dev/null
+++ b/UnitsNet.Modular/Samples/GettingStartedSample/GettingStartedSample.csproj
@@ -0,0 +1,10 @@
+
+
+ Exe
+ net10.0
+ latest
+ enable
+ enable
+ true
+
+
diff --git a/UnitsNet.Modular/Samples/UnitsNet.Modular.GettingStarted.Sample/Program.cs b/UnitsNet.Modular/Samples/GettingStartedSample/Program.cs
similarity index 100%
rename from UnitsNet.Modular/Samples/UnitsNet.Modular.GettingStarted.Sample/Program.cs
rename to UnitsNet.Modular/Samples/GettingStartedSample/Program.cs
diff --git a/UnitsNet.Modular/Samples/UnitsNet.Modular.GettingStarted.Sample/README.md b/UnitsNet.Modular/Samples/GettingStartedSample/README.md
similarity index 54%
rename from UnitsNet.Modular/Samples/UnitsNet.Modular.GettingStarted.Sample/README.md
rename to UnitsNet.Modular/Samples/GettingStartedSample/README.md
index 9768334003..bc5f5943d1 100644
--- a/UnitsNet.Modular/Samples/UnitsNet.Modular.GettingStarted.Sample/README.md
+++ b/UnitsNet.Modular/Samples/GettingStartedSample/README.md
@@ -11,12 +11,14 @@ dotnet add package UnitsNet.Modular --prerelease
dotnet run
```
-The project file in this repository contains additional maintainer-only automation that packs the
-current checkout to the repository-local NuGet feed before restoring the sample. Consumers do not
-need that import or any of the `UnitsNetModularSample*` properties.
+In this repository the same project supports all three dependency platforms described in the
+[samples overview](../README.md). Choose `PublishedPackages` to mirror the ordinary application,
+`LocalPackages` to test a package built from this checkout, or `ProjectReferences` while developing.
Run the repository scenario from its root with:
```powershell
-pwsh UnitsNet.Modular/Samples/UnitsNet.Modular.GettingStarted.Sample/run.ps1
+pwsh UnitsNet.Modular/Samples/GettingStartedSample/run.ps1
```
+
+The script selects `Debug | LocalPackages` and uses an isolated package cache.
diff --git a/UnitsNet.Modular/Samples/UnitsNet.Modular.GettingStarted.Sample/run.ps1 b/UnitsNet.Modular/Samples/GettingStartedSample/run.ps1
similarity index 63%
rename from UnitsNet.Modular/Samples/UnitsNet.Modular.GettingStarted.Sample/run.ps1
rename to UnitsNet.Modular/Samples/GettingStartedSample/run.ps1
index 99a4c2e422..2296f201eb 100644
--- a/UnitsNet.Modular/Samples/UnitsNet.Modular.GettingStarted.Sample/run.ps1
+++ b/UnitsNet.Modular/Samples/GettingStartedSample/run.ps1
@@ -3,15 +3,15 @@
$ErrorActionPreference = 'Stop'
$repositoryRoot = (Resolve-Path (Join-Path $PSScriptRoot '..\..\..')).Path
-$sampleProject = Join-Path $PSScriptRoot 'UnitsNet.Modular.GettingStarted.Sample.csproj'
+$sampleProject = Join-Path $PSScriptRoot 'GettingStartedSample.csproj'
$restoreId = [DateTime]::UtcNow.ToString('yyyyMMddHHmmssfff')
-$restorePackages = Join-Path $repositoryRoot "Artifacts\UnitsNet.Modular.GettingStarted.Sample\packages\$restoreId"
+$restorePackages = Join-Path $repositoryRoot "Artifacts\GettingStartedSample\packages\$restoreId"
# The sample's local build dependency packs and restores the latest package before compilation.
& dotnet run `
--project $sampleProject `
- -p:ImportDirectoryBuildProps=false `
- -p:ImportDirectoryBuildTargets=false `
+ --configuration Debug `
+ -p:Platform=LocalPackages `
"-p:RestorePackagesPath=$restorePackages"
if ($LASTEXITCODE -ne 0) {
throw "Running the getting-started sample failed."
diff --git a/UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/ApplicationUnits.cs b/UnitsNet.Modular/Samples/ModularPlayground/ApplicationUnits.cs
similarity index 92%
rename from UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/ApplicationUnits.cs
rename to UnitsNet.Modular/Samples/ModularPlayground/ApplicationUnits.cs
index 97a733d781..ff6c130bbf 100644
--- a/UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/ApplicationUnits.cs
+++ b/UnitsNet.Modular/Samples/ModularPlayground/ApplicationUnits.cs
@@ -3,7 +3,7 @@
using UnitsNet.Modular;
using Catalog = UnitsNet.Modular.BuiltIns;
-namespace UnitsNet.Modular.Playground;
+namespace ModularPlayground;
// Change these lists and rebuild to control exactly which unit enum members are generated.
[UnitSet("Meter", "Kilometer", "Mile")]
@@ -22,7 +22,7 @@ internal interface PlaygroundEnergyUnits;
internal interface PlaygroundPowerUnits;
// The semantic ID connects this authoring type to ParcelCount.unitsnet.json.
-[QuantitySpec("UnitsNet.Modular.Playground.ParcelCount")]
+[QuantitySpec("ModularPlayground.ParcelCount")]
internal interface ParcelCountSpec;
// Add or remove selections here, then rebuild. Only these quantities are generated.
diff --git a/UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/UnitsNet.Modular.Playground.csproj b/UnitsNet.Modular/Samples/ModularPlayground/ModularPlayground.csproj
similarity index 52%
rename from UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/UnitsNet.Modular.Playground.csproj
rename to UnitsNet.Modular/Samples/ModularPlayground/ModularPlayground.csproj
index e7398bd1f0..18203a0b32 100644
--- a/UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/UnitsNet.Modular.Playground.csproj
+++ b/UnitsNet.Modular/Samples/ModularPlayground/ModularPlayground.csproj
@@ -5,20 +5,13 @@
latest
enable
enable
+ true
true
- $(BaseIntermediateOutputPath)Generated
-
-
-
-
-
diff --git a/UnitsNet.Modular/Samples/ModularPlayground/ModularPlayground.slnx b/UnitsNet.Modular/Samples/ModularPlayground/ModularPlayground.slnx
new file mode 100644
index 0000000000..0b6f114a39
--- /dev/null
+++ b/UnitsNet.Modular/Samples/ModularPlayground/ModularPlayground.slnx
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/ParcelCount.unitsnet.json b/UnitsNet.Modular/Samples/ModularPlayground/ParcelCount.unitsnet.json
similarity index 95%
rename from UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/ParcelCount.unitsnet.json
rename to UnitsNet.Modular/Samples/ModularPlayground/ParcelCount.unitsnet.json
index 0f06835d41..9d3c5666f7 100644
--- a/UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/ParcelCount.unitsnet.json
+++ b/UnitsNet.Modular/Samples/ModularPlayground/ParcelCount.unitsnet.json
@@ -1,6 +1,6 @@
{
"Name": "ParcelCount",
- "Namespace": "UnitsNet.Modular.Playground",
+ "Namespace": "ModularPlayground",
"BaseUnit": "Parcel",
"BaseDimensions": {},
"Units": [
diff --git a/UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/Program.cs b/UnitsNet.Modular/Samples/ModularPlayground/Program.cs
similarity index 99%
rename from UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/Program.cs
rename to UnitsNet.Modular/Samples/ModularPlayground/Program.cs
index fac71f1fa7..439b6e56d2 100644
--- a/UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/Program.cs
+++ b/UnitsNet.Modular/Samples/ModularPlayground/Program.cs
@@ -5,7 +5,7 @@
using UnitsNet;
using UnitsNet.Units;
-namespace UnitsNet.Modular.Playground;
+namespace ModularPlayground;
internal static class Program
{
diff --git a/UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/Properties/launchSettings.json b/UnitsNet.Modular/Samples/ModularPlayground/Properties/launchSettings.json
similarity index 77%
rename from UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/Properties/launchSettings.json
rename to UnitsNet.Modular/Samples/ModularPlayground/Properties/launchSettings.json
index 0171567d62..fac10307a4 100644
--- a/UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/Properties/launchSettings.json
+++ b/UnitsNet.Modular/Samples/ModularPlayground/Properties/launchSettings.json
@@ -1,7 +1,7 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
- "UnitsNet.Modular playground": {
+ "Modular playground": {
"commandName": "Project"
}
}
diff --git a/UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/README.md b/UnitsNet.Modular/Samples/ModularPlayground/README.md
similarity index 79%
rename from UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/README.md
rename to UnitsNet.Modular/Samples/ModularPlayground/README.md
index 8be2e37b0c..a470524f0a 100644
--- a/UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/README.md
+++ b/UnitsNet.Modular/Samples/ModularPlayground/README.md
@@ -1,9 +1,9 @@
-# UnitsNet.Modular playground
+# Modular playground
-This console app runs the real UnitsNet.Modular source generator from the current repository
-checkout. It plans a day for an electric delivery van using mixed-unit route inputs, a parcel
+This console app plans a day for an electric delivery van using mixed-unit route inputs, a parcel
manifest, driving estimates, and a charging stop. The generated quantity structs and unit enums
-become part of this app at build time; no generated C# is checked in.
+become part of this app at build time; no generated C# is checked in. Choose its dependency source
+with the solution platform described in the [samples overview](../README.md).
The scenario is split into readable sections that exercise:
@@ -19,7 +19,7 @@ The scenario is split into readable sections that exercise:
The Codespace builds the project once while it is being created. Open `Program.cs`, then press `F5`
to debug or `Ctrl+F5` to run without the debugger. If VS Code asks for a profile, choose
-**UnitsNet.Modular playground**. Output appears in the integrated terminal.
+**Modular playground**. Output appears in the integrated terminal.
You can also open a terminal and run:
@@ -39,7 +39,7 @@ Start with any of these:
4. In `Program.cs`, use the generated types, conversions, parsing, formatting, or operators.
The project enables `EmitCompilerGeneratedFiles`, so after a build you can also inspect the emitted
-C# under `obj/Generated/UnitsNet.Modular.Generator/UnitsNet.Modular.Generator.UnitsNetModularGenerator/`.
+C# under `obj////Generated/UnitsNet.Modular.Generator/UnitsNet.Modular.Generator.UnitsNetModularGenerator/`.
Delete or ignore that folder when you are done; it is build output and is not part of the project.
For the complete authoring model, see the [UnitsNet.Modular documentation](../../README.md).
diff --git a/UnitsNet.Modular/Samples/Profiles/AllSiProfileSample/AllSiProfileSample.csproj b/UnitsNet.Modular/Samples/Profiles/AllSiProfileSample/AllSiProfileSample.csproj
new file mode 100644
index 0000000000..ad254eeade
--- /dev/null
+++ b/UnitsNet.Modular/Samples/Profiles/AllSiProfileSample/AllSiProfileSample.csproj
@@ -0,0 +1,11 @@
+
+
+ Exe
+ net10.0
+ latest
+ enable
+ enable
+ true
+ true
+
+
diff --git a/UnitsNet.Modular/Samples/UnitsNet.Modular.AllSi.Sample/Program.cs b/UnitsNet.Modular/Samples/Profiles/AllSiProfileSample/Program.cs
similarity index 96%
rename from UnitsNet.Modular/Samples/UnitsNet.Modular.AllSi.Sample/Program.cs
rename to UnitsNet.Modular/Samples/Profiles/AllSiProfileSample/Program.cs
index a906e65ad7..2e175df4da 100644
--- a/UnitsNet.Modular/Samples/UnitsNet.Modular.AllSi.Sample/Program.cs
+++ b/UnitsNet.Modular/Samples/Profiles/AllSiProfileSample/Program.cs
@@ -5,7 +5,7 @@
using UnitsNet.Modular.Profiles;
using UnitsNet.Units;
-namespace UnitsNet.Modular.AllSi.Sample;
+namespace AllSiProfileSample;
[UnitsNetModule]
internal interface AllSiUnits : IIncludeProfile
diff --git a/UnitsNet.Modular/Samples/Profiles/AllSiProfileSample/README.md b/UnitsNet.Modular/Samples/Profiles/AllSiProfileSample/README.md
new file mode 100644
index 0000000000..8a3c152e2c
--- /dev/null
+++ b/UnitsNet.Modular/Samples/Profiles/AllSiProfileSample/README.md
@@ -0,0 +1,7 @@
+# All SI profile sample
+
+This sample includes `AllSiProfile` and exercises its generated relationship chain from `Length`
+and `Duration` through `Speed`, `Acceleration`, `Force`, `Pressure`, `Power`, and `Energy`.
+
+Choose the dependency source with the solution platform described in the
+[samples overview](../../README.md).
diff --git a/UnitsNet.Modular/Samples/UnitsNet.Modular.Lean.Sample/Program.cs b/UnitsNet.Modular/Samples/QuantitySelectionSample/Program.cs
similarity index 93%
rename from UnitsNet.Modular/Samples/UnitsNet.Modular.Lean.Sample/Program.cs
rename to UnitsNet.Modular/Samples/QuantitySelectionSample/Program.cs
index 1091118114..2234d3e6b5 100644
--- a/UnitsNet.Modular/Samples/UnitsNet.Modular.Lean.Sample/Program.cs
+++ b/UnitsNet.Modular/Samples/QuantitySelectionSample/Program.cs
@@ -5,7 +5,7 @@
using UnitsNet.Units;
using Catalog = UnitsNet.Modular.BuiltIns;
-namespace UnitsNet.Modular.Lean.Sample;
+namespace QuantitySelectionSample;
[UnitSet("regex:.*Meter$")]
internal interface MeterUnitSet
@@ -18,7 +18,7 @@ internal interface ByteUnitSet
}
[UnitsNetModule]
-internal interface LeanUnits :
+internal interface SelectedUnits :
IInclude,
IInclude
{
diff --git a/UnitsNet.Modular/Samples/UnitsNet.Modular.Lean.Sample/UnitsNet.Modular.Lean.Sample.csproj b/UnitsNet.Modular/Samples/QuantitySelectionSample/QuantitySelectionSample.csproj
similarity index 54%
rename from UnitsNet.Modular/Samples/UnitsNet.Modular.Lean.Sample/UnitsNet.Modular.Lean.Sample.csproj
rename to UnitsNet.Modular/Samples/QuantitySelectionSample/QuantitySelectionSample.csproj
index 62528329ae..02ac62d792 100644
--- a/UnitsNet.Modular/Samples/UnitsNet.Modular.Lean.Sample/UnitsNet.Modular.Lean.Sample.csproj
+++ b/UnitsNet.Modular/Samples/QuantitySelectionSample/QuantitySelectionSample.csproj
@@ -5,17 +5,11 @@
latest
enable
enable
+ true
true
- $(BaseIntermediateOutputPath)Generated
-
-
-
-
diff --git a/UnitsNet.Modular/Samples/QuantitySelectionSample/README.md b/UnitsNet.Modular/Samples/QuantitySelectionSample/README.md
new file mode 100644
index 0000000000..5693120829
--- /dev/null
+++ b/UnitsNet.Modular/Samples/QuantitySelectionSample/README.md
@@ -0,0 +1,8 @@
+# Quantity selection sample
+
+This focused sample includes only `Length` and `Information`, then uses `[UnitSet]` filters to keep
+meter- and byte-based units. It demonstrates how a consumer controls both the generated quantity
+catalog and the API surface of each unit enum.
+
+Choose the dependency source with the solution platform described in the
+[samples overview](../README.md).
diff --git a/UnitsNet.Modular/Samples/README.md b/UnitsNet.Modular/Samples/README.md
new file mode 100644
index 0000000000..d5a555b1f8
--- /dev/null
+++ b/UnitsNet.Modular/Samples/README.md
@@ -0,0 +1,47 @@
+# UnitsNet.Modular samples
+
+Each sample has one distinct purpose. In Rider or Visual Studio, choose the normal `Debug` or
+`Release` configuration together with the dependency platform that you want to exercise.
+
+| Sample | Purpose |
+|---|---|
+| [Getting started](GettingStartedSample) | Minimal built-in `Length`, `Duration`, and `Speed` application matching the main quick start |
+| [Quantity selection](QuantitySelectionSample) | Select individual quantities and filter their generated unit sets |
+| [Custom quantity](CustomQuantitySample) | Generate an application-owned quantity from a JSON definition |
+| [All SI profile](Profiles/AllSiProfileSample) | Include `AllSiProfile` and exercise its SI relationship chain |
+| [Modular playground](ModularPlayground) | Explore parsing, arithmetic, metadata, serialization, relationships, and custom definitions |
+| [Shared units library](SharedUnitsLibrarySample) | Generate quantities once in a class library and share their CLR types across multiple projects |
+
+The broader playground complements the focused samples: it is intended for experimentation, while
+the other projects keep one concept easy to find and copy.
+
+## Choose the dependency source
+
+The solution platform controls where every sample gets `UnitsNet.Modular`:
+
+| Platform | Dependency source |
+|---|---|
+| `ProjectReferences` | Runtime and generator projects from the current checkout |
+| `LocalPackages` | Fresh packages built into `Artifacts/Nugets` from the current checkout |
+| `PublishedPackages` | The published `UnitsNet.Modular` package from NuGet.org |
+
+`Debug | ProjectReferences` is the contributor-friendly default. The output and NuGet restore
+state for each dependency platform are isolated, so switching the IDE selector cannot reuse stale
+assets from another mode.
+
+The same modes are available from the command line:
+
+```powershell
+dotnet build UnitsNet.Modular.slnx --configuration Debug -p:Platform=ProjectReferences
+dotnet build UnitsNet.Modular.slnx --configuration Debug -p:Platform=LocalPackages
+dotnet build UnitsNet.Modular.slnx --configuration Debug -p:Platform=PublishedPackages
+```
+
+Direct sample-project builds that do not specify `Platform` default to `ProjectReferences`.
+`LocalPackages` builds update the packages automatically; pass
+`-p:UnitsNetModularSampleUpdateLocalPackagesOnBuild=false` to use packages already in the local
+feed. Override `UnitsNetModularPublishedVersion` to test a different published version.
+
+The shared-units sample also contains an intentionally fictional definition package. In
+`LocalPackages` mode both packages cross the local NuGet boundary. In the other modes the fictional
+definitions remain source-local while `UnitsNet.Modular` comes from the selected dependency source.
diff --git a/UnitsNet.Modular/Samples/DefinitionPackages/Fictional.Measurements.Definitions/Definitions/Fictional.Measurements.unitsnet.relations.json b/UnitsNet.Modular/Samples/SharedUnitsLibrarySample/Fictional.Measurements.Definitions/Definitions/Fictional.Measurements.unitsnet.relations.json
similarity index 100%
rename from UnitsNet.Modular/Samples/DefinitionPackages/Fictional.Measurements.Definitions/Definitions/Fictional.Measurements.unitsnet.relations.json
rename to UnitsNet.Modular/Samples/SharedUnitsLibrarySample/Fictional.Measurements.Definitions/Definitions/Fictional.Measurements.unitsnet.relations.json
diff --git a/UnitsNet.Modular/Samples/DefinitionPackages/Fictional.Measurements.Definitions/Definitions/HowMuch.unitsnet.json b/UnitsNet.Modular/Samples/SharedUnitsLibrarySample/Fictional.Measurements.Definitions/Definitions/HowMuch.unitsnet.json
similarity index 100%
rename from UnitsNet.Modular/Samples/DefinitionPackages/Fictional.Measurements.Definitions/Definitions/HowMuch.unitsnet.json
rename to UnitsNet.Modular/Samples/SharedUnitsLibrarySample/Fictional.Measurements.Definitions/Definitions/HowMuch.unitsnet.json
diff --git a/UnitsNet.Modular/Samples/DefinitionPackages/Fictional.Measurements.Definitions/Definitions/HowMuchDistance.unitsnet.json b/UnitsNet.Modular/Samples/SharedUnitsLibrarySample/Fictional.Measurements.Definitions/Definitions/HowMuchDistance.unitsnet.json
similarity index 100%
rename from UnitsNet.Modular/Samples/DefinitionPackages/Fictional.Measurements.Definitions/Definitions/HowMuchDistance.unitsnet.json
rename to UnitsNet.Modular/Samples/SharedUnitsLibrarySample/Fictional.Measurements.Definitions/Definitions/HowMuchDistance.unitsnet.json
diff --git a/UnitsNet.Modular/Samples/DefinitionPackages/Fictional.Measurements.Definitions/Fictional.Measurements.Definitions.csproj b/UnitsNet.Modular/Samples/SharedUnitsLibrarySample/Fictional.Measurements.Definitions/Fictional.Measurements.Definitions.csproj
similarity index 92%
rename from UnitsNet.Modular/Samples/DefinitionPackages/Fictional.Measurements.Definitions/Fictional.Measurements.Definitions.csproj
rename to UnitsNet.Modular/Samples/SharedUnitsLibrarySample/Fictional.Measurements.Definitions/Fictional.Measurements.Definitions.csproj
index beead72044..e305a16336 100644
--- a/UnitsNet.Modular/Samples/DefinitionPackages/Fictional.Measurements.Definitions/Fictional.Measurements.Definitions.csproj
+++ b/UnitsNet.Modular/Samples/SharedUnitsLibrarySample/Fictional.Measurements.Definitions/Fictional.Measurements.Definitions.csproj
@@ -4,6 +4,7 @@
latest
enable
enable
+ true
true
Fictional.Measurements.Definitions
1.0.0-alpha.1
@@ -14,9 +15,6 @@
README.md
unitsnet-modular definitions quantities units sample
-
-
-
enable
-
-
+
+
diff --git a/UnitsNet.Modular/Samples/ConsumerOwned/ConsumerOwned.Domain/MeasurementService.cs b/UnitsNet.Modular/Samples/SharedUnitsLibrarySample/SharedUnitsLibrarySample.Domain/MeasurementService.cs
similarity index 89%
rename from UnitsNet.Modular/Samples/ConsumerOwned/ConsumerOwned.Domain/MeasurementService.cs
rename to UnitsNet.Modular/Samples/SharedUnitsLibrarySample/SharedUnitsLibrarySample.Domain/MeasurementService.cs
index 0b878e5435..b2f10e4abd 100644
--- a/UnitsNet.Modular/Samples/ConsumerOwned/ConsumerOwned.Domain/MeasurementService.cs
+++ b/UnitsNet.Modular/Samples/SharedUnitsLibrarySample/SharedUnitsLibrarySample.Domain/MeasurementService.cs
@@ -3,7 +3,7 @@
using Fictional.Measurements;
using UnitsNet;
-namespace ConsumerOwned.Domain;
+namespace SharedUnitsLibrarySample.Domain;
public static class MeasurementService
{
diff --git a/UnitsNet.Modular/Samples/ConsumerOwned/ConsumerOwned.Domain/ConsumerOwned.Domain.csproj b/UnitsNet.Modular/Samples/SharedUnitsLibrarySample/SharedUnitsLibrarySample.Domain/SharedUnitsLibrarySample.Domain.csproj
similarity index 71%
rename from UnitsNet.Modular/Samples/ConsumerOwned/ConsumerOwned.Domain/ConsumerOwned.Domain.csproj
rename to UnitsNet.Modular/Samples/SharedUnitsLibrarySample/SharedUnitsLibrarySample.Domain/SharedUnitsLibrarySample.Domain.csproj
index 38099ba70e..0cf92367fd 100644
--- a/UnitsNet.Modular/Samples/ConsumerOwned/ConsumerOwned.Domain/ConsumerOwned.Domain.csproj
+++ b/UnitsNet.Modular/Samples/SharedUnitsLibrarySample/SharedUnitsLibrarySample.Domain/SharedUnitsLibrarySample.Domain.csproj
@@ -6,6 +6,6 @@
enable
-
+
diff --git a/UnitsNet.Modular/Samples/ConsumerOwned/ConsumerOwned.Units/ApplicationUnits.cs b/UnitsNet.Modular/Samples/SharedUnitsLibrarySample/SharedUnitsLibrarySample.Units/ApplicationUnits.cs
similarity index 87%
rename from UnitsNet.Modular/Samples/ConsumerOwned/ConsumerOwned.Units/ApplicationUnits.cs
rename to UnitsNet.Modular/Samples/SharedUnitsLibrarySample/SharedUnitsLibrarySample.Units/ApplicationUnits.cs
index d9a4f77357..774ddbeca7 100644
--- a/UnitsNet.Modular/Samples/ConsumerOwned/ConsumerOwned.Units/ApplicationUnits.cs
+++ b/UnitsNet.Modular/Samples/SharedUnitsLibrarySample/SharedUnitsLibrarySample.Units/ApplicationUnits.cs
@@ -3,7 +3,7 @@
using Fictional.Measurements.Definitions;
using UnitsNet.Modular;
-namespace ConsumerOwned.Units;
+namespace SharedUnitsLibrarySample.Units;
[UnitsNetModule]
internal interface ApplicationUnits :
diff --git a/UnitsNet.Modular/Samples/SharedUnitsLibrarySample/SharedUnitsLibrarySample.Units/SharedUnitsLibrarySample.Units.csproj b/UnitsNet.Modular/Samples/SharedUnitsLibrarySample/SharedUnitsLibrarySample.Units/SharedUnitsLibrarySample.Units.csproj
new file mode 100644
index 0000000000..9c6444ad2e
--- /dev/null
+++ b/UnitsNet.Modular/Samples/SharedUnitsLibrarySample/SharedUnitsLibrarySample.Units/SharedUnitsLibrarySample.Units.csproj
@@ -0,0 +1,30 @@
+
+
+ net10.0
+ latest
+ enable
+ enable
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/UnitsNet.Modular/Samples/UnitsNet.Modular.Compatibility.Generated.Sample/UnitsNet.Modular.Compatibility.Generated.Sample.csproj b/UnitsNet.Modular/Samples/UnitsNet.Modular.Compatibility.Generated.Sample/UnitsNet.Modular.Compatibility.Generated.Sample.csproj
deleted file mode 100644
index 3b419fe2ad..0000000000
--- a/UnitsNet.Modular/Samples/UnitsNet.Modular.Compatibility.Generated.Sample/UnitsNet.Modular.Compatibility.Generated.Sample.csproj
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
- Exe
- net10.0
- enable
- enable
- true
- $(BaseIntermediateOutputPath)Generated
-
-
-
-
-
-
-
-
diff --git a/UnitsNet.Modular/Samples/UnitsNet.Modular.Compatibility.Shared/Program.cs b/UnitsNet.Modular/Samples/UnitsNet.Modular.Compatibility.Shared/Program.cs
deleted file mode 100644
index c5b992ee35..0000000000
--- a/UnitsNet.Modular/Samples/UnitsNet.Modular.Compatibility.Shared/Program.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-// Licensed under MIT No Attribution, see LICENSE file at the root.
-
-namespace UnitsNet.Modular.Compatibility;
-
-internal static class Program
-{
- public static void Main() => Console.WriteLine(CompatibilityScenario.Run());
-}
diff --git a/UnitsNet.Modular/Samples/UnitsNet.Modular.Compatibility.UnitsNet.Sample/UnitsNet.Modular.Compatibility.UnitsNet.Sample.csproj b/UnitsNet.Modular/Samples/UnitsNet.Modular.Compatibility.UnitsNet.Sample/UnitsNet.Modular.Compatibility.UnitsNet.Sample.csproj
deleted file mode 100644
index 5e9fd3134f..0000000000
--- a/UnitsNet.Modular/Samples/UnitsNet.Modular.Compatibility.UnitsNet.Sample/UnitsNet.Modular.Compatibility.UnitsNet.Sample.csproj
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
- Exe
- net10.0
- enable
- enable
-
-
-
-
-
-
-
diff --git a/UnitsNet.Modular/Samples/UnitsNet.Modular.GettingStarted.Sample/UnitsNet.Modular.GettingStarted.Sample.csproj b/UnitsNet.Modular/Samples/UnitsNet.Modular.GettingStarted.Sample/UnitsNet.Modular.GettingStarted.Sample.csproj
deleted file mode 100644
index d596f6eb96..0000000000
--- a/UnitsNet.Modular/Samples/UnitsNet.Modular.GettingStarted.Sample/UnitsNet.Modular.GettingStarted.Sample.csproj
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
- Exe
- net10.0
- latest
- enable
- enable
- false
-
-
- true
-
-
-
-
-
-
- $(UnitsNetModularSampleLocalFeed)
-
-
-
-
-
diff --git a/UnitsNet.Modular/Samples/UnitsNet.Modular.LocalPackages.targets b/UnitsNet.Modular/Samples/UnitsNet.Modular.LocalPackages.targets
index 801e870958..289049d907 100644
--- a/UnitsNet.Modular/Samples/UnitsNet.Modular.LocalPackages.targets
+++ b/UnitsNet.Modular/Samples/UnitsNet.Modular.LocalPackages.targets
@@ -15,13 +15,12 @@
$(UnitsNetModularSampleUpdateLocalPackageOnBuild)
true
- false
+ Condition="'$(UnitsNetModularSampleUpdateLocalPackagesOnBuild)' == ''">true
<_UnitsNetModularSourceRoot>$(MSBuildThisFileDirectory)..\
<_UnitsNetModularSourceProject>$(_UnitsNetModularSourceRoot)UnitsNet.Modular\UnitsNet.Modular.csproj
- <_UnitsNetModularSampleLocalPackStamp>$(UnitsNetModularSampleLocalFeed)\.$(MSBuildProjectName).local-pack.stamp
+ <_UnitsNetModularSampleLocalPackStamp>$(UnitsNetModularSampleLocalFeed)\.UnitsNet.Modular.local-pack.stamp
+ <_UnitsNetModularSampleAdditionalLocalPackStamp>$(UnitsNetModularSampleLocalFeed)\.$(MSBuildProjectName).additional-local-pack.stamp
<_UnitsNetModularSampleLocalPackageVersion>6.0.0-local.dev.$([System.DateTime]::UtcNow.ToString('yyyyMMddHHmmssfff'))
@@ -41,23 +40,37 @@
<_UnitsNetModularLocalPackageInput Include="$(_UnitsNetModularSourceRoot)..\Docs\Images\logo-32.png" />
-
-
+
+
+
+ <_UnitsNetModularSamplePackagesUpdated>true
+
+
+
-
+
-
+
-
<_UnitsNetModularSamplePackagesUpdated>true
-
+
+
+
+
diff --git a/UnitsNet.Modular/Samples/UnitsNet.Modular.NuGet.Sample/HowMuch.unitsnet.json b/UnitsNet.Modular/Samples/UnitsNet.Modular.NuGet.Sample/HowMuch.unitsnet.json
deleted file mode 100644
index 516787e09f..0000000000
--- a/UnitsNet.Modular/Samples/UnitsNet.Modular.NuGet.Sample/HowMuch.unitsnet.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "Name": "HowMuch",
- "Namespace": "NuGetConsumer.Measurements",
- "BaseUnit": "Some",
- "Units": [
- {
- "SingularName": "Some",
- "PluralName": "Some",
- "FromUnitToBaseFunc": "{x}",
- "FromBaseToUnitFunc": "{x}",
- "Localization": [
- {
- "Culture": "en-US",
- "Abbreviations": [ "sm" ]
- }
- ]
- },
- {
- "SingularName": "Lots",
- "PluralName": "Lots",
- "FromUnitToBaseFunc": "{x} * 2",
- "FromBaseToUnitFunc": "{x} / 2",
- "Localization": [
- {
- "Culture": "en-US",
- "Abbreviations": [ "lots" ]
- }
- ]
- }
- ]
-}
diff --git a/UnitsNet.Modular/Samples/UnitsNet.Modular.NuGet.Sample/Program.cs b/UnitsNet.Modular/Samples/UnitsNet.Modular.NuGet.Sample/Program.cs
deleted file mode 100644
index 264c34b353..0000000000
--- a/UnitsNet.Modular/Samples/UnitsNet.Modular.NuGet.Sample/Program.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-// Licensed under MIT No Attribution, see LICENSE file at the root.
-
-using NuGetConsumer.Measurements;
-using UnitsNet;
-using UnitsNet.Modular;
-using UnitsNet.Units;
-using Catalog = UnitsNet.Modular.BuiltIns;
-
-namespace UnitsNet.Modular.NuGet.Sample;
-
-[QuantitySpec("NuGetConsumer.Measurements.HowMuch")]
-internal interface HowMuchSpec;
-
-[UnitsNetModule]
-internal interface ConsumerUnits : IInclude, IInclude;
-
-internal static class Program
-{
- public static void Main()
- {
- Length distance = Length.FromKilometers(2);
- HowMuch amount = HowMuch.Parse("10 lots");
-
- Console.WriteLine($"{distance} = {distance.ToUnit(LengthUnit.Meter)}");
- Console.WriteLine($"{amount} = {amount.ToUnit(HowMuchUnit.Some)}");
- }
-}
diff --git a/UnitsNet.Modular/Samples/UnitsNet.Modular.NuGet.Sample/UnitsNet.Modular.NuGet.Sample.csproj b/UnitsNet.Modular/Samples/UnitsNet.Modular.NuGet.Sample/UnitsNet.Modular.NuGet.Sample.csproj
deleted file mode 100644
index d153016607..0000000000
--- a/UnitsNet.Modular/Samples/UnitsNet.Modular.NuGet.Sample/UnitsNet.Modular.NuGet.Sample.csproj
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
- Exe
- net10.0
- latest
- enable
- enable
- false
-
-
- true
-
-
-
-
-
-
- $(UnitsNetModularSampleLocalFeed)
-
-
-
-
-
-
diff --git a/UnitsNet.Modular/Samples/UnitsNet.Modular.NuGet.Sample/run.ps1 b/UnitsNet.Modular/Samples/UnitsNet.Modular.NuGet.Sample/run.ps1
deleted file mode 100644
index e50ba1d987..0000000000
--- a/UnitsNet.Modular/Samples/UnitsNet.Modular.NuGet.Sample/run.ps1
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed under MIT No Attribution, see LICENSE file at the root.
-
-$ErrorActionPreference = 'Stop'
-
-$repositoryRoot = (Resolve-Path (Join-Path $PSScriptRoot '..\..\..')).Path
-$sampleProject = Join-Path $PSScriptRoot 'UnitsNet.Modular.NuGet.Sample.csproj'
-$restoreId = [DateTime]::UtcNow.ToString('yyyyMMddHHmmssfff')
-$restorePackages = Join-Path $repositoryRoot "Artifacts\UnitsNet.Modular.NuGet.Sample\packages\$restoreId"
-
-# The sample's local build dependency packs and restores the latest package before compilation.
-& dotnet run `
- --project $sampleProject `
- -p:ImportDirectoryBuildProps=false `
- -p:ImportDirectoryBuildTargets=false `
- "-p:RestorePackagesPath=$restorePackages"
-if ($LASTEXITCODE -ne 0) {
- throw "Running the NuGet sample failed."
-}
diff --git a/UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/UnitsNet.Modular.Playground.slnx b/UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/UnitsNet.Modular.Playground.slnx
deleted file mode 100644
index 1cc721a6c2..0000000000
--- a/UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/UnitsNet.Modular.Playground.slnx
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/UnitsNet.Modular/Samples/UnitsNet.Modular.Representative.Sample/Program.cs b/UnitsNet.Modular/Samples/UnitsNet.Modular.Representative.Sample/Program.cs
deleted file mode 100644
index c6609089a3..0000000000
--- a/UnitsNet.Modular/Samples/UnitsNet.Modular.Representative.Sample/Program.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-// Licensed under MIT No Attribution, see LICENSE file at the root.
-
-using UnitsNet;
-using UnitsNet.Modular;
-using UnitsNet.Units;
-using Catalog = UnitsNet.Modular.BuiltIns;
-
-namespace UnitsNet.Modular.Representative.Sample;
-
-[UnitsNetModule]
-internal interface RepresentativeUnits :
- IInclude,
- IInclude,
- IInclude,
- IInclude,
- IInclude,
- IInclude
-{
-}
-
-internal static class Program
-{
- public static void Main()
- {
- Length distance = Length.FromKilometers(1.2);
- Area floor = Length.FromMeters(2) * Length.FromMeters(3);
- Temperature room = Temperature.FromDegreesCelsius(21.5);
- TemperatureDelta adjustment = TemperatureDelta.FromDegreesCelsius(2);
- Level combined = Level.FromDecibels(10) + Level.FromDecibels(10);
- Information payload = Information.FromKibibytes(2);
-
- Console.WriteLine($"Distance: {distance}");
- Console.WriteLine($"Floor: {floor}");
- Console.WriteLine($"Room: {room.ToUnit(TemperatureUnit.DegreeFahrenheit)}");
- Console.WriteLine($"Adjusted room: {(room + adjustment).ToUnit(TemperatureUnit.DegreeCelsius)}");
- Console.WriteLine($"Combined level: {combined}");
- Console.WriteLine($"Payload: {payload.ToUnit(InformationUnit.Bit)}");
- }
-}
diff --git a/UnitsNet.Modular/Samples/UnitsNet.Modular.Representative.Sample/UnitsNet.Modular.Representative.Sample.csproj b/UnitsNet.Modular/Samples/UnitsNet.Modular.Representative.Sample/UnitsNet.Modular.Representative.Sample.csproj
deleted file mode 100644
index 0c24c1fa91..0000000000
--- a/UnitsNet.Modular/Samples/UnitsNet.Modular.Representative.Sample/UnitsNet.Modular.Representative.Sample.csproj
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
- Exe
- net10.0
- latest
- enable
- enable
- true
- $(BaseIntermediateOutputPath)Generated
-
-
-
-
-
-
diff --git a/UnitsNet.Modular/UnitsNet.Modular.Compatibility.Tests/CompatibilityTests.cs b/UnitsNet.Modular/UnitsNet.Modular.Compatibility.Tests/CompatibilityTests.cs
index a4bfae61a9..a96aa95813 100644
--- a/UnitsNet.Modular/UnitsNet.Modular.Compatibility.Tests/CompatibilityTests.cs
+++ b/UnitsNet.Modular/UnitsNet.Modular.Compatibility.Tests/CompatibilityTests.cs
@@ -433,7 +433,7 @@ public void GeneratedQuantity_LocalizedCustomFormattingMatchesUnitsNet()
}
[Fact]
- public void GeneratedRegistry_DescribesAndOperatesOnTheConsumerOwnedCatalog()
+ public void GeneratedRegistry_DescribesAndOperatesOnTheSelectedCatalog()
{
QuantityRegistry registry = Generated::UnitsNet.GeneratedQuantityRegistry.Instance;
diff --git a/UnitsNet.Modular/Samples/UnitsNet.Modular.Compatibility.Generated.Sample/GeneratedModule.cs b/UnitsNet.Modular/UnitsNet.Modular.Compatibility.Tests/Fixtures/Generated/GeneratedModule.cs
similarity index 100%
rename from UnitsNet.Modular/Samples/UnitsNet.Modular.Compatibility.Generated.Sample/GeneratedModule.cs
rename to UnitsNet.Modular/UnitsNet.Modular.Compatibility.Tests/Fixtures/Generated/GeneratedModule.cs
diff --git a/UnitsNet.Modular/Samples/UnitsNet.Modular.AllSi.Sample/UnitsNet.Modular.AllSi.Sample.csproj b/UnitsNet.Modular/UnitsNet.Modular.Compatibility.Tests/Fixtures/Generated/UnitsNet.Modular.Compatibility.GeneratedFixture.csproj
similarity index 64%
rename from UnitsNet.Modular/Samples/UnitsNet.Modular.AllSi.Sample/UnitsNet.Modular.AllSi.Sample.csproj
rename to UnitsNet.Modular/UnitsNet.Modular.Compatibility.Tests/Fixtures/Generated/UnitsNet.Modular.Compatibility.GeneratedFixture.csproj
index 0c24c1fa91..67cc651806 100644
--- a/UnitsNet.Modular/Samples/UnitsNet.Modular.AllSi.Sample/UnitsNet.Modular.AllSi.Sample.csproj
+++ b/UnitsNet.Modular/UnitsNet.Modular.Compatibility.Tests/Fixtures/Generated/UnitsNet.Modular.Compatibility.GeneratedFixture.csproj
@@ -1,16 +1,15 @@
- Exe
net10.0
- latest
enable
enable
true
$(BaseIntermediateOutputPath)Generated
-
-
+
+
diff --git a/UnitsNet.Modular/UnitsNet.Modular.Compatibility.Tests/Fixtures/Legacy/UnitsNet.Modular.Compatibility.LegacyFixture.csproj b/UnitsNet.Modular/UnitsNet.Modular.Compatibility.Tests/Fixtures/Legacy/UnitsNet.Modular.Compatibility.LegacyFixture.csproj
new file mode 100644
index 0000000000..e90ab931c7
--- /dev/null
+++ b/UnitsNet.Modular/UnitsNet.Modular.Compatibility.Tests/Fixtures/Legacy/UnitsNet.Modular.Compatibility.LegacyFixture.csproj
@@ -0,0 +1,11 @@
+
+
+ net10.0
+ enable
+ enable
+
+
+
+
+
+
diff --git a/UnitsNet.Modular/Samples/UnitsNet.Modular.Compatibility.Shared/CompatibilityScenario.cs b/UnitsNet.Modular/UnitsNet.Modular.Compatibility.Tests/Fixtures/Shared/CompatibilityScenario.cs
similarity index 100%
rename from UnitsNet.Modular/Samples/UnitsNet.Modular.Compatibility.Shared/CompatibilityScenario.cs
rename to UnitsNet.Modular/UnitsNet.Modular.Compatibility.Tests/Fixtures/Shared/CompatibilityScenario.cs
diff --git a/UnitsNet.Modular/UnitsNet.Modular.Compatibility.Tests/UnitsNet.Modular.Compatibility.Tests.csproj b/UnitsNet.Modular/UnitsNet.Modular.Compatibility.Tests/UnitsNet.Modular.Compatibility.Tests.csproj
index 7b27962f66..884277a7de 100644
--- a/UnitsNet.Modular/UnitsNet.Modular.Compatibility.Tests/UnitsNet.Modular.Compatibility.Tests.csproj
+++ b/UnitsNet.Modular/UnitsNet.Modular.Compatibility.Tests/UnitsNet.Modular.Compatibility.Tests.csproj
@@ -12,10 +12,14 @@
-
+
+
+
+
+
Generated
-
+
LegacyScenario
diff --git a/UnitsNet.Modular/UnitsNet.Modular.slnx b/UnitsNet.Modular/UnitsNet.Modular.slnx
deleted file mode 100644
index 3d90c79629..0000000000
--- a/UnitsNet.Modular/UnitsNet.Modular.slnx
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/UnitsNet.slnx b/UnitsNet.slnx
index 2ad01169b1..2a28e31d84 100644
--- a/UnitsNet.slnx
+++ b/UnitsNet.slnx
@@ -14,6 +14,7 @@
+