Cannot obfuscate using MSBuild

Mikhail GirkinMikhail Girkin Posts: 6
edited June 26, 2013 10:11AM in SmartAssembly

We are experiencing strange problems with RedGate SmartAssembly while obfuscating a solution using MSBuild.

Let me explain in detail.

1) The error we've got:
SmartAssembly build failed:
Cannot find dependency 'Interop.SHDocVw, Version=, Culture=neutral, PublicKeyToken=null', which is required for assembly:
AxInterop.SHDocVw, Version=, Culture=neutral, PublicKeyToken=null
HTMLEditorControl, Version=1.0.4923.24795, Culture=neutral, PublicKeyToken=49fa31e76fed3520
OrganizationWeaver, Version=, Culture=neutral, PublicKeyToken=49fa31e76fed3520

Ensure that this dependency is in the main assembly folder, or in the Global Assembly Cache (GAC).

2) We tried to do this on various computers, and all of them got the error like that. But it happened with different dll's (NLog, Antlr3.Runtime)

3) .saproj file contains:
<Assembly AssemblyName="Interop.SHDocVw, Version=, Culture=neutral, PublicKeyToken=null" MandatoryPath="..\Prereqs\Interop.SHDocVw.dll">
<Merging Merge="0">
<Pruning Prune="0">
<Exclusion />
<Obfuscation Obfuscate="0">
<Exclusion />
<ControlFlow Obfuscate="0" />
<MemberRefsProxy Proxy="0" />
<ResourcesCompression />
<Embedding Embed="1" />

As you can see, we intentionally specified MandatoryPath attribute, and all the dll's are there.

How could we tackle this problem?
May be we incorrectly understand path calculcation in SmartAssembly? What path it takes as a starting point?


  • Can you retry but use absolute paths and not relative paths?
  • We tried. It didn't help.
    Also I noticed, if I make a mistake in the path to dll's - it shows completely anoher error, like:

    SmartAssembly build failed:
    Mandatory assembly 'C:\Users\Mike V. Girkin\Documeasdnts\Projects\Tor\OW_Fresh\Prereqs\AxInterop.SHDocVw.dll' not found for 'AxInterop.SHDocVw, Version=, Culture=neutral, PublicKeyToken=49fa31e76fed3520'

    So our error is not connected to the paths, and SmartAssembly could find the dll's. But it shows that it could not.

    The most strange thing is, that on different computers, the dll it could not find - differs.
  • There's a difference in the public key token value each time- can you check you are specifying the right tokens?

    Does it help if, instead of using mandatory path, the assemblies are put in the GAC (if only for testing purposes)?
  • Pleas ensure you have the very latest version too (Check for updates, on left in GUI). There have been some bug fixes to assembly resolution.
  • SethSeth Posts: 15 Bronze 1
    Was there ever a resolution to this issue? I am experiencing a similar problem where many of the assemblies I'm obfuscating via MSBuild integration hit the "Cannot find assembly... Make sure it's in the GAC" error. I've also tried using relative and absolute paths, I'm on the latest version of SmartAssembly (, and I've verified that the assembly that it's having issues finding (CrystalDecisions.CrystalReports.Engine) is in the GAC.
  • Jessica RJessica R Posts: 1,319 Rose Gold 4
    Hi @Seth,

    There unfortunately weren't any other replies on this, I'm sorry to say. :/

    Just to confirm though, I thought that you were able get past this (when we worked on it via your ticket #96925) by using the NotAvailable attribute for BusinessObjects.Licensing.KeycodeDecoder.

    <Assembly AssemblyName="BusinessObjects.Licensing.KeycodeDecoder, Culture=neutral, PublicKeyToken=null" NotAvailable="1">

    Has this not worked? Please let me know if so!

    Jessica Ramos | Product Support Engineer | Redgate Software

    Have you visited our Help Center?

  • SethSeth Posts: 15 Bronze 1
    Hi @Jessica R, that did work. Thanks!
  • Jessica RJessica R Posts: 1,319 Rose Gold 4
    @Seth Great! Just wanted to make sure. :)

    Jessica Ramos | Product Support Engineer | Redgate Software

    Have you visited our Help Center?

Sign In or Register to comment.