msbuildvisual-studio-2019obfuscationdotfuscator

Dotfuscator says "was expecting one of:" when building in Visual Studio


I've got a solution in Visual Studio that includes a Dotfuscator project. The exact same code base builds and obfuscates correctly on another machine (my old laptop), but not on my newly setup laptop. Of course we let our support contract expire since this is used on a legacy project.

The output during the build is:

8>Compiling Project  MyAppObfuscation ...
8>Dotfuscator Professional Version 4.41.1.9417-95d9eec7a
8>Copyright 2002-2019 PreEmptive Solutions, LLC All Rights Reserved.
8>Use of this software implies acceptance of accompanying license agreement.
8>Build machine license. This software may be used on binaries for general release.
8>
8>Your protection is out of date. Learn more at https://www.preemptive.com/keep-your-protection-up-to-date?product=dotfuscator&sku=pro&version=4.41.1.9417. Upgrade at https://www.preemptive.com/products/dotfuscator/downloads.
8>
8>Loading Assemblies...
---several of these lines---
8>Running ...\ildasm.exe /OUT=...\MyApp.exe.il /TEXT /NOBAR /RAWEH /QUOTEALLNAMES /UTF8 /LINENUM /FORWARD "...\MyApp.exe"
8>
--- immediately followed by: ---
8>Encountered - at line 18065, column 26.
8>Was expecting one of:
8>    <FLOAT64> ...
8>    "float64" ...
8>    "float32" ...
8>    <INT> ...
8>    "(" ...
8>    
8>Build Error.
8>MyAppObfuscation build failed.

Has anyone encountered this? I'm inclined to believe it's something on the new machine, but if anyone has tips about diagnosing this I would appreciate it.

Thanks!

Edit: Just wanted to add the same error happens in Visual Studio and the Dotfuscator Professional Config Editor.

Edit 2: Upon further inspection, the folder listed in the /OUT parameter of ildasm doesn't contain a .il file for the last ildasm command. The output folder for the assemblies prior to the .exe DO have a .il file. So, I thought ildasm might be failing on the .exe, but I can copy the command into a command prompt and it runs correctly and creates an .il file as expected. So, why would ildasm not work when run from Visual Studio, but would work from the command line -- and only for one assembly / exe in the project?

The mystery grows...


Solution

  • Solved it! I opened Visual Studio Installer on both the old and new machine to compare what features were installed on the old one vs the new one. Most notably, one of the missing features on the Individual components tab was an older .NET Framework SDK (4.6.1 in my case) and an older Windows 10 SDK (10.0.17763.0 in my case).

    I hope someone else finds this helpful.