Giter VIP home page Giter VIP logo

absence.fody's Introduction

Absence.Fody

NuGet package License

This is an add-in for Fody which lets you trim unused private/internal types during compile-time.

This project has a dependency to Emik.Morsels, if you are building this project, refer to its README first.



Installation

  • Install the NuGet packages Fody and Absence.Fody. Installing Fody explicitly is needed to enable weaving.

    PM> Install-Package Fody
    PM> Install-Package Absence.Fody
    
  • Add the PrivateAssets="all" metadata attribute to the <PackageReference /> items of Fody and Absence.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 <Absence /> tag there. This file will be created on the first build if it doesn't exist:

<Weavers>
    <Absence />
</Weavers>

See Fody usage for general guidelines, and Fody Configuration for additional options.

Configuration

You can add an Except attribute to exclude namespaces or types separated by any amount of whitespace:

<Weavers>
    <Absence Exclude="Foo DoNotExcludeMe
                      Do.Not.Exclude.Me" />
</Weavers>

Types may either be fully qualified, or not at all. Partially qualified names are not supported due to potential ambiguity.

Example

What you write:

public class Public 
{
    public class NestedPublic { }
    
    [ImplicitlyUsed]
    class NestedPrivateWithAttribute { }
    
    class NestedPrivate { }
}

[ImplicitlyUsed]
class InternalWithAttribute
{
    public class NestedPublic { }
    
    [ImplicitlyUsed]
    class NestedPrivateWithAttribute { }
    
    class NestedPrivate { }
}

class Internal 
{
    public class NestedPublic { }
    
    [ImplicitlyUsed]
    class NestedPrivateWithAttribute { }
    
    class NestedPrivate { }
}

What gets compiled:

public class Public 
{
    public class NestedPublic { }
    
    [ImplicitlyUsed]
    class NestedPrivateWithAttribute { }
}

[ImplicitlyUsed]
class InternalWithAttribute
{
    public class NestedPublic { }
    
    [ImplicitlyUsed]
    class NestedPrivateWithAttribute { }
}

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.

absence.fody's People

Contributors

emik03 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.