Using #C.net 3.5
I\'m aware of the ILMerge and alike techniques, but I would actually like to make use of Jeffrey Richter\'s suggestions.
After adding this c
String resourceName = "AssemblyLoadingAndReflection." + new AssemblyName(args.Name).Name + ".dll";
should be changed to:
String resourceName = Application.Current.GetType().Namespace + "." + new AssemblyName(args.Name).Name + ".dll";
Put it in the constructor, not InitializeComponent(). Adding using directives to your main class source code file isn't a problem.
From the description in your question, some things are not clear that may be needed in order to answer:
Basically, from what I understand, you have code that tries to use classes from the 2 assemblies. This code is static, meaning that the classes have to be known at compile time. Or in other words, you must have a reference to those 2 assemblies in order to compile code that uses types that are defined in them.
I don't really understand what went wrong when you added those assemblies as a reference. If what bothered you is that you saw them being copied into the bin/debug directory, that still should not have prevented them from also being embedded in your main assembly. So to test, you can try manually deleting them from bin/debug, or maybe setting them to "copy local = false".
One more thing - the error you encountered that mentioned "using" and "namespaces" wasn't really about namespaces. This error means that the compiler didn't find the types it needed. And that was probably because you removed the references to the 2 assemblies.