mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Update 'internals.md' with the latest build changes (#7058)
This commit is contained in:
+17
-15
@@ -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"
|
||||
<Project>
|
||||
<Target Name="_GetDependencies"
|
||||
DependsOnTargets="ResolveAssemblyReferencesDesignTime">
|
||||
<ItemGroup>
|
||||
<_RefAssemblyPath Include="%(_ReferencesFromRAR.ResolvedPath)%3B" Condition=" '%(_ReferencesFromRAR.Type)' == 'assembly' And '%(_ReferencesFromRAR.PackageName)' != 'Microsoft.Management.Infrastructure' " />
|
||||
</ItemGroup>
|
||||
<WriteLinesToFile File="$(_DependencyFile)" Lines="@(_RefAssemblyPath)" Overwrite="true" />
|
||||
</Target>
|
||||
<Target Name="_GetDependencies"
|
||||
DependsOnTargets="ResolveAssemblyReferencesDesignTime">
|
||||
<ItemGroup>
|
||||
<_RefAssemblyPath Include="%(_ReferencesFromRAR.HintPath)%3B" Condition=" '%(_ReferencesFromRAR.NuGetPackageId)' != 'Microsoft.Management.Infrastructure' "/>
|
||||
</ItemGroup>
|
||||
<WriteLinesToFile File="$(_DependencyFile)" Lines="@(_RefAssemblyPath)" Overwrite="true" />
|
||||
</Target>
|
||||
</Project>
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user