What are the challenges you face when working across database platforms? Take the survey

App crashes on startup, even with all obfuscation disabled

falconnefalconne Posts: 2
edited December 1, 2016 12:01PM in SmartAssembly
I'm trialling SmartAssembly for our product and am having some trouble. I have created a SA project for our exe with all SA functionality disabled (all the tab buttons in SA are yellow except Debugging which is green), to make this the most minimal test possible. My app has other dependent assemblies, both our own and third party, but I haven't ticked any of the merge or embedding boxes. The SA project is pointed to the exe in the binRelease folder of our product so it sees all the dependencies. I've built this project successfully, ending up with a new exe.

When I try to run this transformed exe, sitting alongside all the other dependencies (untouched), it crashes on startup. When I turn on Error Reporting, I can see that the exception is:
"Could not load file or assembly 'Autofac, Version="

Our product only uses Autofac version and the appropriate autofac.dll is there beside the program. For some reason I can't understand, running the exe through the SA build causes it to try and use a different version of Autofac. Is there something SA might be doing to it that causes the resulting assembly to pick the wrong version?


  • Options
    Jessica RJessica R Posts: 1,319 Rose Gold 4
    Thanks for your post and so sorry to hear you're running into an issue!

    SmartAssembly will locate a dependency by searching in the following locations and order:
    1. The GAC (Global Assembly Cache). The dependency must have an assembly name which includes the same version number and public key token.
    2. The framework folder and associated folders (for SDKs, Silverlight, XNA, etc.).
    3. The main assembly folder for a dependency with a similar assembly name (even if the version and/or public key token are different).

    It sounds like SmartAssembly may be picking up on the 3.4. version of Autofac from either the GAC or a framework or associated folder, but you can force SmartAssembly to use the correct version by opening your saproj file in a text editor and adding a MandatoryPath attribute for Autofac pointing to the correct location of the dll:
    <Assembly AssemblyName="dependency_assembly_name" MandatoryPath="C:pathDependencyToUse.dll">

    Can you kindly give this a try?

    Jessica Ramos | Product Support Engineer | Redgate Software

    Have you visited our Help Center?

Sign In or Register to comment.