diff --git a/.spelling b/.spelling index 83013884ad2..850da389ff2 100644 --- a/.spelling +++ b/.spelling @@ -514,6 +514,7 @@ src v141 x64_arm x64_arm64 +msbuild #endregion #region docs/building/macos.md Overrides diff --git a/docs/building/internals.md b/docs/building/internals.md index 13cb3875451..1ed23dc85b5 100644 --- a/docs/building/internals.md +++ b/docs/building/internals.md @@ -30,8 +30,9 @@ it should be listed as a dependency for `$Top` folder (`src\powershell-unix` or ### ResGen -Until the .NET CLI `dotnet-resgen` tool supports the generation of strongly typed classes, -we run our own tool C# [ResGen tool](../../src/ResGen). +Until the .NET CLI `dotnet-resgen` tool supports the generation of strongly typed resource access classes +(tracked by [Microsoft/msbuild #2272](https://github.com/Microsoft/msbuild/issues/2272)), +we run our own C# [ResGen tool](../../src/ResGen). While the `Start-PSBuild` command runs this automatically via the `Start-ResGen` function, it does *not* require PowerShell. The same command can be run manually: @@ -42,12 +43,12 @@ dotnet restore dotnet run ``` -Running the program does everything else: +Running the program does the following work: - For each project, given a `resources` folder, create a `gen` folder. - For each `*.resx` file from the `resources` folder, - fill in a strongly typed C# class, - and write it out to the corresponding `*.cs` file in the `gen` folder. + create a strongly typed C# resource access class, + and write it to the corresponding `*.cs` file in the `gen` folder. These files are *not* automatically updated on each build, as the project lacks the ability to detect changes. @@ -70,20 +71,21 @@ dotnet restore dotnet run ../System.Management.Automation/CoreCLR/CorePsTypeCatalog.cs powershell.inc ``` -The file `powershell.inc` is generated by running a custom MSBuild target, -which can be set-up by navigating to the `src` directory and running the following commands: +The file `powershell.inc` is generated by running a custom MSBuild target. +`Start-TypeGen` handles generating this file, +but you can also do it manually by navigating to the `src` directory and running the following commands: ```sh targetFile="Microsoft.PowerShell.SDK/obj/Microsoft.PowerShell.SDK.csproj.TypeCatalog.targets" cat > $targetFile <<-"EOF" - - - <_RefAssemblyPath Include="%(_ReferencesFromRAR.ResolvedPath)%3B" Condition=" '%(_ReferencesFromRAR.Type)' == 'assembly' And '%(_ReferencesFromRAR.PackageName)' != 'Microsoft.Management.Infrastructure' " /> - - - + + + <_RefAssemblyPath Include="%(_ReferencesFromRAR.HintPath)%3B" Condition=" '%(_ReferencesFromRAR.NuGetPackageId)' != 'Microsoft.Management.Infrastructure' "/> + + + EOF dotnet msbuild Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj /t:_GetDependencies "/property:DesignTimeBuild=true;_DependencyFile=$(pwd)/TypeCatalogGen/powershell.inc" /nologo @@ -91,7 +93,7 @@ dotnet msbuild Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj /t:_GetD `powershell.inc` contains the resolved paths to the DLLs of each dependency of PowerShell, and is taken as input to the [`TypeCatalogGen`](../../src/TypeCatalogGen) tool, -which generates a source file `CorePsTypeCatalog.cs` for the `Microsoft.PowerShell.CoreCLR.AssemblyLoadContext` project. +which generates the source file `CorePsTypeCatalog.cs` for the `System.Management.Automation` project. The error `The name 'InitializeTypeCatalog' does not exist in the current context` indicates that the `CorePsTypeCatalog.cs` source file does not exist,