Error reading assemblies: No assembly descriptors found

I have been using version 2.3 of maven-assembly-plugin, but I believe the problem is the same: if the assembly configuration is declared inside an execution, it works from mvn package, but does not work from mvn assembly:assembly. The solution I have found is to declare the configuration in the top-level configuration of the plugin, and … Read more

How to load a .NET assembly for reflection operations and subsequently unload it?

From the MSDN documentation of System.Reflection.Assembly.ReflectionOnlyLoad (String) : The reflection-only context is no different from other contexts. Assemblies that are loaded into the context can be unloaded only by unloading the application domain. So, I am afraid the only way to unload an assembly is unloading the application domain. To create a new AppDomain and … Read more

How to get Namespace of an Assembly?

Use Assembly.GetTypes(); This will get you a collection of all types and then you can get the Namespace property for each of them. Then I guess you can simply check that all the types have same Namespace value and use this value. Otherwise add some other logic to detect what namespace to consider primary.

Embedding assemblies inside another assembly

ILMerge does merge assemblies, which is nice, but sometimes not quite what you want. For example, when the assembly in question is a strongly-named assembly, and you don’t have the key for it, then you cannot do ILMerge without breaking that signature. Which means you have to deploy multiple assemblies. As an alternative to ilmerge, … Read more

How to prevent a .NET application from loading/referencing an assembly from the GAC?

If both assemblies are strong-named (signed), the CLR will always load from the GAC. Here are the steps the runtime uses to resolve assembly references (from How the Runtime Locates Assemblies): Determines the correct assembly version by examining applicable configuration files, including the application configuration file, publisher policy file, and machine configuration file. If the … Read more

how to load all assemblies from within your /bin directory

Well, you can hack this together yourself with the following methods, initially use something like: string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); to get the path to your current assembly. Next, iterate over all DLL’s in the path using the Directory.GetFiles method with a suitable filter. Your final code should look like: List<Assembly> allAssemblies = new List<Assembly>(); string … Read more

Error: Reference to type claims it is defined, but it could not be found

Another way this could happen is if you’re using several NuGet packages where one, probably central, package has been updated but some additional functionality packages haven’t been. To work through my recent example – the error was “Reference to type ‘ConsumerSubscriptionConfigurator<>’ claims it is defined in ‘MassTransit’, but it could not be found”. This is … Read more

ILMerge DLL: Assembly not merged in correctly, still listed as an external reference

I had to use the /closed argument. According to the official docs: Closed When this is set before calling Merge, then the “transitive closure” of the input assemblies is computed and added to the list of input assemblies. An assembly is considered part of the transitive closure if it is referenced, either directly or indirectly, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)