jmoreno
jmoreno

Reputation: 13561

How to determine if Microsoft.VisualStudio.Web.CodeGeneration.Design is being used?

I have a reasonable (although imprecise) idea as to what source generators do, but I have several projects in a solution that reference Microsoft.VisualStudio.Web.CodeGeneration.Design and the projects don't (to the best of my knowledge) have any source generators.

Given that this is source generation, I might be mistaken about the usage or it could be used indirectly. How can I determine whether it is safe to remove the reference? There isn’t anything else in the CodeGeneration namespace in the solution.

Upvotes: 2

Views: 896

Answers (2)

david-ao
david-ao

Reputation: 3160

That package is used to scaffold various aspects in web projects:

Probably those projects have been created/updated with scaffolding, that is the reason of the reference to Microsoft.VisualStudio.Web.CodeGeneration.Design package

It seems that is needed only if developing via cli:

Microsoft.VisualStudio.Web.CodeGeneration.Design - Code Generation tool for ASP.NET Core. Contains the dotnet-aspnet-codegenerator command used for generating controllers and views.

dotnet-aspnet-codegenerator is only required to scaffold from the command line, it's not needed to use scaffolding with Visual Studio.

Upvotes: 4

YungDeiza
YungDeiza

Reputation: 4530

It's generally safe to remove a reference which doesn't prevent compilation when absent.

Microsoft.VisualStudio.Web.CodeGeneration.Design seems like a very weird thing to reference in a project - I believe it's used for generating the default code for views & controllers so I'm pretty sure it can be removed as long as it still compiles.

Upvotes: 0

Related Questions