-
Notifications
You must be signed in to change notification settings - Fork 8.1k
WIP [release/v7.5] rebuild based on packages #25894
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
Conversation
iSazonov
left a comment
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.
Our dev documentation is very outdated. Have you considered updating it?
| <ProjectReference Include="..\Microsoft.PowerShell.SDK\Microsoft.PowerShell.SDK.csproj" /> | ||
| <PackageReference Include="Microsoft.PowerShell.SDK" Version="7.5.2" /> |
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.
Repeat project reference.
| <PackageReference Include="Microsoft.PowerShell.ConsoleHost" Version="7.5.2" /> | ||
| <PackageReference Include="Microsoft.PowerShell.Commands.Diagnostics" Version="7.5.2" /> | ||
| <PackageReference Include="Microsoft.Management.Infrastructure.CimCmdlets" Version="7.5.2" /> | ||
| <PackageReference Include="Microsoft.WSMan.Management" Version="7.5.2" /> |
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.
Should we parameterize this 7.5.2 value? It is used in many places.
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.
Yes, parameterizing the version number 7.5.2 is a smart move—especially since it's repeated across multiple entries. This makes your project easier to maintain and update in the future. Instead of hunting down every instance of the version string, you can change it in one place.
…arios in PowerShell projects
… and conditional xUnit test execution
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
|
This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 15 days. It will be closed if no further activity occurs within 10 days of this comment. |
This pull request introduces a new build mode that allows building PowerShell modules and SDKs from pre-built packages instead of project references, controlled by a new
BuildFromPackagesswitch and theRebuildMSBuild property. This change streamlines the build process, especially for scenarios where consuming official package releases is preferred over local source builds. The implementation involves conditional logic in the build scripts and project files to switch between package references and project references based on the build mode.Build system enhancements:
BuildFromPackagesswitch to theStart-PSBuildfunction inbuild.psm1, which sets the/property:Rebuild=trueMSBuild property to control package-based builds. [1] [2]Module.Common.propsfile that conditionally includes eitherPackageReferenceorProjectReferenceforSystem.Management.Automationdepending on theRebuildproperty and platform, centralizing this logic for multiple projects.Project file conditional references:
.csprojfiles (such asMicrosoft.PowerShell.Commands.Management,Microsoft.PowerShell.Commands.Utility,Microsoft.PowerShell.Security, andMicrosoft.PowerShell.SDK) to importModule.Common.propsand/or conditionally switch between package and project references based on theRebuildproperty. This includes adding or moving relevantPackageReferenceandProjectReferenceentries. [1] [2] [3] [4] [5] [6]Windows-specific build logic:
Module.Common.props, added special handling for Windows builds by including a direct assembly reference toSystem.Management.Automation.dllfrom the NuGet package when rebuilding on Windows.SDK and host packaging:
powershell-win-core.csprojto use package references for SDK and related modules when in rebuild mode, and project references otherwise, aligning the packaging with the new build strategy.Graphical host build adjustments:
Microsoft.PowerShell.GraphicalHost.csprojto use package references for dependencies when rebuilding, and project references otherwise, supporting the new build mode.These changes collectively enable a more flexible build process, allowing developers and CI systems to choose between source-based and package-based builds as needed.