Skip to content

Commit

Permalink
Add some help on how to rerun ResourcesGenerator
Browse files Browse the repository at this point in the history
  • Loading branch information
KirillOsenkov committed May 15, 2022
1 parent 7720978 commit afe5eea
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
25 changes: 16 additions & 9 deletions src/ResourcesGenerator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ namespace ResourcesGenerator
{
class Program
{
static void Main(string[] args)
/// <summary>
/// To regenerate Strings.json, add the strings you want to consume from MSBuild to <see cref="ResourceCreator.ResourceNames"/>
/// and run this program
/// </summary>
static void Main()
{
var options = new Microsoft.Build.Locator.VisualStudioInstanceQueryOptions()
{
Expand All @@ -19,17 +23,20 @@ static void Main(string[] args)
instances.FirstOrDefault();
var msbuildPath = instance?.MSBuildPath;

// msbuildPath = @"C:\msbuild\artifacts\bin\bootstrap\net472\MSBuild\Current\Bin";
var otherCandidates = new[]
{
@"C:\msbuild\artifacts\bin\bootstrap\net472\MSBuild\Current\Bin",
Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles),
"Microsoft Visual Studio", "2022", "Enterprise", "MSBuild", "Current", "Bin"),
Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86),
"Microsoft Visual Studio", "2019", "Enterprise", "MSBuild", "Current", "Bin")
};

if (msbuildPath == null)
{
string defaultMSBuild = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86),
"Microsoft Visual Studio", "2019", "Enterprise", "MSBuild", "Current", "Bin");
if (Directory.Exists(defaultMSBuild))
{
msbuildPath = defaultMSBuild;
}
msbuildPath = otherCandidates.FirstOrDefault(Directory.Exists);
}

if (Directory.Exists(msbuildPath))
Expand Down
2 changes: 2 additions & 0 deletions src/StructuredLogger/Strings/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
To regenerate Strings.json, add the resource string ids you need to ResourcesGenerator project -> ResourceCreator.ResourceNames,
then run the ResourcesGenerator tool

0 comments on commit afe5eea

Please sign in to comment.