Regenerate resx files using ResxFileCodeGenerator

This is a temporary arrangement until we can start generating designer
file equivalents from k build. A side-effect of the change is that the
generated file will no longer build in CoreCLR profile due to missing API.
This commit is contained in:
Pranav K 2014-01-31 12:55:09 -08:00
parent 27574b1616
commit 37e225d517
1 changed files with 24 additions and 9 deletions

View File

@ -193,20 +193,35 @@ functions
configs["k10"] = new Dictionary<string, object>();
configs["net45"] = new Dictionary<string, object>();
}
// Templates
const string csTemplate = @"<Compile Include=""{0}"" />";
const string resxDesignerTemplate = @"<Compile Include=""{0}"">
<DependentUpon>{1}</DependentUpon>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>";
const string resxTemplate = @"<EmbeddedResource Include=""{0}"">
<LogicalName>{1}.{2}.resources</LogicalName>
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>{2}.Designer.cs</LastGenOutput>
<CustomToolNamespace>{1}.Resources</CustomToolNamespace>
</EmbeddedResource>";
// Build the list of resx files
var resxFileNames = FindFilesOfType(projectDir, "*.resx");
var resxDesignerFiles = new HashSet<string>(resxFileNames.Select(f => Path.ChangeExtension(f, "Designer.cs")),
StringComparer.OrdinalIgnoreCase);
var resxFiles = String.Join(Environment.NewLine,
resxFileNames.Select(p => String.Format(resxTemplate, p, projectName, Path.GetFileNameWithoutExtension(p))));
// Build the list of cs files
var csFiles
= String.Join(Environment.NewLine,
FindFilesOfType(projectDir, "*.cs")
.Select(p => String.Format(@"<Compile Include=""{0}"" />", p)));
// Build the list of resx files
var resxFiles
= String.Join(Environment.NewLine,
FindFilesOfType(projectDir, "*.resx")
.Select(p => String.Format(@"<EmbeddedResource Include=""{0}"">
<LogicalName>{1}.{2}.resources</LogicalName>
</EmbeddedResource>", p, projectName, Path.GetFileNameWithoutExtension(p))));
.Select(p => resxDesignerFiles.Contains(p) ? String.Format(resxDesignerTemplate, p, Path.ChangeExtension(Path.GetFileNameWithoutExtension(p), "resx")) :
String.Format(csTemplate, p)));
bool isSample = Path.GetDirectoryName(projectDir)
.TrimEnd(Path.DirectorySeparatorChar)