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
4 changes: 4 additions & 0 deletions Polyfill.targets
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<Project>
<PropertyGroup Condition="'$(EnableTUnitPolyfills)' != 'false'">
<PolyUseEmbeddedAttribute>true</PolyUseEmbeddedAttribute>
</PropertyGroup>

<ItemGroup Condition="'$(EnableTUnitPolyfills)' != 'false'">
<PackageReference Include="Polyfill">
<PrivateAssets>all</PrivateAssets>
Expand Down
4 changes: 4 additions & 0 deletions Roslyn.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<Project>

<PropertyGroup>
<PolyUseEmbeddedAttribute>true</PolyUseEmbeddedAttribute>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Common" VersionOverride="$(RoslynVersion).*"/>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" VersionOverride="$(RoslynVersion).*"/>
Expand Down
2 changes: 2 additions & 0 deletions TUnit.Core/TUnit.Core.props
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
<PropertyGroup>
<!-- Default to enabling polyfills for older frameworks -->
<EnableTUnitPolyfills Condition="'$(EnableTUnitPolyfills)' == '' and ('$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netstandard2.1' or '$(TargetFrameworkIdentifier)' == '.NETFramework')">true</EnableTUnitPolyfills>
<!-- Use embedded Polyfill attributes to prevent type conflicts across projects -->
<PolyUseEmbeddedAttribute Condition="'$(PolyUseEmbeddedAttribute)' == ''">true</PolyUseEmbeddedAttribute>
</PropertyGroup>

<PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/assertions/collections.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ public async Task All_Items_Match()

#### With Satisfy

The single parameter overload will match T from IEnumerable<T> - Giving you the relevant assertions for that type.
The single parameter overload will match T from `IEnumerable<T>` - Giving you the relevant assertions for that type.

```csharp
[Test]
Expand Down
5 changes: 5 additions & 0 deletions docs/docs/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,8 @@ TUnit is fully compatible with NuGet Central Package Management. When CPM is ena
If you prefer to manage the Polyfill version yourself, you can:
- Add `<PackageVersion Include="Polyfill" Version="x.x.x" />` to your `Directory.Packages.props`, OR
- Disable automatic injection with `<EnableTUnitPolyfills>false</EnableTUnitPolyfills>` and add it manually

### Embedded Polyfill Attributes
TUnit automatically sets `<PolyUseEmbeddedAttribute>true</PolyUseEmbeddedAttribute>` to ensure that Polyfill types are embedded in each project. This prevents type conflicts when using `InternalsVisibleTo` or when multiple projects in your solution reference Polyfill. Each project gets its own isolated copy of the polyfill types, following the [recommended Polyfill consuming pattern](https://github.com/SimonCropp/Polyfill/blob/main/consuming.md#recommended-consuming-pattern).

You can override this behavior by setting `<PolyUseEmbeddedAttribute>false</PolyUseEmbeddedAttribute>` in your project file if needed.
Loading