Allow embedding any assembly

cbiggerstaffcbiggerstaff Posts: 5
edited June 10, 2013 7:01AM in SmartAssembly
SA doesn't always detect all the assemblies needed which basically forces me to use an installer on projects I wouldn't want to otherwise or include dlls along with exe versus having the single exe solution that I really appreciate SA can usually create.
In particular here's some dlls (needed) it doesn't detect (Devexpress suite and Entity Spaces):
DevExpress.XtraBars.v11.1.dll
DevExpress.XtraPrinting.v11.1.dll
DevExpress.XtraTreeList.v11.1.dll
EntitySpaces.DebuggerVisualizer.dll

To work around this (and added extra functionality) I'd love to see SA add option to browse for an assembly and add it to the embedded assembly list.

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hello,

    SmartAssembly has had numerous problems merging/embedding DevExpress components. Some are explicitly ignored by SA (for reasons that are completely undocumented) but sometimes it seems you can get the dependency recognized by creating an instance of the devexpress object somewhere in the code. For instance:
    var ps = new DevExpress.XtraPrinting.PrintingSystem();
    ps.PageSettings.PaperKind = PaperKind.Letter;
    
    That has been proven to work for XtraPrinting.dll. You can try instantiating some classes in one of the other DLLs and see if that works.
  • I'm having the same problem hee, but with Reactive Extensions: System.CoreEx and System.Reactive. Instantiating and using classes from either DLL in my main project doesn't help, SA still doesn't see them as dependencies. Is this something to do with the fact they they're in the System namespace?
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    I have to say I honestly don't know - where can we get these "reactive" components or can you provide us with a sample application?
  • They're an MS Labs library all the cool guys are using: http://msdn.microsoft.com/en-us/data/gg577609

    IObserver<T> and IObservable<T> are probably the most common uses, I specifically use IEvent<T> in this case.
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    The output of a .NET Console project referencing System.CoreX and System.Interactive can be successfully processed by SmartAssembly 6.6.

    Maybe your dependencies have moved-have you tried setting MandatoryPath to the Reactive Extensions folder?
    http://www.red-gate.com/supportcenter/C ... pendencies
  • The output of a .NET Console project referencing System.CoreX and System.Interactive can be successfully processed by SmartAssembly 6.6.
    But can they be embedded or merged?
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Sorry, yeah effectively SmartAssembly can mess up dependencies in two different ways, you can get an error that it can't find the assembly during the analysis, and then if that passes you may also just end up with the dependency missing from the list of assemblies you can merge or embed.

    In the latter case, it's probably because the assemblies are signed with Microsoft's public key so it thinks they're part of the .NET Framework.

    There is a secret registry key you can try setting, but I can't make any guarantee it will work or won't have any other ill effects: create a new DWORD HKEY_LOCAL_MACHINE\SOFTWARE\Red Gate\SmartAssembly 6\SupportsMergingFramework and set the value to 1

    The other possible workaround is to ILDASM Microsoft's assembly and re-link and sign it using your own public key.
  • Thanks. Tried the DWORD in both HKLM and HKCU with no luck even after a reboot. Will attempt the ILDSAM route next.
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    What is the version of SA you are using?
  • Version 6.6.2.35
  • The old trick of reassembling the assembly doesn't seem to work. Maybe the problem is that all of the namespaces in the CoreEx DLL extend the System namespace. I tried turning on logging in SmartAssembly and it didn't print out any messages at all about this DLL, so I'll have to go through the SmartAssembly source code and see what the problem is.

    But I'm pretty sure SA is just not liking the System namespace they use in that DLL.
  • Thanks Brian, any idea when there'll be a viable workaround or built-in solution?
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    You can *try* adding the SupportsMergingFramework registry key, which is supposed to allow you to merge/embed System anmespaces but it didn't work in my reproduction.

    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Red Gate\SmartAssembly 6\SupportsMergingFramework should be a DWORD and have the value set to 1.
  • Yup, tried that, no success either.
  • I have the same issue.
    Also trying to Embed System.Reactive extensions

    Tried the Registry key fix.
    Have also tried updating the saproj file with the following, to no avail.

    <Assembly AssemblyName="System.CoreEx, Culture=neutral, PublicKeyToken=31bf3856ad364e35" MandatoryPath="_lib\System.Reactive\System.CoreEx.dll">
    <Embedding Embed="1" />
    <Merging />
    </Assembly>
  • You can *try* adding the SupportsMergingFramework registry key, which is supposed to allow you to merge/embed System anmespaces but it didn't work in my reproduction.

    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Red Gate\SmartAssembly 6\SupportsMergingFramework should be a DWORD and have the value set to 1.

    I have the same issue.
    Sorry about the double post. Original was supposed to be replying to this post..

    Also trying to Embed System.Reactive extensions

    Tried the Registry key fix.
    Have also tried updating the saproj file with the following, to no avail.

    <Assembly AssemblyName="System.CoreEx, Culture=neutral, PublicKeyToken=31bf3856ad364e35" MandatoryPath="_lib\System.Reactive\System.CoreEx.dll">
    <Embedding Embed="1" />
    <Merging />
    </Assembly>
  • GrahamHGrahamH Posts: 13 Bronze 5
    Just in case anyone else stumbles accross this, the registry key
    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Red Gate\SmartAssembly 6\SupportsMergingFramework
    should be a String Value (reg_sz) set to 1.
Sign In or Register to comment.