How can we help you today? How can we help you today?
Jon Kirkwood
Hi PradnayaN,  Thanks for reaching out on the Redgate forums. This sounds like an issue with obfuscating assemblies that are involved in reflection, dependency injection, or are entry points.  We recommend starting with minimal obfuscation settings and excluding the main assembly and any shared contracts or reflection-heavy code to ensure runtime stability.   Here are some initial steps to try first to see if you can clear your issues with obfuscation Don't Obfuscate Entry Point or Shared Contracts Exclude: Program.dll or main project. Any shared interfaces or base class libraries (used in reflection or dependency injection). DTOs, gRPC contracts, Razor components, etc. ➜ Use [DoNotObfuscate] or SmartAssembly project file filters. Turn Off Type/Method Renaming for Reflection-Heavy Code If you use: Dependency Injection Reflection JSON serialization/deserialization ➜ Obfuscated names won’t match expected strings. Fix: Add [Obfuscation(Exclude = true)] or exclude via SA project rules. Assembly Load Failures? If your app dynamically loads assemblies, you must not obfuscate public types or names unless explicitly handled. ➜ Check AppDomain.AssemblyResolve or plugin patterns. Use Debug Logs or Fusion Log Viewer Might help to catch missing method/assembly load failures. Minimal Working Obfuscation Start with: <Obfuscation NameMangling="0" FieldsNameMangling="0" /> Then incrementally raise levels after testing that the previous setting worked.  / comments Official comment
Hi PradnayaN, Thanks for reaching out on the Redgate forums.This sounds like an issue with obfuscating assemblies that are involved in reflection, dependency injection, or are entry points. We reco...
0 votes
Hi rick105,   Thank you for reaching out on the Redgate forums regarding your SmartAssembly concern. Interesting that you have a variance between VS build process over running it through SmartAssembly GUI directly. Since your other .NET 8.0 projects obfuscate correctly, here are some things to check:   1️⃣ Compare SA Logs (Build vs. UI) – Check if the build log shows SA skipping obfuscation or using the wrong input/output paths. 2️⃣ Check the SmartAssembly Project File (.saproj) – Open it in a text editor and compare it to a working one. Make sure dependency merge/embed settings match. 3️⃣ Investigate MSBuild Process – Run MSBuild /verbosity:diagnostic to see if SA is being invoked properly for this project. 4️⃣ Check the SA Task in .csproj – Verify that SA is actually being triggered. You might have something like: <Target Name="AfterBuild"> <Exec Command=""$(SmartAssemblyPath)\SmartAssembly.com" /build MyProject.saproj" /> </Target> Try running this command manually to see if it works outside the build.   5️⃣ Check Dependencies – Does this project reference anything different, like native libraries or unmanaged code? 6️⃣ Rebuild from Scratch – Try a full clean (bin/obj deletion) and test with a fresh SA project file.   If nothing stands out, feel free to share your SA logs and .saproj file so we can investigate further I have generated a secure file-link to provide any logs/project files. This link is valid for 14 days. https://files.red-gate.com/requests/CHkY0nxjxnmEUmVu8HZACE / comments Official comment
Hi rick105, Thank you for reaching out on the Redgate forums regarding your SmartAssembly concern.Interesting that you have a variance between VS build process over running it through SmartAssembly...
0 votes
Hi rick105   Thank you for reaching out on the Redgate forums regarding your SmartAssembly question regarding obfuscating into a single file app. When publishing a .NET application as a single file, SmartAssembly can still obfuscate it, but some extra steps are required since the assembly is embedded within the single file executable.  Here’s a possible method on how this can be achieved  1. Publish Without Single File First SmartAssembly needs access to the raw assembly (.dll ) before it gets bundled into a single file. Publish your app without the PublishSingleFile option first: dotnet publish -c Release -r win-x64 --self-contained false This generates a normal set of .dll files in the bin\Release\netX\publish\ folder. 2. Obfuscate with SmartAssembly Open SmartAssembly and create a new project. Add your main application .dll (e.g., MyApp.dll ). Configure obfuscation, string encryption, control flow obfuscation, etc. Build the obfuscated .dll . 3. Publish as Single File Manually Now, repackage the obfuscated assembly into a single file: Replace the original .dll with the obfuscated version. Run the dotnet publish command with single file enabled: dotnet publish -c Release -r win-x64 -p:PublishSingleFile=true -p:IncludeAllContentForSelfExtract=true --self-contained false  The IncludeAllContentForSelfExtract=true ensures embedded assemblies can still be loaded properly. 4. Test the Application Run the generated .exe and verify functionality. Use a decompiler to confirm that obfuscation is applied. Hopefully this process can be used to obfuscate your project and end with a single file executable as desired. / comments Official comment
Hi rick105 Thank you for reaching out on the Redgate forums regarding your SmartAssembly question regarding obfuscating into a single file app.When publishing a .NET application as a single file, S...
0 votes