I've created a new asp.net core 2.0 mvc web app using Visual Studio 2017.
It has a reference to NuGet package "Microsoft.VisualStudio.Web.CodeGeneration.Design" (2.0.0) which, it appears is required if I want to be able to scaffold views/controllers. (A feature which I require)
When I publish my web app, I wouldn't expect to see what (appears to be) a development dependency being published to my output folder... and yet, I have a bunch of assemblies such as
Microsoft.VisualStudio.Web.CodeGeneration.dll, Microsoft.VisualStudio.Web.CodeGeneration.Templating.dll, Microsoft.VisualStudio.Web.CodeGeneration.Utils.dll
etc.
Am I doing something wrong? : How can I reduce all these extra dlls? There's one (Microsoft.CodeAnalysis.Workspaces.dll) which is ~2Mb!
Try editing the csproj file to replace the PackageReference elements for those packages with DotNetCliToolReference elements, e.g.
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.3" PrivateAssets="All" />
becomes
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.3" />
With this change, those packages should still be available as tools but will not be included with the packaged website.
See dotnet core PackageReference vs DotNetCliToolReference
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With