.net-assembly

Determine whether assembly is a gui application

梦想的初衷 提交于 2019-12-11 03:13:23
问题 I am trying to determine whether a C# assembly is a GUI or a Console application in order to build a tool which will automatically recreate lost short cuts. Currently, I have a routine which recursively steps all directories in Program Files (and the x86 directory). For each EXE it finds, the tool calls IsGuiApplication, passing the name of the EXE. From there, I create an Assembly object using LoadFrom. I want to check whether this assembly is has a GUI output, but I'm unsure how to test

Assembly loaded from Resources raises Could not load file or assembly

你离开我真会死。 提交于 2019-12-11 02:54:18
问题 I am writing a simple application that should create some shortcuts. For this I use Interop.IWshRuntimeLibrary that i add as an Embedded Resource. On class init I call Assembly.Load(Resources.Interop_IWshRuntimeLibrary); I also tried: AppDomain.CurrentDomain.Load(Resources.Interop_IWshRuntimeLibrary); When I build the application in VisualStudio Output window I see that the assembly is loaded: Loaded "Interop.IWshRuntimeLibrary". But, when I try to use the objects in that assembly it gives me

Is it appropriate to use leading zero in C# assembly version?

一个人想着一个人 提交于 2019-12-11 02:27:36
问题 I am setting assembly version for my dot net dll Assmebly version has below format, "major version.minor version.build number.revision" I am setting Verison like below, 200.1.1.0; Now my question is do I need to keep a leading zero in minor version,build number and revision number (200.01.01.00) Or without leading zero (200.1.1.0). Which is right practice? Is there any Microsoft guideline available ? I didn't find any guidelines by Googling. 回答1: The versions are stored internally as integers

“Copy Local = false” referenced project shows “Could not load file or assembly”

自闭症网瘾萝莉.ら 提交于 2019-12-11 02:26:45
问题 I have spent days looking for an answer but have not figured out what happens. I have a solution with 4 projects. One of them is referenced to other 3. All references are set "copy local = false". I have made output folders for each of them and everything was going great, until I decided to change the output folder. :-( Now when I reference the project to another with property "copy local = false" project does not load and I have an error saying Could not load file or assembly "..." or one of

Why is AssemblyResolve called when Assembly is in CurrentDomain?

ε祈祈猫儿з 提交于 2019-12-11 01:41:33
问题 I have a situation where AppDomain.CurrentDomain.AssemblyResolve is called for an assembly that has already been loaded into the current domain using Assembly.Load(myAssemblyMemStream.ToArray()) . Why is that? I need to do the following to get it to work. How does this differ from what .NET does automatically? Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) { return AppDomain.CurrentDomain .GetAssemblies() .First(x => x.FullName == args.Name); } 回答1: Load contexts

Dynamic load a .NET assembly with some other dll dependency

风流意气都作罢 提交于 2019-12-11 00:44:41
问题 I want to create a plugin engine for my app, but I have a problem: How can I load a .Net assembly (Actually my plugin) which has some dependency to other assembly. For example I want to load A.DLL and A.DLL need to B.dll or C.dll and so on to run. The A.dll has two method such as A() and B() . And A() or B() use some method of B.dll or C.dll . What should I do to dynamically load A.DLL and call A() or B() ? 回答1: Use AssemblyResolve event in the current AppDomain: To load DLLs: string[] dlls =

Looking for a FOSS tool to display a .NET assemblies link dependencies [closed]

风格不统一 提交于 2019-12-11 00:37:20
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . Can anyone recommend a tool (ideally FOSS) that can analyse an .NET assembly and list its dependencies? What I am after is a tool that given a .NET exe file can produce a report showing me the .NET assemblies (name, version, strong name, location/GAC) its is linked to; in order to assist diagnosis when a

Loading the same Assembly twice but with different version

。_饼干妹妹 提交于 2019-12-11 00:13:49
问题 I have one assembly that is called asm.dll. This assembly has the version 1.0.0.0 ( set within AssemblyInfo.cs ) Then I need do do some code modifications in that assembly (still asm.dll), advance the version to 2.0.0.0 and build it again. Now, I have two files named asm.dll that differ with respect to some code modifications and a their version number. How do I load these two files during runtime? ADDENDUM: Right now I am trying the following: var asm1 = Assembly.LoadFrom("dir1\asm.dll");

Failed to create assembly 'System.ServiceModel.Internals' in SQL

心已入冬 提交于 2019-12-10 23:44:47
问题 I am trying to create an assembly in SQL but I am not able to load the following DLL. System.ServiceModel.Internals create assembly [system.servicemodel.internals] from 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.ServiceModel.Internals.dll' with permission_set = safe; go I get this error: Msg 6218, Level 16, State 2, Line 2 CREATE ASSEMBLY for assembly 'System.ServiceModel.Internals' failed because assembly 'System.ServiceModel.Internals' failed verification. Check if the

How to load an assembly from byte array in compact framework

时间秒杀一切 提交于 2019-12-10 21:16:37
问题 I have legacy clients who use smart scanners with old windows mobile on them. As a result, I'm stuck developing in the compact framework for these smart devices. I am in the process of writing a class library which will provide a plugin type mechanism for an interface to the scanner hardware. I would like to be able to embed the third party assemblies from the scanner manufacturer as an embedded resource in the plugins DLL. I want to do this to avoid having to reflect over all of those third