<commit_before><?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <UsingTask TaskName="GenerateResourcesCode" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll" />
  <UsingTask TaskName="NormalizeAssemblyName" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll" />

  <PropertyGroup>
    <GenerateResourceMSBuildRuntime>CurrentRuntime</GenerateResourceMSBuildRuntime>
    <GenerateResourceMSBuildArchitecture>CurrentArchitecture</GenerateResourceMSBuildArchitecture>
  </PropertyGroup>

  <PropertyGroup>
    <ResourcesSourceOutputDirectory Condition="'$(ResourcesSourceOutputDirectory)' == ''">$(MSBuildProjectDirectory)/Resources/</ResourcesSourceOutputDirectory>
    <StringResourcesPath Condition="'$(StringResourcesPath)'=='' And Exists('$(ResourcesSourceOutputDirectory)Strings.resx')">$(ResourcesSourceOutputDirectory)Strings.resx</StringResourcesPath>
    <IntermediateResOutputFileFullPath Condition="'$(MSBuildProjectExtension)' == '.csproj'">$(IntermediateOutputPath)SR.cs</IntermediateResOutputFileFullPath>
    <IntermediateResOutputFileFullPath Condition="'$(MSBuildProjectExtension)' == '.vbproj'">$(IntermediateOutputPath)SR.vb</IntermediateResOutputFileFullPath>
    <DefineConstants Condition="'$(ConfigurationGroup)' == 'Debug'">$(DefineConstants);DEBUGRESOURCES</DefineConstants>
  </PropertyGroup>

  <PropertyGroup Condition="'$(BuildingUAPVertical)' == 'true'">
    <CompileDependsOn>
      CopyResxFilesToReswFiles;
      $(CompileDependsOn);
    </CompileDependsOn>
  </PropertyGroup>

  <Target Name="CalculateResourcesFileNames" Condition="'$(BuildingUAPVertical)' == 'true'">
    <ItemGroup>
      <_AllResxFiles Include="@(EmbeddedResource->'%(FullPath)')" Condition="'%(Extension)' == '.resx'">
        <ReswName Condition="'%(EmbeddedResource.ReswName)' == ''">%(EmbeddedResource.ManifestResourceName)</ReswName>
      </_AllResxFiles>
    </ItemGroup>

    <PropertyGroup>
      <ProjectHasResources Condition="'@(_AllResxFiles)' != ''">true</ProjectHasResources>
      <TestProjectNeedsModifiedPriFile Condition="'$(IsTestProject)' == 'true' AND '$(ProjectHasResources)' == 'true'">true</TestProjectNeedsModifiedPriFile>
      <TestResourcesFolderPath Condition="'$(TestProjectNeedsModifiedPriFile)' == 'true'">$(RuntimePath)$(AssemblyName).Resw</TestResourcesFolderPath>
      <_ResWDestinationPath Condition="'$(TestResourcesFolderPath)' != ''">$(TestResourcesFolderPath)</_ResWDestinationPath>
      <_ResWDestinationPath Condition="'$(TestResourcesFolderPath)' == ''">$(ResourcesFolderPath)</_ResWDestinationPath>
    </PropertyGroup>

    <ItemGroup>
      <_ReswOutputFiles Include="@(_AllResxFiles->'$(_ResWDestinationPath)/%(ReswName).resw')" />
    </ItemGroup>

  </Target>

  <Target Name="CopyResxFilesToReswFiles" 
          Condition="'$(BuildingUAPVertical)' == 'true'" 
          DependsOnTargets="CalculateResourcesFileNames"
          Inputs="@(_AllResxFiles)"
          Outputs="@(_ReswOutputFiles)" >

    <Copy SourceFiles="@(_AllResxFiles)"
          DestinationFiles="@(_ReswOutputFiles)"
          SkipUnchangedFiles="true">
          <Output TaskParameter="CopiedFiles" ItemName="FilesCreated" />
    </Copy>

    <!-- We need to touch the copied files so that the target that uses them can track the inputs and outputs with the copied timestamp -->
    <Touch Files="@(FilesCreated)" />
    
  </Target>
  
  <PropertyGroup Condition="'$(StringResourcesPath)'!=''">
      <CompileDependsOn>
          NormalizeAssemblyName;
          GenerateResourcesSource;
          $(CompileDependsOn);
      </CompileDependsOn>
  </PropertyGroup>

  <Target Name="NormalizeAssemblyName" Condition="'$(StringResourcesPath)'!='' AND '$(OmitResources)'!='true'">
    <NormalizeAssemblyName
        AssemblyName="$(AssemblyName)" >
        <Output TaskParameter="NormalizedAssemblyName" PropertyName="_NormalizedAssemblyName" />
    </NormalizeAssemblyName>

    <ItemGroup>
      <!--
         EmbeddedResource is defined outside the target and cannot be defined inside this target
         we need to update logical name and ReswName after we normalize the assembly name.
      -->
      <EmbeddedResource Condition="'%(EmbeddedResource.LogicalName)'=='FxResources.$(AssemblyName).SR.resources'">
        <LogicalName>FxResources.$(_NormalizedAssemblyName).SR.resources</LogicalName>
        <ReswName Condition="'$(BuildingUAPVertical)' == 'true'">FxResources.$(_NormalizedAssemblyName).SR</ReswName>
      </EmbeddedResource>
    </ItemGroup>
  </Target>

  <Target Name="GenerateResourcesSource"
          Condition="'$(StringResourcesPath)'!='' AND '$(OmitResources)'!='true'"
          Inputs="$(StringResourcesPath)"
          Outputs="$(IntermediateResOutputFileFullPath)">

    <GenerateResourcesCode
        ResxFilePath="$(StringResourcesPath)"
        OutputSourceFilePath="$(IntermediateResOutputFileFullPath)"
        AssemblyName="$(_NormalizedAssemblyName)" >
    </GenerateResourcesCode>

    <ItemGroup>
      <!-- The following Compile element has to be included dynamically inside the Target otherwise intellisense will not work -->
      <Compile Include="$(IntermediateResOutputFileFullPath)" />
    </ItemGroup>

    <ItemGroup>
      <FileWrites Include="$(IntermediateResOutputFileFullPath)" />
    </ItemGroup>
  </Target>

  <ItemGroup Condition="'$(StringResourcesPath)'!='' AND '$(OmitResources)'!='true'">
    <EmbeddedResource Include="$(StringResourcesPath)">
      <Visible>true</Visible>
      <LogicalName>FxResources.$(AssemblyName).SR.resources</LogicalName>
      <ReswName Condition="'$(BuildingUAPVertical)' == 'true'">FxResources.$(AssemblyName).SR</ReswName>
    </EmbeddedResource>
  </ItemGroup>

  <Choose><commit_msg>Allow generating resources cs code at design time (#1921)<commit_after><?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <UsingTask TaskName="GenerateResourcesCode" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll" />
  <UsingTask TaskName="NormalizeAssemblyName" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll" />

  <PropertyGroup>
    <GenerateResourceMSBuildRuntime>CurrentRuntime</GenerateResourceMSBuildRuntime>
    <GenerateResourceMSBuildArchitecture>CurrentArchitecture</GenerateResourceMSBuildArchitecture>
  </PropertyGroup>

  <PropertyGroup>
    <ResourcesSourceOutputDirectory Condition="'$(ResourcesSourceOutputDirectory)' == ''">$(MSBuildProjectDirectory)/Resources/</ResourcesSourceOutputDirectory>
    <StringResourcesPath Condition="'$(StringResourcesPath)'=='' And Exists('$(ResourcesSourceOutputDirectory)Strings.resx')">$(ResourcesSourceOutputDirectory)Strings.resx</StringResourcesPath>
    <IntermediateResOutputFileFullPath Condition="'$(MSBuildProjectExtension)' == '.csproj'">$(IntermediateOutputPath)SR.cs</IntermediateResOutputFileFullPath>
    <IntermediateResOutputFileFullPath Condition="'$(MSBuildProjectExtension)' == '.vbproj'">$(IntermediateOutputPath)SR.vb</IntermediateResOutputFileFullPath>
    <DefineConstants Condition="'$(ConfigurationGroup)' == 'Debug'">$(DefineConstants);DEBUGRESOURCES</DefineConstants>
  </PropertyGroup>

  <PropertyGroup Condition="'$(BuildingUAPVertical)' == 'true'">
    <CompileDependsOn>
      CopyResxFilesToReswFiles;
      $(CompileDependsOn);
    </CompileDependsOn>
  </PropertyGroup>

  <Target Name="CalculateResourcesFileNames" Condition="'$(BuildingUAPVertical)' == 'true'">
    <ItemGroup>
      <_AllResxFiles Include="@(EmbeddedResource->'%(FullPath)')" Condition="'%(Extension)' == '.resx'">
        <ReswName Condition="'%(EmbeddedResource.ReswName)' == ''">%(EmbeddedResource.ManifestResourceName)</ReswName>
      </_AllResxFiles>
    </ItemGroup>

    <PropertyGroup>
      <ProjectHasResources Condition="'@(_AllResxFiles)' != ''">true</ProjectHasResources>
      <TestProjectNeedsModifiedPriFile Condition="'$(IsTestProject)' == 'true' AND '$(ProjectHasResources)' == 'true'">true</TestProjectNeedsModifiedPriFile>
      <TestResourcesFolderPath Condition="'$(TestProjectNeedsModifiedPriFile)' == 'true'">$(RuntimePath)$(AssemblyName).Resw</TestResourcesFolderPath>
      <_ResWDestinationPath Condition="'$(TestResourcesFolderPath)' != ''">$(TestResourcesFolderPath)</_ResWDestinationPath>
      <_ResWDestinationPath Condition="'$(TestResourcesFolderPath)' == ''">$(ResourcesFolderPath)</_ResWDestinationPath>
    </PropertyGroup>

    <ItemGroup>
      <_ReswOutputFiles Include="@(_AllResxFiles->'$(_ResWDestinationPath)/%(ReswName).resw')" />
    </ItemGroup>

  </Target>

  <Target Name="CopyResxFilesToReswFiles"
          Condition="'$(BuildingUAPVertical)' == 'true'"
          DependsOnTargets="CalculateResourcesFileNames"
          Inputs="@(_AllResxFiles)"
          Outputs="@(_ReswOutputFiles)" >

    <Copy SourceFiles="@(_AllResxFiles)"
          DestinationFiles="@(_ReswOutputFiles)"
          SkipUnchangedFiles="true">
          <Output TaskParameter="CopiedFiles" ItemName="FilesCreated" />
    </Copy>

    <!-- We need to touch the copied files so that the target that uses them can track the inputs and outputs with the copied timestamp -->
    <Touch Files="@(FilesCreated)" />

  </Target>

  <PropertyGroup Condition="'$(StringResourcesPath)'!=''">
      <CompileDependsOn>
          NormalizeAssemblyName;
          GenerateResourcesSource;
          $(CompileDependsOn);
      </CompileDependsOn>
  </PropertyGroup>

  <Target Name="NormalizeAssemblyName" Condition="'$(StringResourcesPath)'!='' AND '$(OmitResources)'!='true'">
    <NormalizeAssemblyName
        AssemblyName="$(AssemblyName)" >
        <Output TaskParameter="NormalizedAssemblyName" PropertyName="_NormalizedAssemblyName" />
    </NormalizeAssemblyName>

    <ItemGroup>
      <!--
         EmbeddedResource is defined outside the target and cannot be defined inside this target
         we need to update logical name and ReswName after we normalize the assembly name.
      -->
      <EmbeddedResource Condition="'%(EmbeddedResource.LogicalName)'=='FxResources.$(AssemblyName).SR.resources'">
        <LogicalName>FxResources.$(_NormalizedAssemblyName).SR.resources</LogicalName>
        <ReswName Condition="'$(BuildingUAPVertical)' == 'true'">FxResources.$(_NormalizedAssemblyName).SR</ReswName>
      </EmbeddedResource>
    </ItemGroup>
  </Target>

  <Target Name="GenerateResourcesSource" DependsOnTargets="NormalizeAssemblyName"
          Condition="'$(StringResourcesPath)'!='' AND '$(OmitResources)'!='true'"
          Inputs="$(StringResourcesPath)"
          Outputs="$(IntermediateResOutputFileFullPath)">

    <GenerateResourcesCode
        ResxFilePath="$(StringResourcesPath)"
        OutputSourceFilePath="$(IntermediateResOutputFileFullPath)"
        AssemblyName="$(_NormalizedAssemblyName)" >
    </GenerateResourcesCode>

    <ItemGroup>
      <!-- The following Compile element has to be included dynamically inside the Target otherwise intellisense will not work -->
      <Compile Include="$(IntermediateResOutputFileFullPath)" />
    </ItemGroup>

    <ItemGroup>
      <FileWrites Include="$(IntermediateResOutputFileFullPath)" />
    </ItemGroup>
  </Target>

  <ItemGroup Condition="'$(StringResourcesPath)'!='' AND '$(OmitResources)'!='true'">
    <EmbeddedResource Include="$(StringResourcesPath)">
      <Visible>true</Visible>
      <LogicalName>FxResources.$(AssemblyName).SR.resources</LogicalName>
      <ReswName Condition="'$(BuildingUAPVertical)' == 'true'">FxResources.$(AssemblyName).SR</ReswName>
    </EmbeddedResource>

    <!-- Set the Generator metadata so that VS triggers design-time build whenever the .resx file is saved -->
    <EmbeddedResource Update="@(EmbeddedResource)">
      <Generator>MSBuild:GenerateResourcesSource</Generator>
    </EmbeddedResource>
  </ItemGroup>

  <Choose>
{'fraction_non_alphanumeric': 0.14407487882333278, 'fraction_numerical': 0.0020056827678422194, 'mean_word_length': 5.3824, 'pattern_counts': {'":': 0, '<': 200, '<?xml version=': 2, '>': 204, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4739770', 'n_tokens_mistral': 3416, 'n_tokens_neox': 3069, 'n_words': 492}