All Projects → devlooped → ThisAssembly

devlooped / ThisAssembly

Licence: MIT license
Exposes project and assembly level information as constants in the ThisAssembly class using source generators powered by Roslyn.

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to ThisAssembly

Scriptcs
Write C# apps with a text editor, nuget and the power of Roslyn!
Stars: ✭ 2,343 (+1021.05%)
Mutual labels:  roslyn
Norns
dotnet core aop static weaving on roslyn
Stars: ✭ 23 (-89%)
Mutual labels:  roslyn
icsharp.kernel
Roslyn based C# kernel for Jupyter Notebook
Stars: ✭ 26 (-87.56%)
Mutual labels:  roslyn
Roslyn Security Guard
Roslyn analyzers that aim to help security audit on .NET applications.
Stars: ✭ 214 (+2.39%)
Mutual labels:  roslyn
Platform Compat
Roslyn analyzer that finds usages of APIs that will throw PlatformNotSupportedException on certain platforms.
Stars: ✭ 250 (+19.62%)
Mutual labels:  roslyn
spreadcheetah
SpreadCheetah is a high-performance .NET library for generating spreadsheet (Microsoft Excel XLSX) files.
Stars: ✭ 107 (-48.8%)
Mutual labels:  csharp-sourcegenerator
Bridge
♠️ C# to JavaScript compiler. Write modern mobile and web apps in C#. Run anywhere with Bridge.NET.
Stars: ✭ 2,216 (+960.29%)
Mutual labels:  roslyn
Cometary
Roslyn extensions, with a touch of meta-programming.
Stars: ✭ 31 (-85.17%)
Mutual labels:  roslyn
DpdtInject
Highly efficient compile-time general purpose DI container based on C# source generators.
Stars: ✭ 25 (-88.04%)
Mutual labels:  csharp-sourcegenerator
Vogen
A semi-opinionated library which is a source generator and a code analyser. It Source generates Value Objects
Stars: ✭ 240 (+14.83%)
Mutual labels:  csharp-sourcegenerator
Retyped
Access 3600+ libraries from C# and let Bridge.NET compile your project into JavaScript.
Stars: ✭ 216 (+3.35%)
Mutual labels:  roslyn
Roslyn
The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
Stars: ✭ 15,296 (+7218.66%)
Mutual labels:  roslyn
Analyzers
C# code analyzers
Stars: ✭ 18 (-91.39%)
Mutual labels:  roslyn
Seriloganalyzer
Roslyn-based analysis for code using the Serilog logging library. Checks for common mistakes and usage problems.
Stars: ✭ 214 (+2.39%)
Mutual labels:  roslyn
DynamicRun
Dynamically run code using .NET 7, Roslyn and AssemblyLoadContext
Stars: ✭ 83 (-60.29%)
Mutual labels:  roslyn
Pluginframework
Everything is a Plugin in .NET
Stars: ✭ 197 (-5.74%)
Mutual labels:  roslyn
AutoInterface
C# interface-to-member source generator
Stars: ✭ 47 (-77.51%)
Mutual labels:  csharp-sourcegenerator
JsonByExampleGenerator
Generate classes based on example json files in your project. Uses a C# 9 source generator.
Stars: ✭ 55 (-73.68%)
Mutual labels:  csharp-sourcegenerator
code-contracts-remover
tool for removing .net code contracts from project
Stars: ✭ 13 (-93.78%)
Mutual labels:  roslyn
Avalonia.PropertyGenerator
Avalonia.PropertyGenerator generates the appropriate CLR members for Avalonia property definitions.
Stars: ✭ 20 (-90.43%)
Mutual labels:  roslyn

Icon ThisAssembly

Version Downloads License Build

Exposes project and assembly level information as constants in the ThisAssembly class using source generators powered by Roslyn.

The main generated entry point type is ThisAssembly in the global namespace, and is declared as partial so you can extend it too with manually created members.

Each package in turn extends this partial class too to add their own constants.

The ThisAssembly meta-package includes all the other packages for convenience.

NOTE: as of .NET 5.0, only C# is supported for source generators.

ThisAssembly.AssemblyInfo

Version Downloads

This package generates a static ThisAssembly.Info class with public constants exposing the following attribute values generated by default for SDK style projects:

  • AssemblyConfigurationAttribute

  • AssemblyCompanyAttribute

  • AssemblyTitleAttribute

  • AssemblyDescriptionAttribute

  • AssemblyProductAttribute

  • AssemblyCopyrightAttribute

  • AssemblyVersionAttribute

  • AssemblyInformationalVersionAttribute

  • AssemblyFileVersionAttribute

If your project includes these attributes by other means, they will still be emitted properly on the ThisAssembly.Info class.

ThisAssembly.Constants

Version Downloads

This package generates a static ThisAssembly.Constants class with public constants for @(Constant) MSBuild items in the project.

In addition to arbitrary constants via <Constant ...>, it's quite useful in particular in test projects, to generate constants for files in the project, so there's also a shorthand for those:

  <ItemGroup>
    <FileConstant Include="@(Content)" />
  </ItemGroup>

Which results in:

ThisAssembly.Metadata

Version Downloads

This package provides a static ThisAssembly.Metadata class with public constants exposing each [System.Reflection.AssemblyMetadata(..)] defined for the project.

For an attribute declared (i.e. in AssemblyInfo.cs) like:

  [assembly: System.Reflection.AssemblyMetadataAttribute("Foo", "Bar")]

A corresponding ThisAssembly.Metadata.Foo constant with the value Bar is provided. The metadata attribute can alternatively be declared using MSBuild syntax in the project (for .NET 5.0+ projects that have built-in support for @(AssemblyMetadata) items):

    <ItemGroup>
      <AssemblyMetadata Include="Foo" Value="Bar" />
    </ItemGroup>

ThisAssembly.Project

Version Downloads

This package generates a static ThisAssembly.Project class with public constants exposing project properties that have been opted into this mechanism by adding them as ProjectProperty MSBuild items in project file, such as:

  <PropertyGroup>
    <Foo>Bar</Foo>
  </PropertyGroup>
  <ItemGroup>
    <ProjectProperty Include="Foo" />
  </ItemGroup>

ThisAssembly.Resources

Version Downloads

This package generates a static ThisAssembly.Resources class with public properties exposing shortcuts to retrieve the contents of embedded resources.

  <ItemGroup>
    <EmbeddedResource Include="Content/Docs/License.md" />
  </ItemGroup>

ThisAssembly.Strings

Version Downloads

This package generates a static ThisAssembly.Strings class with public constants exposing string resources in .resx files or methods with the right number of parameters for strings that use formatting parameters.

In addition, it groups constants and methods in nested classes according to an optional underscore separator to organize strings. For example, User_InvalidCredentials can be accessed with ThisAssembly.Strings.User.InvalidCredentials if it contains a simple string, or as a method with the right number of parametres if its value has a format string.

Given the following Resx file:

Name Value Comment
Infrastructure_MissingService Service {0} is required. For logging only!
Shopping_NoShipping We cannot ship {0} to {1}.
Shopping_OutOfStock Product is out of stock at this time.

The following code would be generated:

partial class ThisAssembly
{
    public static partial class Strings
    {
        public static partial class Infrastructure
        {
            /// <summary>
            /// For logging only!
            /// => "Service {0} is required."
            /// </summary>
            public static string MissingService(object arg0)
                => string.Format(CultureInfo.CurrentCulture, 
                    Strings.GetResourceManager("ThisStore.Properties.Resources").GetString("MissingService"), 
                    arg0);
        }

        public static partial class Shopping
        {
            /// <summary>
            /// => "We cannot ship {0} to {1}."
            /// </summary>
            public static string NoShipping(object arg0, object arg1)
                => string.Format(CultureInfo.CurrentCulture, 
                    Strings.GetResourceManager("ThisStore.Properties.Resources").GetString("NoShipping"), 
                    arg0, arg1);

            /// <summary>
            /// => "Product is out of stock at this time."
            /// </summary>
            public static string OutOfStock
                => Strings.GetResourceManager("ThisStore.Properties.Resources").GetString("OutOfStock");
        }
    }
}

Dogfooding

CI Version Build

We also produce CI packages from branches and pull requests so you can dogfood builds as quickly as they are produced.

The CI feed is https://pkg.kzu.io/index.json.

The versioning scheme for packages is:

  • PR builds: 42.42.42-pr[NUMBER]
  • Branch builds: 42.42.42-[BRANCH].[COMMITS]

Sponsors

sponsors  by @clarius sponsors

get mentioned here too!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].