| Author |
Message |
lechuckcaptain
Joined: 01 Sep 2011 Posts: 3
|
Posted: Thu Sep 01, 2011 11:22 am Post subject: Not referenced assemblies loaded with reflection |
|
|
Hi,
I have a big VS2008 solution with many projects and many compiled assemblies, and I want to obfuscate them, and if possible embed them in only one executable.
The main problem is that some assemblies aren't referenced by the main executable, because they are loaded at runtime through reflection. So, SmartAssembly doesn't load these assemblies, and I can't add them to the final executable.
Is there a way I can avoid this problem?
Thank you in advance,
Marco |
|
| Back to top |
|
 |
james.davies
Joined: 19 Apr 2011 Posts: 46
|
Posted: Fri Sep 02, 2011 4:03 pm Post subject: |
|
|
SmartAssembly will only merge or embed assemblies which are in the references metadata. So you will need to add the reference to the main assembly for SmartAssembly to detect it. _________________ Thanks,
James Davies
Technical Support Engineer
Red Gate Software |
|
| Back to top |
|
 |
lechuckcaptain
Joined: 01 Sep 2011 Posts: 3
|
Posted: Fri Sep 02, 2011 4:26 pm Post subject: |
|
|
Thank you for the answer,
I tried adding the references to the assemblies without loading them, but it seems that {SA} doesn't load the assemblies.that aren't directly loaded. Can you confirm that?
Do I have to explicity load all the assemblies that I want to obfuscate in order to let {SA} to detect them?
Marco |
|
| Back to top |
|
 |
lechuckcaptain
Joined: 01 Sep 2011 Posts: 3
|
Posted: Mon Sep 12, 2011 1:58 pm Post subject: |
|
|
| Any suggestions? |
|
| Back to top |
|
 |
Brian Donahue
Joined: 23 Aug 2004 Posts: 6348 Location: Red Gate Software
|
Posted: Mon Sep 12, 2011 5:56 pm Post subject: |
|
|
What James said. You need to create a reference and possibly even use one of the referenced assemblies in your code (by creating a class from it). I say that because I noticed .NET doesn't load an assembly merely because there is a reference and you actually have to do something with the reference and I'd imagine SA behaves the same way. _________________ Brian Donahue
Technical Support
Red Gate Software Ltd.
44 (0)870 160 0037 ext 8521
US and CAN 1-866-RED GATE ext 8521 |
|
| Back to top |
|
 |
Julien
Joined: 18 Dec 2012 Posts: 3
|
Posted: Tue Dec 18, 2012 3:30 pm Post subject: |
|
|
So you'are not compatible with MEF ...
Morevover, we cannot use your solution with a XAML styles assembly ...
You should permit us to add assemblies that SA does't find !  |
|
| Back to top |
|
 |
eric-914
Joined: 30 Nov 2012 Posts: 20
|
Posted: Tue Dec 18, 2012 4:42 pm Post subject: |
|
|
I had this problem too. My workaround is to add some code that directly references the .dll, even though the method that does so is never called in my code.
| Code: |
[DoNotPrune]
public static class SmartAssemblyFix
{
public static Type ForceReferenceMethod()
{
return typeof([Namespace.Of.Library].[SomeClassInLibrary]);
}
} |
|
|
| Back to top |
|
 |
Julien
Joined: 18 Dec 2012 Posts: 3
|
Posted: Tue Dec 18, 2012 4:55 pm Post subject: |
|
|
| I can't, it is dynamically loaded when I add DLLs in my bin |
|
| Back to top |
|
 |
|