Tuesday, September 25, 2018

Removing NuGet dependencies on an empty ASP.NET project

I noticed that just making an empty ASP.NET project introduces a NuGet dependency due to Microsoft.CodeDom.Providers.DotNetCompilerPlatform. I believe this has something to do with code-analysis or analytics. However, I really don't care about it. On the other hand, if your build-server is not internet connected (for security), then this causes builds to fail.

How to remove this dependency?

There are two places where "stuff" end up due to this dependency:

1. Your web.config. remove the <system.codedom/> section altogether!


2. Your .csproj file will have a few different entries you need to remove: 
2.1. The imports

2.2. The reference

2.3. The packages.config file

2.4. The Target for NuGet


Once you remove these, you will no longer need NuGet for the empty / skeleton ASP.NET application.

.

No comments: