Skip to content

What do you think about Visual Studio Marketplace? We are looking for feedback from developers like you! Take the survey

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

Source Generator Auto Update

Alexander Gayko

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

Assembly Name Auto Update for Source Generators

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.

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.

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 ...
  • Contact us
  • Jobs
  • Privacy
  • Terms of use
  • Trademarks
© 2023 Microsoft