Skip to content

Simplify local development and streamline repository infrastructure - #1858

Open
Tera (0x5bfa) wants to merge 5 commits into
microsoft:mainfrom
0x5bfa:infra
Open

Tera (0x5bfa) wants to merge 5 commits into
microsoft:mainfrom
0x5bfa:infra

Conversation

@0x5bfa

Copy link
Copy Markdown
Contributor

Context

I understand that the repository's original author created Library.Template to make repository setup easier and more consistent. That is a useful goal, and this is not a criticism of the template or of using it across repositories.

By "focused" here, I mean the day-to-day contributor workflow: CsWin32 is a source generator with build/package integration and a substantial test matrix. Those parts have real complexity, but contributors should be able to work with the repository through Visual Studio or the standard .NET CLI without first understanding a general-purpose bootstrap and template-update layer. For this repository, the maintenance and setup overhead of that layer appears to outweigh its benefits.

Changes

  • Migrate Microsoft.Windows.CsWin32.sln to Microsoft.Windows.CsWin32.slnx and update the related documentation and build configuration.
  • Replace the local init.cmd / init.ps1 bootstrap flow with the SDK specified in global.json and standard dotnet commands.
  • Update GitHub Actions and Azure Pipelines to install SDKs and authenticate to feeds through their native setup tasks, then invoke dotnet directly.
  • Separate local package sources from the official Azure Pipelines feed configuration. Local builds use NuGet.org, with explicit source mapping for test packages available only from Microsoft's public feed.
  • Scope MicroBuild and SBOM configuration to official or explicitly enabled MicroBuild builds.
  • Remove the Library.Template update automation and associated unused helpers, along with obsolete pipeline definitions, an unreferenced GitHub Action, and unused editor/tool configuration.

The documented local workflow is:

dotnet build
dotnet test --filter "TestCategory!=HighMemory&TestCategory!=RequiresHardware"
dotnet pack -c Release

Official build and release infrastructure

The official Azure Pipelines path retains 1ESPT/MicroBuild integration, signing, SBOM generation, artifact publishing, and release/insertion workflows. It continues to use the Microsoft feed configuration and existing MicroBuild tasks.

Validation

  • Release build and Visual Studio MSBuild build of the SLNX solution.
  • dotnet pack and dotnet pack --no-build.
  • 1,881 tests passed; package-consumer tests and DocFX validation with warnings treated as errors also passed.
  • Azure/GitHub workflow YAML validation and GitHub Actions linting passed.
  • Restore with the official feed and MicroBuild configuration succeeded.

The official 1ESPT pipeline, production signing, and end-to-end artifact delivery were not run as part of this change.


If this cleanup is not a direction the maintainers want, or an unsolicited infrastructure change is not welcome, please let me know. I’m happy to close the PR or narrow its scope.

Copilot AI balanced review requested due to automatic review settings October 17, 2026 15:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The broad infrastructure changes require maintainer validation of official signing, SBOM generation, and end-to-end artifact delivery.

No open issues 🎉

What changed in this PR

Simplifies CsWin32’s contributor workflow around standard .NET commands while separating local development from official build infrastructure.

Changes:

  • Migrates to SLNX and adjusts build ordering and packaging.
  • Replaces bootstrap scripts with native CI setup and separates package feeds.
  • Removes template automation, obsolete pipelines, and unused tooling.
File Description
tools/​variables/​ProfilingInputsDropName.ps1 Removes profiling-drop variable helper.
tools/​variables/​BusinessGroupName.ps1 Removes archival metadata helper.
tools/​Set-EnvVars.ps1 Removes bootstrap environment helper.
tools/​MergeFrom-Template.ps1 Removes template merging script.
tools/​Install-NuGetPackage.ps1 Removes package-install helper.
tools/​Install-NuGetCredProvider.ps1 Removes custom credential-provider installer.
tools/​Install-DotNetSdk.ps1 Removes custom SDK installer.
tools/​Get-ProcDump.ps1 Adds explicit feed configuration and failure handling.
tools/​Get-LibTemplateBasis.ps1 Removes template ancestry lookup.
tools/​Convert-PDB.ps1 Uses official package-feed configuration.
tools/​Check-DotNetSdk.ps1 Removes SDK detection helper.
tools/​Check-DotNetRuntime.ps1 Removes runtime detection helper.
tools/​artifacts/​VSInsertion.ps1 Removes OptProf artifact collection.
test/​Restore.Tests.ps1 Removes bootstrap retry tests.
test/​Microsoft.Windows.CsWin32.Tests/​MyReferenceAssemblies.cs Selects feeds by build environment.
test/​Directory.Build.targets Adds generation-tool build dependencies.
test/​Directory.Build.props Makes MicroBuild dependency conditional.
SUPPORT.md Removes standalone support guidance.
src/​VSInsertionMetadata/​VSInsertionMetadata.targets Removes profiling metadata targets.
src/​VSInsertionMetadata/​ProfilingInputs.props Removes profiling input placeholder.
src/​VSInsertionMetadata/​Library.VSInsertionMetadata.proj Removes template metadata project.
src/​OptProf.targets Removes profiling configuration.
src/​Microsoft.Windows.CsWin32/​Microsoft.Windows.CsWin32.targets Prevents reference rebuilds during no-build packing.
README.md Adds standard build instructions.
nuget.config Separates local sources using package mapping.
Microsoft.Windows.CsWin32.slnx Adds XML solution definition.
Microsoft.Windows.CsWin32.sln Removes replaced solution format.
init.ps1 Removes PowerShell bootstrap.
init.cmd Removes command-shell bootstrap.
Directory.Solution.targets Builds solution before packing when required.
Directory.Packages.props Gates MicroBuild package inclusion.
Directory.Build.props Separates local and MicroBuild configuration.
COPYRIGHT Removes standalone copyright notice.
CONTRIBUTING.md Documents revised development and official workflows.
CodeQL.yml Removes legacy classification configuration.
azure-pipelines/​vs-validation.yml Removes optional insertion-validation pipeline.
azure-pipelines/​unofficial.yml Removes obsolete exclusions and OptProf comments.
azure-pipelines/​PostPRMessage.ps1 Removes validation comment helper.
azure-pipelines/​OptProf.yml Removes profiling pipeline.
azure-pipelines/​OptProf_part2.yml Removes profiling continuation pipeline.
azure-pipelines/​official.yml Removes commented OptProf options.
azure-pipelines/​NuGetSbom.props Houses official-build output settings.
azure-pipelines/​nuget.config Adds dedicated official feed configuration.
azure-pipelines/​microbuild.before.yml Removes OptProf-specific setup.
azure-pipelines/​microbuild.after.yml Removes profiling artifact publishing.
azure-pipelines/​libtemplate-update.yml Removes Azure template-update automation.
azure-pipelines/​integration-test.yml Installs SDKs through native task.
azure-pipelines/​install-dependencies.yml Replaces bootstrap with native setup and restores.
azure-pipelines/​Get-InsertionPRId.ps1 Removes validation insertion lookup.
azure-pipelines/​dotnet.yml Removes profiling-only execution branch.
azure-pipelines/​build.yml Simplifies jobs and updates dependency setup.
azure-pipelines/​archive-sourcecode.yml Removes source archival pipeline.
azure-pipelines/​Archive-SourceCode.ps1 Removes archival request helper.
azure-pipelines.yml Removes obsolete editor-path exclusion.
.vscode/​tasks.json Removes workspace build task.
.vscode/​settings.json Removes workspace editor settings.
.vscode/​launch.json Removes debugger attachment configuration.
.vscode/​extensions.json Removes extension recommendations.
.prettierrc.yaml Removes unused formatter configuration.
.github/​workflows/​libtemplate-update.yml Removes GitHub template-update automation.
.github/​workflows/​docs.yml Uses native SDK setup and tool restore.
.github/​workflows/​docs_validate.yml Updates runner and documentation setup.
.github/​workflows/​copilot-setup-steps.yml Uses native SDK setup and package restore.
.github/​workflows/​build.yml Separates build, pack, and test setup.
.github/​actions/​publish-artifacts/​action.yaml Removes unused publishing action.
.editorconfig Defines SLNX indentation.
.config/​dotnet-tools.json Removes unused CLI tools.

Review effort: Balanced

@jevansaks

Copy link
Copy Markdown
Member

Hi Tera (@0x5bfa)! Thanks for the contribution. I think you've identified a bunch of good cleanup here but also a bunch of the pipelines stuff is in "if it ain't broke, don't fix it" territory for me.

I'm curious if you had specific problems or challenges working in the codebase that you're trying to fix? Taking some of the .slnx cleanup is righteous but also isn't a problem day-to-day for me...

Perhaps if we separate this out into smaller PRs it'll be easier to work through.

Also would like Andrew Arnott (@AArnott)'s feedback on the pipeline / template changes since he had been keeping those in sync and I haven't been clear on which parts of the repo we try to take as copies of that.

I don't necessarily mind forking as long as we understand what we're giving up by maintaining our own infra pieces.

@0x5bfa

Tera (0x5bfa) commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks for the reply, this was kinda demo PR to demonstrate how we can simplify the codebase (approx. 2800 loc deletion). Here we have multiple changes in one PR:

  • Simplification of building the app
  • Simplification of the CD pipeline
  • Removal of Library.Template, thus simplification of project configuration

Particularly, 1st and 3rd should be easier to do, and I agree I shouldn't touch the CD pipeline as it is heavily associated to the closed Azure DevOps Pipelines dashboard. I also understand it may be wise to keep things not broken as is but the pipeline is incredibly entangled and nearly to the point we as humans never can maintain. It's really nice if we can discuss this.

If you have some ideas, please share, I will contribute!

@jevansaks

Copy link
Copy Markdown
Member

I'm open to the simplification of the building the app (slnx and other cleanup). I'd want to wait to hear from Andrew Arnott (@AArnott) for feedback on the other cleanup. Right now the pipelines are working fine for us so I don't see a need to change them and renovate bot is doing fine to keep dependencies up to date but if anything needs to change (e.g. there's a potential I need to move the pipelines to a different ADO instance), then this could be cleanup worth taking.

@AArnott Andrew Arnott (AArnott) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've definitely found a lot of crap that can be ripped out. Overall I think this is a Good Change.
In Library.Template's defense, some of the improvements you've made (e.g. sln->slnx) are also in library.template but this repo hasn't taken an update in a long time.
And some changes I feel are backward (e.g. deleting the init scripts). And some are there for compliance and legal stuff and should probably remain.

Comment thread nuget.config
</config>
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Microsoft policy forbids us from pulling directly from nuget.org. This change must be reverted.
Or perhaps our own builds use the new nuget.config file you created under azure-pipelines/. I couldn't find where in the changes you cause our build to reference that file. But that might be an acceptable way to make it easier for 3rd parties to pull packages from nuget.org while our official builds only pull them from our azure artifacts feed.

Comment thread CONTRIBUTING.md

* Use Windows PowerShell or [PowerShell Core][pwsh] (including on Linux/OSX) to run .ps1 scripts.
Some scripts set environment variables to help you, but they are only retained if you use PowerShell as your shell.
Install the [.NET SDK](https://get.dot.net/) specified in `global.json` (or a newer patch in the same SDK feature band). On Windows, open `Microsoft.Windows.CsWin32.slnx` in a Visual Studio version that supports that SDK and C# 14, then build the solution. No initialization script, CLI tool restore, or custom shell environment is required.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting the right SDK version is several steps for a human. You removed init.ps1 which automated this. That seems like a step backwards.

Comment thread .config/dotnet-tools.json
],
"rollForward": false
},
"nerdbank.dotnetrepotools": {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a convenient CLI tool that I use in all my repos. I don't actively work in CsWin32 at this point, so I'd leave it to Jevan Saks (@jevansaks) to decide whether he wants to keep it. Leaving it here for folks that want it doesn't seem harmful though, IMHO.

Comment thread .config/dotnet-tools.json
"version": 1,
"isRoot": true,
"tools": {
"powershell": {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is helpful for non-Windows users to easily acquire and use powershell via dotnet pwsh. It's not required but it's very handy for some users.
Now, for this repo in particular how many users are on non-Windows machines? Not many, perhaps.

Comment thread azure-pipelines/build.yml
##### but we use parameters because they support rich types and defaults.
##### Feel free to adjust their default value as needed.

# Whether this repo uses OptProf to optimize the built binaries.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm both confused and amazed at your changes to this directory. I don't know who you are but your github profile suggests you're not affiliated with Microsoft. Yet your changes to builds that I expect you don't have visibility into is both confident and.... at least mostly accurate, at least insofar as a code review can tell.

Comment thread COPYRIGHT
@@ -1,2 +0,0 @@
Copyright (c) Microsoft Corporation. All rights reserved.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you should be removing our copyright notice.

Comment thread CodeQL.yml
@@ -1,3 +0,0 @@
path_classifiers:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why you're removing our CodeQL config file. I think it should stay unless Jevan Saks (@jevansaks) knows we don't need it.

Comment thread SUPPORT.md
@@ -1,13 +0,0 @@
# Support

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you should be removing our SUPPORT disclosure file.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants