https://github.com/emik03/divorce.fody
Moves nullable constraints to comply with older Mono frameworks (e.g. Unity 2017) allowing you to use NRTs.
https://github.com/emik03/divorce.fody
Last synced: 6 months ago
JSON representation
Moves nullable constraints to comply with older Mono frameworks (e.g. Unity 2017) allowing you to use NRTs.
- Host: GitHub
- URL: https://github.com/emik03/divorce.fody
- Owner: Emik03
- License: mpl-2.0
- Created: 2022-11-28T10:47:27.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-01-01T10:50:32.000Z (over 1 year ago)
- Last Synced: 2025-09-06T20:54:11.992Z (11 months ago)
- Language: C#
- Size: 58.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Divorce.Fody
[](https://www.nuget.org/packages/Divorce.Fody)
[](https://github.com/Emik03/Divorce.Fody/blob/main/LICENSE)
This is an add-in for [Fody](https://github.com/Fody/Fody) which lets you use Nullable Reference Types in older Mono frameworks (e.g. Unity 2017). Named after an antonym of Unity, since this project bends libraries to conform it.
This project has a dependency to [Emik.Morsels](https://github.com/Emik03/Emik.Morsels), if you are building this project, refer to its [README](https://github.com/Emik03/Emik.Morsels/blob/main/README.md) first.
---
- [Installation](#installation)
- [Example](#example)
- [Contribute](#contribute)
- [License](#license)
---
## Installation
- Install the NuGet packages [`Fody`](https://www.nuget.org/packages/Fody) and [`Divorce.Fody`](https://www.nuget.org/packages/Divorce.Fody). Installing `Fody` explicitly is needed to enable weaving.
```
PM> Install-Package Fody
PM> Install-Package Divorce.Fody
```
- Add the `PrivateAssets="all"` metadata attribute to the `` items of `Fody` and `Divorce.Fody` in your project file, so they won't be listed as dependencies.
- If you already have a `FodyWeavers.xml` file in the root directory of your project, add the `` tag there. This file will be created on the first build if it doesn't exist:
```xml
```
See [Fody usage](https://github.com/Fody/Home/blob/master/pages/usage.md) for general guidelines, and [Fody Configuration](https://github.com/Fody/Home/blob/master/pages/configuration.md) for additional options.
## Example
What you write:
```csharp
#nullable enable
interface I { }
class C : I { }
class D where T : C { }
```
What gets compiled:
```csharp
#nullable enable
interface I { }
class C :
#nullable disable
I
#nullable enable
{ }
class D where T :
#nullable disable
C
#nullable enable
{ }
```
## Contribute
Issues and pull requests are welcome to help this repository be the best it can be.
## License
This repository falls under the [MPL-2 license](https://www.mozilla.org/en-US/MPL/2.0/).