Coder Social home page Coder Social logo

thomaslevesque / internalsvisibleto.msbuild Goto Github PK

View Code? Open in Web Editor NEW
28.0 4.0 7.0 22 KB

Enables declaring 'InternalsVisibleTo' items in a .NET project file, rather than declaring them to an AssemblyInfo.cs file.

License: MIT License

internalsvisibleto assemblyinfo msbuild csproj vbproj fsproj dotnet

internalsvisibleto.msbuild's Introduction

InternalsVisibleTo.MSBuild

NuGet version

Enables declaring InternalsVisibleTo items in a .NET project file, rather than declaring them in an AssemblyInfo.cs file.

IMPORTANT: starting with .NET 5.0, the SDK already provides support for this. You don't need this package if you're using the .NET 5.0 SDK or later.

How to use

  1. Install the InternalsVisibleTo.MSBuild NuGet package.

  2. Edit your csproj file and add <InternalsVisibleTo> items in your project for each assembly that should have access to the internals of the current project:

      <ItemGroup>
        <InternalsVisibleTo Include="$(AssemblyName).UnitTests" />
        <InternalsVisibleTo Include="SomeOtherAssembly" />
        <InternalsVisibleTo Include="StronglyNamedAssembly, PublicKey=0123....." />
      </ItemGroup>

    This will generate the appropriate InternalsVisibleTo attributes for your assembly.

    Alternatively, you can also use <InternalsVisibleToSuffix> to specify that assemblies named $(AssemblyName).<suffix> will have access to the internals of the current project:

      <ItemGroup>
        <!-- $(AssemblyName).UnitTests will have access to the internals of this project -->
        <InternalsVisibleToSuffix Include=".UnitTests" />
      </ItemGroup>

Note

In fact, it's already possible to declare InternalsVisibleTo attributes in the project file without this package, but the syntax is ugly and hard to remember:

  <ItemGroup>
    <AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
      <_Parameter1>SomeOtherAssembly</_Parameter1>
    </AssemblyAttribute>
  </ItemGroup>

This package just makes things easier by transforming <InternalsVisibleTo> elements into appropriate <AssemblyAttribute> elements.

internalsvisibleto.msbuild's People

Contributors

maples7 avatar meziantou avatar rsking avatar thieum avatar thomaslevesque avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

internalsvisibleto.msbuild's Issues

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.