TaskEx embedding

mltgamesmltgames Posts: 17 Bronze 1
edited March 13, 2015 3:23PM in SmartAssembly
I'm using https://www.nuget.org/packages/Microsoft.Bcl.Async/ on .NET C# 4.0 to be able to use TaskEx component.


I want to embbed these file on my project but they doesnt appear on my smart assembly project. Even if they are referenced in my project and even if I use TaskEx component Inside.

Microsoft.Threading.Tasks.dll
Microsoft.Threading.Tasks.Extensions.Desktop.dll
Microsoft.Threading.Tasks.Extensions.dll
System.IO.dll
System.Runtime.dll
System.Threading.Tasks.dll



I tried to manually add these line :
<Assembly AssemblyName="System.Threading.Tasks, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<Merging Merge="0">
<Pruning />
<Obfuscation>
<Exclusion />
</Obfuscation>
<ControlFlow />
<MemberRefsProxy />
<ResourcesCompression />
<StringsEncoding />
<ResourcesPruning />
</Merging>
<Embedding Compress="1" Embed="1" Encrypt="0" />
</Assembly>
<Assembly AssemblyName="Microsoft.Threading.Tasks, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<Merging Merge="0">
<Pruning />
<Obfuscation>
<Exclusion />
</Obfuscation>
<ControlFlow />
<MemberRefsProxy />
<ResourcesCompression />
<StringsEncoding />
<ResourcesPruning />
</Merging>
<Embedding Compress="1" Embed="1" Encrypt="0" />
</Assembly>
<Assembly AssemblyName="System.Runtime, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<Merging Merge="0">
<Pruning />
<Obfuscation>
<Exclusion />
</Obfuscation>
<ControlFlow />
<MemberRefsProxy />
<ResourcesCompression />
<StringsEncoding />
<ResourcesPruning />
</Merging>
<Embedding Compress="1" Embed="1" Encrypt="0" />
</Assembly>


But same problem, I have the could not load assembly System.Threading.Tasks.


Thanks for your help

Comments

  • Hiya,

    Thanks for your post!

    SmartAssembly by default will not give the option to embed dependencies signed with the Microsoft public key token (since they're assumed to be framework assemblies and most users running a .NET application already have those assemblies installed), but there is a way to force it though by adding the SupportsMergingFramework registry key:

    1) Go to registry editor
    2) Navigate to "HKEY_LOCAL_MACHINESOFTWAREWow6432NodeRed GateSmartAssembly 6"
    3) Create a String value named "SupportsMergingFramework" with value 1.

    When you open your project in the SmartAssembly UI, those assemblies should then show up in the list of dependencies you can embed. Hope that helps!

    Jessica Ramos | Product Support Engineer | Redgate Software

    Have you visited our Help Center?


  • mltgamesmltgames Posts: 17 Bronze 1
    Thanks for your quick reply,

    I made the change into my registry and it's working.


    All files can be embbed except the file Microsoft.Threading.Tasks.dll.

    If I embbed this file I have this crash on load:
    FileLoadException: Could not load file or assembly
    'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'
    or one of its dependencies. The given assembly name or codebase was invalid.
    (Exception from HRESULT: 0x80131047)

    I removed this file from the embbeding and I made a copy of "Microsoft.Threading.Tasks.dll" version 1.0.168.0 into my project exe folder and it's now working.

    Maybe smart assembly do something different with this file but this is not really an issue for us.

    Thanks again.
Sign In or Register to comment.