diff --git a/PowerShell.Common.props b/PowerShell.Common.props index c2ee2dbf2a2..1300b5e770d 100644 --- a/PowerShell.Common.props +++ b/PowerShell.Common.props @@ -97,7 +97,7 @@ net5.0 8.0 - true + true true true @@ -111,6 +111,27 @@ true + + gen + + + + + + + + + + ResXFileCodeGenerator + CSharp + + $(StronglyTypedOutputFolder)/%(Filename).cs + %(Filename) + $(RootNamespace).resources + + + $(DefineConstants);CORECLR true diff --git a/build.psm1 b/build.psm1 index 2454ada262b..bb5e90649e8 100644 --- a/build.psm1 +++ b/build.psm1 @@ -430,10 +430,10 @@ Fix steps: # handle ResGen # Heuristic to run ResGen on the fresh machine - if ($ResGen -or -not (Test-Path "$PSScriptRoot/src/Microsoft.PowerShell.ConsoleHost/gen")) { - Write-Log -message "Run ResGen (generating C# bindings for resx files)" - Start-ResGen - } + #if ($ResGen -or -not (Test-Path "$PSScriptRoot/src/Microsoft.PowerShell.ConsoleHost/gen")) { + # Write-Log -message "Run ResGen (generating C# bindings for resx files)" + # Start-ResGen + #} # Handle TypeGen # .inc file name must be different for Windows and Linux to allow build on Windows and WSL. diff --git a/src/Microsoft.Management.UI.Internal/Microsoft.PowerShell.GraphicalHost.csproj b/src/Microsoft.Management.UI.Internal/Microsoft.PowerShell.GraphicalHost.csproj index 466511d6d22..5063d5aaca1 100644 --- a/src/Microsoft.Management.UI.Internal/Microsoft.PowerShell.GraphicalHost.csproj +++ b/src/Microsoft.Management.UI.Internal/Microsoft.PowerShell.GraphicalHost.csproj @@ -1,4 +1,4 @@ - + Assembly containing WPF code for Out-GridView, HelpWindow, and Show-Command @@ -12,6 +12,66 @@ $(DefineConstants);CORECLR + + gen + $([System.String]::Copy('$(MSBuildProjectFile)').Contains('wpftmp')) + + + + + + + + + + ResXFileCodeGenerator + CSharp + + $([System.String]::new('%(Filename)').StartsWith('Public', System.StringComparison.OrdinalIgnoreCase)) + + $(RootNamespace).resources + $(RootNamespace).resources.public + + $(StronglyTypedOutputFolder)/%(Filename).cs + $(StronglyTypedOutputFolder)/$([System.String]::Copy('%(Filename)').Substring(7)).cs + + %(Filename) + $([System.String]::Copy('%(Filename)').Substring(7)) + + $(RootNamespace).resources.%(PSEmbeddedResource.StronglyTypedClassName) + $(RootNamespace).resources.public.%(PSEmbeddedResource.StronglyTypedClassName) + + + + + + + + +