Orlando Helmer Orlando Helmer - 1 month ago 60
C# Question

CSC : error CS7038: Failed to emit module

After installing Visual Studio 2015 and building my project I receive the error


"CSC : error CS7038: Failed to emit module".


However my solution is building fine in Visual Studio 2013.

It is an ASP.NET webforms project .NET 4.0

Anyone?

UPDATE: it looks like the problem has to do with Red Gate Smart Assembly in combination with method parameters with default values.

UPDATE: Smart Assembly 6.9 fixes the error for me.

Answer

Got the same error (fresh installation of the VS2015 Enterprise, ASP.NET webforms project .NET 4.0).

After some investigation I've found that there are two DLLs in references which causes this. Both are .Net 2.0 assemblies and both of them obfuscated by Red Gate Smart Assembly 6.5. And the real reason is... obfuscation.

Luckily, these assemblies are mine, so I've tried to build them without using of Smart Assembly - error is gone.

Interesting is that no any errors or warnings shown by Visual Studio before trying to build a project.

Good luck!

EDIT: Updating Smart Assembly to version 6.9 fixed an issue.