Hamza Ahmed
Hamza Ahmed

Reputation: 1791

How can I reduce the size of rosyln folder in asp.net mvc project?

I am developing an asp.net mvc 5 application with .net f/w 4.7 using C# which eventually will be deployed to azure.

Looking into the bin folder (both Debug and Release) after building my project I found a roslyn folder 15.7MB in size.

Investigating further I found couple of huge dll's such as Microsoft.CodeAnalysis.VisualBasic , Microsoft.CodeAnalysis.CSharp and Microsoft.CodeAnalysis to name a few.

Additionally there is vbc.exe (Visual Basic Compiler) which I am not using since I'm developing with C#

Following is a screen grab of my roslyn folder and nuget packages

Rosyln Folder

Nuget Packages

My question is

How can I reduce the size of the rosyln folder by identifying and removing unnecessary dll's specially vb related dll's.

Researching I found these msdn, so,so1 links which explain the some C# 6 features will be unavailable if I uninstall Microsoft.CodeDom.Providers.DotNetCompilerPlatform so is that a real viable solution going forward?

Help.

Upvotes: 2

Views: 712

Answers (1)

Gerben
Gerben

Reputation: 363

The folder is there to support dynamic compilation. So if you want that then it is not bloat and you should include it. If you want to remove it though you can follow these steps.

  1. Remove "Microsoft.CodeDom.Providers.DotNetCompilerPlatform" and "Microsoft.Net.Compilers" packages. (Some c# 6 feature will no longer work if you do not follow step 2)
  2. In your publish profile settings, uncheck "Allow precompiled site to be updatable". You can find this under Settings > Precompile during publishing > configure. (This disables dynamic compilation and everything is precompiled.)

Upvotes: 1

Related Questions