Skip to content
| Marketplace
Sign in
Visual Studio>Tools>Source Generator Auto Update
Source Generator Auto Update

Source Generator Auto Update

Alexander Gayko

|
373 installs
| (3) | Free
Updates the .csproj of source generators so they can be developed as ProjectReferences without requiring a test framework.
Download

Assembly Name Auto Update for Source Generators

NEW ARM64 support (please give feedback, i cannot easily test this.)

Summary

This extension automatically modifies the AssemblyName of a given assembly (.csproj) and reloads a set of dependent projects in a soltution.

Note: This is still a work in progress, so the following steps might change, going forward.

Support

I created a github repo here where issues can be created: support repo Also, there's a demo repo that shows how the extension works here: demo repo

Usage:

  • Add a file named AutoUpdateAssemblyName.txt into the root folder of the solution (Solution Items in the Solution Explorer). This file contains the project names of the projects you want to unload + reload when the project is built, one per line. It now also allows for either paths to the .csproj file (which will be resolved from the solution directory, apparently) and nested solution-specific relative paths (if you don't have a .csproj extension.

Note: comments (lines beginning with ', rem, #, -- or //) as well as whitespace-only lines are ignored.

  • In the .csproj of the Source generator project (which should be line1, see above), add a comment <!--AutoUpdateAssemblyName--> somewhere.
  • Also in the .csproj, in the <AssemblyName> property, make sure to add a . followed by a number at the end of the Assembly Name, so the extension knows what to increment. I'm not doing anything, if i can't find that.

Note: currently, the .csproj parsing is very crude - i just pick the first part between <AssemblyName> and </AssemblyName> split that on ., and try to increment the last split part there. See TODOs further down.

TODO

  • Improve .csproj parsing to enable conditional AssemblyNames (e.g. I only want to add a suffix when in DEBUG)
  • Only look at AutoUpdateAssemblyName.txt when it's changed, not on each build (it's a small file, so that shouldn't matter, but ... well ...

Changelog

  • 1.6 - (hopefully) fixed VS crash because of an Error with DTE.ActiveDocument - using VS.Documents.GetActiveDocumentViewAsync now...
  • 1.5 - Added arm64 compatibility (please give feedback)
  • 1.4.2 - enabled finding nested projects for restarting, improved (hopefully, please give feedback) reloading
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2023 Microsoft