从发布版本中排除脚手架包是否安全?

Is it safe to exclude Scaffolding packages from publish version?

我在一个项目中有Microsoft.VisualStudio.Web.CodeGeneration.Design nuget

是否可以安全地排除发布(<ExcludeAssets>runtime</ExcludeAssets>)?

是否存在在运行时代码依赖于此包的情况?

据我了解,此包仅用于在开发期间生成代码。

我看不出有任何理由在已发布的代码中添加它的 dll。

Is it safe to exclude Scaffolding packages from publish version?

the package所述,

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

它仅适用于在开发过程中为视图或控制器生成代码,项目本身在运行时不依赖于包。

因此使用您的方法将 nuget 包排除在发布之外是安全的。而且您不必太担心它。