ThisAssembly.Strings    1.5.0 
                            
                                  前缀保留 
                    dotnet add package ThisAssembly.Strings --version 1.5.0
NuGet\Install-Package ThisAssembly.Strings -Version 1.5.0
         此命令设计用于在 Visual Studio 的包管理器控制台中使用,因为它使用了 NuGet 模块的 Install-Package 版本。
    <PackageReference Include="ThisAssembly.Strings" Version="1.5.0"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
         对于支持 PackageReference 的项目,请将此 XML 节复制到项目文件中以引用该包。
    paket add ThisAssembly.Strings --version 1.5.0
          NuGet 团队不提供对客户端的支持。请联系其 维护者 以获取支持。
    #r "nuget: ThisAssembly.Strings, 1.5.0"
         #r 指令可以在 F# Interactive 和 Polyglot Notebooks 中使用。将此复制到交互式工具或脚本的源代码中,以引用包。
    // Install ThisAssembly.Strings as a Cake Addin #addin nuget:?package=ThisAssembly.Strings&version=1.5.0 // Install ThisAssembly.Strings as a Cake Tool #tool nuget:?package=ThisAssembly.Strings&version=1.5.0
          NuGet 团队不提供对客户端的支持。请联系其 维护者 以获取支持。
    此包生成一个静态的 ThisAssembly.Strings 类,其中包含公开常量,用于暴露 .resx 文件中的字符串资源或具有正确参数数量的方法,用于使用格式参数的字符串。

此外,它会根据可选的下划线分隔符将常量和方法分组在嵌套类中,以对字符串进行组织。例如,可以访问 User_InvalidCredentials,方式为 ThisAssembly.Strings.User.InvalidCredentials,如果它包含简单字符串,如果其值具有格式字符串,则作为带有正确参数数量的方法。
给定以下 Resx 文件
| 名称 | 值 | 注释 | 
|---|---|---|
| Infrastructure_MissingService | 需要服务 {0}。 | 仅供记录日志使用! | 
| Shopping_NoShipping | 我们无法将 {0} 发送到 {1}。 | |
| Shopping_OutOfStock | 此时产品已缺货。 | |
| Shopping_AvailableOn | 产品在 {date:yyyy-MM} 可用。 | 
将生成以下代码
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");
            /// <summary>
            /// Product available on {date:yyyy-MM}.
            /// </summary>
            public static string AvailableOn(object date) 
                => string.Format(CultureInfo.CurrentCulture, 
                    Strings.GetResourceManager("ThisAssemblyTests.Resources").GetString("WithNamedFormat").Replace("{date:yyyy-MM}", "{0}"), 
                    ((IFormattable)date).ToString("yyyy-MM", CultureInfo.CurrentCulture));
        }
    }
}
将MSBuild属性$(ThisAssemblyNamespace)设置为生成的ThisAssembly类的根命名空间。否则,它将在全局命名空间中生成。
赞助商
| 产品 | 版本 兼容的且额外计算的目标框架版本。 | 
|---|---|
| .NET | |
| .NET Core | |
| .NET Standard | |
| .NET Framework | net461 已计算。 net462 已计算。 net463 已计算。 net47 已计算。 net471 已计算。 net472 已计算。 net48 已计算。 net481 已计算。 | 
| MonoAndroid | monoandroid 已计算。 | 
| MonoMac | monomac 已计算。 | 
| MonoTouch | monotouch 已计算。 | 
| Tizen | tizen40 已计算。 tizen60 已计算。 | 
| Xamarin.iOS | xamarinios 已计算。 | 
| Xamarin.Mac | xamarinmac 已计算。 | 
| Xamarin.TVOS | xamarintvos 已计算。 | 
| Xamarin.WatchOS | xamarinwatchos 已计算。 | 
- 
                                                    .NETStandard 2.0- Microsoft.CSharp (≥ 4.7.0)
- System.Threading.Tasks.Extensions (≥ 4.5.4)
 
NuGet 包 (1)
显示依赖于 ThisAssembly.Strings 的顶级 1 个 NuGet 包
| 包 | 下载 | 
|---|---|
| ThisAssembly 包含所有 ThisAssembly.* 包的元包。 | 
GitHub 仓库 (1)
显示依赖于 ThisAssembly.Strings 的顶级 1 个流行的 GitHub 仓库
| 仓库 | 星星 | 
|---|---|
| devlooped/nugetizer 
                                                            为编写 NuGet 包提供的一种简单易懂的打包模型
                                                         | 
| 版本 | 下载 | 最后更新 | 
|---|---|---|
| 1.5.0 | 547 | 7/24/2024 | 
| 1.5.0-rc.4 | 39 | 7/24/2024 | 
| 1.5.0-rc.3 | 38 | 7/23/2024 | 
| 1.5.0-rc.2 | 38 | 7/23/2024 | 
| 1.5.0-rc.1 | 51 | 7/21/2024 | 
| 1.5.0-rc | 96 | 7/8/2024 | 
| 1.5.0-beta | 90 | 7/8/2024 | 
| 1.4.3 | 8,371 | 1/30/2024 | 
| 1.4.2 | 92 | 1/30/2024 | 
| 1.4.1 | 3,423 | 8/30/2023 | 
| 1.4.0 | 849 | 8/11/2023 | 
| 1.1.3 | 1,424 | 1/10/2023 | 
| 1.1.2 | 463 | 1/10/2023 | 
| 1.1.1 | 704 | 1/6/2023 | 
| 1.1.1-beta | 143 | 1/6/2023 | 
| 1.1.0 | 811 | 12/31/2022 | 
| 1.0.10 | 3,825 | 10/18/2022 | 
| 1.0.9 | 19,994 | 10/21/2021 | 
| 1.0.8 | 5,872 | 4/29/2021 | 
| 1.0.7 | 2,643 | 3/16/2021 | 
| 1.0.6 | 1,063 | 3/9/2021 | 
| 1.0.5 | 1,000 | 1/30/2021 | 
| 1.0.4 | 539 | 1/27/2021 | 
| 1.0.3 | 1,523 | 12/15/2020 | 
| 1.0.2 | 670 | 12/10/2020 | 
| 1.0.1 | 639 | 12/10/2020 | 
| 1.0.0 | 2,531 | 11/21/2020 | 
| 1.0.0-rc.1 | 1,425 | 10/28/2020 | 
| 1.0.0-rc | 728 | 10/23/2020 | 
| 1.0.0-beta | 1,048 | 10/15/2020 | 
| 1.0.0-alpha.3 | 357 | 10/8/2020 | 
| 1.0.0-alpha.2 | 239 | 10/8/2020 | 
| 1.0.0-alpha.1 | 250 | 10/8/2020 | 
| 1.0.0-alpha | 1,001 | 10/3/2020 | 
| 0.10.6 | 828 | 9/22/2020 | 
| 0.10.5 | 591 | 9/21/2020 | 



































