New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add dependency nuget instructions for PowerShell.Core.Instrumentation resource binary #5396
Changes from 4 commits
c90eaf5
74bdbb3
8902527
da71450
ed2c484
f60a430
8b150a5
51f99f7
ed7fad9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -197,3 +197,67 @@ The layout of files should look like this: | |
``` | ||
|
||
Lastly, run `nuget pack .` from within the folder. Note that you may need the latest `nuget.exe`. | ||
|
||
### PowerShell.Core.Instrumentation | ||
|
||
To successfully decode PowerShell Core ETW events, The manifest and resource binary need to be registered on the system. | ||
|
||
To create a new NuGet package for `PowerShell.Core.Instrumentation.dll`, you will need the PowerShell.Core.Instrumentation.nuspec found in the repo under src\PowerShell.Core.Instrumentation. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PowerShell.Core.Instrumentation.nuspec should be put in the code block There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
|
||
Update the version information for the package. | ||
|
||
```none | ||
<version>6.0.0-RC</version> | ||
``` | ||
|
||
Next, create the directory structure needed for the contents of the nuget packagestructure. The final directory and file layout is listed below. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
typo There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
|
||
```powershell | ||
if (Test-Path -Path c:\mypackage) | ||
{ | ||
Remove-Item -Recurse -Force -Path c:\mypackage | ||
} | ||
$null = New-Item -Path c:\mypackage\runtimes\win-x64\native -ItemType Directory | ||
$null = New-Item -Path c:\mypackage\runtimes\win-x86\native -ItemType Directory | ||
``` | ||
|
||
You will need to build `PowerShell.Core.Instrumentation.dll` targeting both `win-x64` and `win-x86` on Windows 10. | ||
The output files will be placed under src\powershell-win-core. | ||
|
||
Build the `win-x64` platform and copy the `PowerShell.Core.Instrumentation.dll` to the win-x86 portion of the tree. | ||
|
||
```powershell | ||
## Build targeting win-x64 | ||
Start-BuildNativeWindowsBinaries -Configuration Release -Arch x64 | ||
Copy-Item -Path .\src\powershell-win-core\PowerShell.Core.Instrumentation.dll -Destination c:\mypackage\runtimes\win-x64\native | ||
``` | ||
|
||
Next, build the `win-x86` platform and copy `PowerShell.Core.Instrumentation.dll` to the win-x86 portion of the tree. | ||
|
||
```powershell | ||
## Build targeting win-x86 | ||
Start-BuildNativeWindowsBinaries -Configuration Release -Arch x86 | ||
Copy-Item -Path .\src\powershell-win-core\PowerShell.Core.Instrumentation.dll -Destination c:\mypackage\runtimes\win-x86\native | ||
``` | ||
|
||
The layout of files looks like this: | ||
|
||
```none | ||
└── runtimes | ||
├── win-x64 | ||
│ └── native | ||
│ └── PowerShell.Core.Instrumentation.dll | ||
│ | ||
├── win-x86 | ||
│ └── native | ||
│ └── PowerShell.Core.Instrumentation.dll | ||
``` | ||
|
||
NOTE: Since these are native binaries used on Windows, they need to be AuthenticodeDual signed, certificate code: 402 before creating the nuget package. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
per my discussion with Travis, this code should not be exposed in public. I think only mentioning "need to be AuthenticodeDual signed" should be good enough. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
|
||
Lastly, run `nuget pack` from teh root of the repo. The following command creates the nuget package from the c:\mypackage directory and places the nuget package in .\src\powershell-win-core. Note that you may need the latest `nuget.exe`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Type How about changing it to "Lastly, run the following command from the root of repo."? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
|
||
```powershell | ||
nuget pack .\src\PowerShell.Core.Instrumentation\PowerShell.Core.Instrumentation.nuspec -BasePath c:\mypackage -OutputDirectory .\src\powershell-win- | ||
core | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 'core' should not be in a new line. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd"> | ||
<metadata> | ||
<id>PowerShell.Core.Instrumentation</id> | ||
<version>6.0.0-beta.9</version> | ||
<authors>Microsoft</authors> | ||
<owners>Microsoft</owners> | ||
<requireLicenseAcceptance>false</requireLicenseAcceptance> | ||
<description>PowerShell Core ETW resource binary</description> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we remove "Core"? It seems we did this previously. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, we use PowerShell Core all across our .MD files in the repo. (547 times). I figured I'd follow that pattern as well as ensure that there is no confusion between this and Windows PowerShell. That's also the reason I selected the assembly name. |
||
<copyright>Copyright 2017 Microsoft</copyright> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We use the string Also should we start all XML tags with capitalization? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did a survey of all nuspec files in my package cache, and they all use lowercase for the xml elements. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed the copyright text |
||
</metadata> | ||
</package> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
<PackageReference Include="System.Security.Permissions" Version="4.4.0" /> | ||
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.4.0" /> | ||
<PackageReference Include="Microsoft.Management.Infrastructure" Version="1.0.0-alpha*" /> | ||
<PackageReference Include="PowerShell.Core.Instrumentation" Version="6.0.0-beta*" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it depended by System.Management.Automation.dll or powershell as a whole? Put it another way, if an application is hosting System.Management.Automation.dll only, does it need the resource dll to work properly? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. None of the code has a direct dependency on the binary. I chose SMA to pull the nuget package since it contains the event raising code. If the dll is not present or the manifest isn't registered, PowerShell will continue to work without issue but the event log and custom consumers won't be able to decode the events. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the clarification. #Close |
||
</ItemGroup> | ||
|
||
<PropertyGroup> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed