Dotfuscator "Could not find compatible version of ildasm"
Asked Answered
B

5

8

Have any of you had this problem before?

I'm trying to obfuscate a solution written in C#/.NET 3.5 on Visual Studio 2008 SP1 on a machine running Windows 7 Professional SP1, and keep getting the same error when using Dotfuscator Community Edition

Could not find a compatible version of ildasm to run on assembly (valid path to solution output exe). This assembly was originally built with .NET Framework v2.0.50727

I've tried Googling and nothing much has helped so far (either that, or my Google-Fu is failing me).

I've tried re-installing the Windows SDK, and re-installing Visual Studio 2008, but neither have helped.

I'm assuming that it's Dotfuscator Community edition that's causing the problem, because a colleague is using the same xml settings file on his machine, and it obfuscates the solution no problem.

My idea is that, as it says in the error message, Dotfuscator cannot find an ildasm (the library/function used to obfuscate?) file that is compatible with .NET 3.5, only .NET 2.x. Is this a correct asusmption?

Dotfuscator had been working fine, previously. But, after a recent round of Windows updates it no longer seems to work on my machine - some of the recent Windows updates have caused havok with the network and some colleagues laptops (revoking login credentials, invalidating certain programs, the usual), that's why I'm assuming it's one of the updates that has caused this.

Of course, I'm not adverse to putting it down to user error, except for the fact that the same settings file and solution outputs are not causing Dotfuscator to fail on a colleague's machine.

Any suggestions?

Bury answered 13/7, 2012 at 11:7 Comment(0)
J
2

As you've guessed, this is due to Dotfuscator failing to find the proper version of ildasm for the assembly provided to it. Dotfuscator obfuscation is performed via disassembling, altering, and reassembling the assembly, so it requires versions of ilasm/ildasm that match the assembly's target version.

Dotfuscator will search in \Windows\Microsoft.NET\Framework{FrameworkVersionHere} for the proper version of ilasm and ildasm, IIRC. Do you have those executables in \Windows\Microsoft.NET\Framework\v2.0.50727? If not, you'll need to get them in there - installing .NET framework 2.0 should do so (or just copy from a colleague's computer).

Edit to reflect comments below: We found that reinstalling the Windows SDK fixed the issue, likely because the Windows SDK's registry settings had been wiped out.

Jovanjove answered 17/8, 2012 at 23:17 Comment(10)
Sorry for the late reply. I've checked in the .Net framework directory. In each of the sub-directories (image here: imgur.com/x7wzQ) there is a version of ilasm and ildasm, except for 3.5 - which is the version of .Net we're building against.Bury
Is your colleague using Dotfuscator Pro? Or also using CE?Jovanjove
CE, as am I. Is there a huge amount of difference?Bury
In some ways yes, in others no - I just wanted to see if it was a CE vs Pro difference. Because CE is "in the box" with Visual Studio, it has a different patch release cycle than Pro. But if you're both using CE, on VS2008 SP1, it means there's no code or patch difference. Sounds like it's definitely some goofy environment issue.Jovanjove
Alright, soooo - needed a little search time there - for .NET 2.0 and above, the Windows SDK installs the .NET SDK with them. You can find the Windows SDK for 2.0-3.5 here : link Try re-installing this. If your windows SDK registry entries were damaged, it can result in Dotfuscator being unable to figure out where the proper version of ildasm is. In short, Dotfuscator will not attempt any "magic" if Windows can't tell it where ildasm should be. We can debate if that's proper, but that's how it is :)Jovanjove
If re-install doesn't work for some reason, this link discusses the SDK registry keys : link The important thing to note is that the top level key describes which sub-key has the SDK installer (6.0 probably), and then that sub-key will have the path to the SDK bins. That path is what Dotfuscator is looking for.Jovanjove
Wow! Thank you for the huge amount of information. I'll try re-installing the SDK first, then start investigating the registry keys (especially since the SDK installer says it'll take an hour or so).Bury
Re-installing the Windows SDK seems to have fixed it. Thanks for the input.Bury
-1 In arriving at my answer, I spent a long time putting ILDASM different places including every combination of 2.0/3.5/4.0 and x86/x64 CLRs. @Jovanjove I tried messing about with the reg entries as per your cited post - I'm still not sure that's how the location is derived. Note the docs PDF in the install directory is pretty much worse than useless too.Popliteal
I'm not sure why you were unhappy with the information I posted - at the time I wrote this I was a PreEmptive employee, and got the "check the registry" information by looking at the source code. It doesn't really get much more definitive than that. I notice I didn't disclaim that I worked at PreEmptive in the original response, though, sorry.Jovanjove
K
16

I had to add these four lines into my dotfuscator project file to resolve the problem:

<dotfuscator version="2.3">   
   <propertylist>
      <property name="ILDASM_v2.0.50727" value="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\ildasm.exe" />
      <property name="ILDASM_v4.0.30319" value="C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\ildasm.exe" />  
   </propertylist>

In general dotfuscator may miss any version of ildasm. It says what version is missing in error message. Just define propertiy with your specific version.

Kymric answered 29/4, 2014 at 19:16 Comment(0)
J
2

As you've guessed, this is due to Dotfuscator failing to find the proper version of ildasm for the assembly provided to it. Dotfuscator obfuscation is performed via disassembling, altering, and reassembling the assembly, so it requires versions of ilasm/ildasm that match the assembly's target version.

Dotfuscator will search in \Windows\Microsoft.NET\Framework{FrameworkVersionHere} for the proper version of ilasm and ildasm, IIRC. Do you have those executables in \Windows\Microsoft.NET\Framework\v2.0.50727? If not, you'll need to get them in there - installing .NET framework 2.0 should do so (or just copy from a colleague's computer).

Edit to reflect comments below: We found that reinstalling the Windows SDK fixed the issue, likely because the Windows SDK's registry settings had been wiped out.

Jovanjove answered 17/8, 2012 at 23:17 Comment(10)
Sorry for the late reply. I've checked in the .Net framework directory. In each of the sub-directories (image here: imgur.com/x7wzQ) there is a version of ilasm and ildasm, except for 3.5 - which is the version of .Net we're building against.Bury
Is your colleague using Dotfuscator Pro? Or also using CE?Jovanjove
CE, as am I. Is there a huge amount of difference?Bury
In some ways yes, in others no - I just wanted to see if it was a CE vs Pro difference. Because CE is "in the box" with Visual Studio, it has a different patch release cycle than Pro. But if you're both using CE, on VS2008 SP1, it means there's no code or patch difference. Sounds like it's definitely some goofy environment issue.Jovanjove
Alright, soooo - needed a little search time there - for .NET 2.0 and above, the Windows SDK installs the .NET SDK with them. You can find the Windows SDK for 2.0-3.5 here : link Try re-installing this. If your windows SDK registry entries were damaged, it can result in Dotfuscator being unable to figure out where the proper version of ildasm is. In short, Dotfuscator will not attempt any "magic" if Windows can't tell it where ildasm should be. We can debate if that's proper, but that's how it is :)Jovanjove
If re-install doesn't work for some reason, this link discusses the SDK registry keys : link The important thing to note is that the top level key describes which sub-key has the SDK installer (6.0 probably), and then that sub-key will have the path to the SDK bins. That path is what Dotfuscator is looking for.Jovanjove
Wow! Thank you for the huge amount of information. I'll try re-installing the SDK first, then start investigating the registry keys (especially since the SDK installer says it'll take an hour or so).Bury
Re-installing the Windows SDK seems to have fixed it. Thanks for the input.Bury
-1 In arriving at my answer, I spent a long time putting ILDASM different places including every combination of 2.0/3.5/4.0 and x86/x64 CLRs. @Jovanjove I tried messing about with the reg entries as per your cited post - I'm still not sure that's how the location is derived. Note the docs PDF in the install directory is pretty much worse than useless too.Popliteal
I'm not sure why you were unhappy with the information I posted - at the time I wrote this I was a PreEmptive employee, and got the "check the registry" information by looking at the source code. It doesn't really get much more definitive than that. I notice I didn't disclaim that I worked at PreEmptive in the original response, though, sorry.Jovanjove
P
2

I wasted the guts of a day discovering that v4.9 requires SDK version 7.0 (and not 7.1 or 8.0) to 'find' ILDASM.

Still not sure if the lookup is registry-based.

TODO: Analyse what it takes to re-break it to figure out if the discovery is based on location or registry. Preemptive really could document this better and/or give more detailed errors. Have a question regarding this pending moderation on the Preemptive forum

Popliteal answered 2/8, 2013 at 15:50 Comment(3)
DISCLAIMER: Dotfuscator employee. It is registry based, will be making some updates soon to deal with this better. However, you can always override the location manually, see this part of the User Guide: preemptive.com/images/stories/dotfuscator_documentation/…Czarism
@Czarism Thanks for the response. I'm obfuscating heaps of stuff and dont want to adjust my build scripts / dotfucator.config files - At the start of this I wanted to know why it had stopped working. It'd be great to see some details in a response to my forum Q (but here is even better if that suits. Unfortunately I wont be responseive for next 2 weeks as going on hols.Popliteal
@Czarism My moderated question has since been posted, (incompletely) answered and I have further detailed my concerns in preemptive.com/forum/… - This is no longer urgent for me personally as our build rig works but it really would be nice if the message could be more helpfulPopliteal
X
1

The problem is the install of visual studio with integrated dotfuscator. Take dosfuscator out or reinstal visual studio without dotfuscator.

Xanthippe answered 2/3, 2013 at 9:53 Comment(0)
R
1

I had the same issue. Dotfuscator 4.9.8500 is not looking up the SDK tools for .NET 4.0 correctly - it assumes the path is found under this key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0\WinSDK-NetFx40Tools

None of the SDK installers populate this key - it seems VS2010 did (which we don't use anymore). I did not want to instrument my build for this, as we have dozens of branches with variations of the Dotfuscator config.

We're migrating to Dotfuscator 4.16.0, which doesn't have this issue (thanks to @mletterle above?), but we have to roll this out incrementally because of other knock-on effects.

My workaround for 4.9.8500: on our build agents, install the .NET 4.5.2 developer pack, then add the below to the registry, which redirects Dotfuscator to the 7.1 .NET 4.0 tools folders. Notice that the keys say "7.0" while the paths say "7.1". Backup the registry folder first!

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0\WinSDK-NetFx40Tools]
"ProductVersion"="7.1.7600.0.30514"
"ComponentName"="Windows SDK Tools for .NET Framework 4.0"
"InstallationFolder"="C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\Bin\\NETFX 4.0 Tools\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0\WinSDK-NetFx40Tools-x64]
"ProductVersion"="7.1.7600.0.30514"
"ComponentName"="Windows SDK Tools for .NET Framework 4.0 (x64)"
"InstallationFolder"="C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\Bin\\NETFX 4.0 Tools\\x64\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0\WinSDK-NetFx40Tools-x86]
"ProductVersion"="7.1.7600.0.30514"
"ComponentName"="Windows SDK Tools for .NET Framework 4.0"
"InstallationFolder"="C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\Bin\\NETFX 4.0 Tools\\"
Raynold answered 28/11, 2014 at 11:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.