Problem getting the AssemblyVersion into a web page using Razor /MVC3
cshtml/vbhtml is dynamic compile to assembly. @typeof(YourApplicationNamespace.MvcApplication).Assembly.GetName().Version how about this?
cshtml/vbhtml is dynamic compile to assembly. @typeof(YourApplicationNamespace.MvcApplication).Assembly.GetName().Version how about this?
Using Visual Studio Attach a debugger to the process (e.g. start with debugging or Debug > Attach to process) While debugging, show the Modules window (Debug > Windows > Modules) This gives details about each assembly, app domain and has a few options to load symbols (i.e. pdb files that contain debug information). Using Process … Read more
You need to invoke CreateInstanceAndUnwrap before your proxy object will execute in the foreign application domain. class Program { static void Main(string[] args) { AppDomainSetup domaininfo = new AppDomainSetup(); domaininfo.ApplicationBase = System.Environment.CurrentDirectory; Evidence adevidence = AppDomain.CurrentDomain.Evidence; AppDomain domain = AppDomain.CreateDomain(“MyDomain”, adevidence, domaininfo); Type type = typeof(Proxy); var value = (Proxy)domain.CreateInstanceAndUnwrap( type.Assembly.FullName, type.FullName); var assembly = … Read more
Getting loaded assemblies for the current AppDomain: var loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies(); Getting the assemblies referenced by another assembly: var referencedAssemblies = someAssembly.GetReferencedAssemblies(); Note that if assembly A references assembly B and assembly A is loaded, that does not imply that assembly B is also loaded. Assembly B will only be loaded if and when it … Read more
I used the advice from this article to get an assembly from the GAC. Get DLL Out of The GAC DLLs once deployed in GAC (normally located at c:\windows\assembly) can’t be viewed or used as a normal DLL file. They can’t be directly referenced from VS project. Developers usually keep a copy of the original … Read more
Does this clear it up? // path1 and path2 point to different copies of the same assembly on disk: Assembly assembly1 = Assembly.LoadFrom(path1); Assembly assembly2 = Assembly.LoadFrom(path2); // These both point to the assembly from path1, so this is true Console.WriteLine(assembly1.CodeBase == assembly2.CodeBase); assembly1 = Assembly.LoadFile(path1); assembly2 = Assembly.LoadFile(path2); // These point to different assemblies … Read more
Disclosure: Harmony is a library that was written and is maintained by me, the author of this post. Harmony 2 is an open source library (MIT license) designed to replace, decorate or modify existing C# methods of any kind during runtime. It main focus is games and plugins written in Mono or .NET. It takes … Read more
Sounds like you could use the AppDomain.AssemblyResolve event and manually load the dependencies from your DLL directory. Edit (from the comment): AppDomain currentDomain = AppDomain.CurrentDomain; currentDomain.AssemblyResolve += new ResolveEventHandler(LoadFromSameFolder); static Assembly LoadFromSameFolder(object sender, ResolveEventArgs args) { string folderPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string assemblyPath = Path.Combine(folderPath, new AssemblyName(args.Name).Name + “.dll”); if (!File.Exists(assemblyPath)) return null; Assembly assembly = … Read more
An assembly is the compiled output of your code, typically a DLL, but your EXE is also an assembly. It’s the smallest unit of deployment for any .NET project. The assembly typically contains .NET code in MSIL (Microsoft Intermediate language) that will be compiled to native code (“JITted” – compiled by the Just-In-Time compiler) the … Read more
Yes it is, more exactly in the .text section of the PE file (portable executable = *.exe or *.dll). More information can be found here. The best choice is to use ILSpy (Reflector is no longer free). It’s a free disassembler that can dissassemble your assembly into MSIL but also C#, VB (to some extent). … Read more