1

I'm trying to obfuscate my Razor app with SmartAssembly, but I've ran into a problem.

I have lots of Razor (cshtml) pages in my app that all contain references to many different types across the project. This is a problem, because the cshtml files are not compiled during deployment, and the obfuscation process doesn't affect them. This leads to a ton of TypeLoadExceptions and MissingFieldExceptions, because as the cshtml files are being compiled during runtime, the C# code in them references the original, non-obfuscated types.

I've tried enabling PrecompileBeforePublish hoping that it would separate the C# from the HTML so it can be processed by SmartAssembly, but the pages don't seem to be compiled in the build.

Is there a setting somewhere in SmartAssembly that enables Razor support, or can I do something with my ASP.NET Core project to make obfuscation possible?

ASP.NET Core Version: 3.1 SmartAssembly Version: 7.5

Lázár Zsolt
  • 685
  • 8
  • 29

0 Answers0