Microsoft.Data.Tools.StringResourceTool
2.0.0
String Resource Tool creates C# wrapper classes for managed string resources. The app developer creates a .strings file to declare the list of strings.
Each line includes the name of the string and its list of parameters.
For example:
ConnectionFailure(server) = Failed to connect to server {0}.
The above line creates the following entry in the wrapper class:
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class StringConnectionInfo
{
public static string ConnectionFailure(string server)
{
return Keys.GetString(Keys.ConnectionFailure, server);
}
}
The package includes a targets file for incorporating srgen into an msbuild-based development project and a sample strings file.
See the version list below for details.
Install-Package Microsoft.Data.Tools.StringResourceTool -Version 2.0.0
dotnet add package Microsoft.Data.Tools.StringResourceTool --version 2.0.0
<PackageReference Include="Microsoft.Data.Tools.StringResourceTool" Version="2.0.0" />
paket add Microsoft.Data.Tools.StringResourceTool --version 2.0.0
This package is no longer packaged as a dotnet tool. We will update the sample usage on github.com.
Instead of invoking slngen, invoke dotnet against the appropriate version of the DLL and use a PackageReference.
<PackageReference Include="Microsoft.Data.Tools.StringResourceTool" Version="2.0.0" GeneratePathProperty="true" >
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<ItemDefinitionGroup>
<Sqlstringresource>
<namespace Condition="'$(rootnamespace)'!='' and '%(namespace)' == ''">$(rootnamespace)</namespace>
<namespace Condition="'$(rootnamespace)'=='' and '%(namespace)' == ''">%(filename)</namespace>
<outresxfilename Condition="'%(outresxfilename)'==''">%(filename)</outresxfilename>
<outcodefilename Condition="'%(outcodefilename)'==''">%(filename)</outcodefilename>
<outclassname Condition="'%(outclassname)'==''">%(filename)</outclassname>
<resourcename Condition="'%(resourcename)'==''">%(namespace)</resourcename>
<resourcename Condition="'%(resourcename)'!=''">%(resourcename)</resourcename>
<additionaloptions Condition="'%(additionaloptions)'==''"></additionaloptions>
</Sqlstringresource>
</ItemDefinitionGroup>
<Target Name="sqlconvertstringresources"
BeforeTargets="AssignTargetPaths"
Inputs="$(MSBuildThisFileFullPath);@(Sqlstringresource)"
Outputs="@(Sqlstringresource->'$(IntermediateOutputPath)%(outcodefilename).cs');@(sqlstringresource->'$(IntermediateOutputPath)%(outresxfilename).resx')"
Condition="'@(Sqlstringresource)'!=''">
<MakeDir Directories="$(IntermediateOutputPath)" />
<Message Importance="high" Text="dotnet $(PkgMicrosoft_Data_Tools_StringResourceTool)\lib\netcoreapp2.2\srgen.dll -or $(IntermediateOutputPath)%(sqlstringresource.outresxfilename).resx -oc $(IntermediateOutputPath)%(sqlstringresource.outcodefilename).cs -ns %(sqlstringresource.namespace) -cn %(sqlstringresource.outclassname) -l CS %(sqlstringresource.additionaloptions) %(sqlstringresource.fullpath)" />
<Exec Command="dotnet $(PkgMicrosoft_Data_Tools_StringResourceTool)\lib\netcoreapp2.2\srgen.dll -or $(IntermediateOutputPath)%(sqlstringresource.outresxfilename).resx -oc $(IntermediateOutputPath)%(sqlstringresource.outcodefilename).cs -ns %(sqlstringresource.namespace) -cn %(sqlstringresource.outclassname) -l CS %(sqlstringresource.additionaloptions) %(sqlstringresource.fullpath)" />
<ItemGroup>
<EmbeddedResource Include="$(IntermediateOutputPath)%(sqlstringresource.outresxfilename).resx">
<LogicalName Condition="'%(Sqlstringresource.logicalname)'!=''">%(Sqlstringresource.logicalname)</LogicalName>
<ManifestResourceName>%(Sqlstringresource.resourcename).%(Sqlstringresource.outclassname)</ManifestResourceName>
</EmbeddedResource>
<Compile Include="$(IntermediateOutputPath)%(Sqlstringresource.outcodefilename).cs" />
</ItemGroup>
</Target>
This package is no longer packaged as a dotnet tool. We will update the sample usage on github.com.
Instead of invoking slngen, invoke dotnet against the appropriate version of the DLL and use a PackageReference.
<PackageReference Include="Microsoft.Data.Tools.StringResourceTool" Version="2.0.0" GeneratePathProperty="true" >
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<ItemDefinitionGroup>
<Sqlstringresource>
<namespace Condition="'$(rootnamespace)'!='' and '%(namespace)' == ''">$(rootnamespace)</namespace>
<namespace Condition="'$(rootnamespace)'=='' and '%(namespace)' == ''">%(filename)</namespace>
<outresxfilename Condition="'%(outresxfilename)'==''">%(filename)</outresxfilename>
<outcodefilename Condition="'%(outcodefilename)'==''">%(filename)</outcodefilename>
<outclassname Condition="'%(outclassname)'==''">%(filename)</outclassname>
<resourcename Condition="'%(resourcename)'==''">%(namespace)</resourcename>
<resourcename Condition="'%(resourcename)'!=''">%(resourcename)</resourcename>
<additionaloptions Condition="'%(additionaloptions)'==''"></additionaloptions>
</Sqlstringresource>
</ItemDefinitionGroup>
<Target Name="sqlconvertstringresources"
BeforeTargets="AssignTargetPaths"
Inputs="$(MSBuildThisFileFullPath);@(Sqlstringresource)"
Outputs="@(Sqlstringresource->'$(IntermediateOutputPath)%(outcodefilename).cs');@(sqlstringresource->'$(IntermediateOutputPath)%(outresxfilename).resx')"
Condition="'@(Sqlstringresource)'!=''">
<MakeDir Directories="$(IntermediateOutputPath)" />
<Message Importance="high" Text="dotnet $(PkgMicrosoft_Data_Tools_StringResourceTool)\lib\netcoreapp2.2\srgen.dll -or $(IntermediateOutputPath)%(sqlstringresource.outresxfilename).resx -oc $(IntermediateOutputPath)%(sqlstringresource.outcodefilename).cs -ns %(sqlstringresource.namespace) -cn %(sqlstringresource.outclassname) -l CS %(sqlstringresource.additionaloptions) %(sqlstringresource.fullpath)" />
<Exec Command="dotnet $(PkgMicrosoft_Data_Tools_StringResourceTool)\lib\netcoreapp2.2\srgen.dll -or $(IntermediateOutputPath)%(sqlstringresource.outresxfilename).resx -oc $(IntermediateOutputPath)%(sqlstringresource.outcodefilename).cs -ns %(sqlstringresource.namespace) -cn %(sqlstringresource.outclassname) -l CS %(sqlstringresource.additionaloptions) %(sqlstringresource.fullpath)" />
<ItemGroup>
<EmbeddedResource Include="$(IntermediateOutputPath)%(sqlstringresource.outresxfilename).resx">
<LogicalName Condition="'%(Sqlstringresource.logicalname)'!=''">%(Sqlstringresource.logicalname)</LogicalName>
<ManifestResourceName>%(Sqlstringresource.resourcename).%(Sqlstringresource.outclassname)</ManifestResourceName>
</EmbeddedResource>
<Compile Include="$(IntermediateOutputPath)%(Sqlstringresource.outcodefilename).cs" />
</ItemGroup>
</Target>
Dependencies
-
.NETCoreApp 2.2
- No dependencies.
-
.NETFramework 4.6.2
- No dependencies.
-
.NETStandard 2.0
- No dependencies.
Used By
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Microsoft.Data.Tools.StringResourceTool:
Repository | Stars |
---|---|
microsoft/sqltoolsservice
SQL Tools API service that provides SQL Server data management capabilities.
|