assemblies

Is it possible to execute a .NET assembly(dll) from vbscript?

丶灬走出姿态 提交于 2019-11-30 15:04:06
I'd like to execute a .NET dll file from vbscript in a synchronous way - is this possible? if yes, is it possible to execute a GAC assembly? thanks, Ofer I think you must first make the .NET assembly COM-visible by including the ComVisible attribute in the AssemblyInfo.cs file: [ComVisible(true)] See this page on MSDN: Packaging an Assembly for COM And then in VBScript you can access those components by the same means you access COM components, i.e. using CreateObject or Server.CreateObject as in: Set testObj = CreateObject("MyNamespace.MyType") I think GAC might even be mandatory to access it

How to update the Value in Assemblyinfo.cs dynamically

怎甘沉沦 提交于 2019-11-30 14:16:51
I have writen a program which gets the value from SVN repository . Now I want to update the AssemblyFileversion with that value. As I am not able to write any code inside Assemblyinfo.cs , how will I update the value of AssemblyFileVersion. I want to achieve something like this .......................... // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly:

“Why is my .net exe so huge” analyzer tool?

℡╲_俬逩灬. 提交于 2019-11-30 14:03:27
Is there a tool that can explain the size of a .NET assembly (executable or DLL file)? In the olden days, there was an IDE extension that would detail the space used by a project. It should show the large code files: And data resources : Is there such a thing for the .NET world? I really thought that moving to .NET, and no longer having to build the entire VCL into the executable, that executable sizes would shrink. Bonus Reading Analyze space used by .NET assembly cynic The standard SDK took ILDASM (IL Disassembler), had the "Statistics" option in the View menu, which broke it down like this:

Parsing plain Win32 PE File (Exe/DLL) in .NET

六月ゝ 毕业季﹏ 提交于 2019-11-30 13:09:13
I need to parse plain Win32 DLL/Exe and get all imports and exports from it to show on console or GUI (i.e. Win Forms). Is it possible to parse Win32 DLL/Exe in C#.NET by reading its export/import tables and get managed types from it? As it's unmanaged PE, .NET doesn't allows you to convert unmanaged PE files to managed .NET assemblies, it only generates COM managed assemblies. How can I parse these tables and take all of its methods (signatures) in managed form. (e.g. if char* as argument, it should display as IntPtr). Stephen Cleary Parsing PE files is possible using the Microsoft Portable

ILMerge and localized resource assemblies

风格不统一 提交于 2019-11-30 12:23:48
We have an application whose structure when compiled looks something like this: Foo nb-NO Text.resources.dll sv-SE Text.resources.dll Bar.dll Foo.exe Text.dll Is it possible to use ILMerge on this? How would you do that? Tao I asked my own variant of this question and eventually got/implemented an answer: Single-assembly multi-language Windows Forms deployment (ILMerge and satellite assemblies / localization) - possible? Hope this helps. Disclaimer: I work for the company that makes Dotfuscator. There may be other alternatives out there that I am not aware of but I am pretty sure ILMerge does

Run dynamically compiled C# code at native speed… how?

╄→尐↘猪︶ㄣ 提交于 2019-11-30 12:16:24
问题 I have read several posts on SO about writing and compiling dynamic C# code. For example, this post. I understand it can be done several ways. However, calling the code invoker is slow. I did a simple benchmark, and it's some 500 X slower than calling a native method. What I want to be able to do is the equivalent of loading a DLL and calling one of its methods directly ("natively"), which will give the speed benefits I want. What is the easiest way to go about this? Compile the dynamic code

Prevent external assembly injection via PublicKeyToken

自古美人都是妖i 提交于 2019-11-30 12:09:40
I'm using the following code: AppDomain.CurrentDomain.AssemblyLoad += (sender, args) => { var token = args.LoadedAssembly.GetName().GetPublicKeyToken(); if (!IsValidToken(token)) { Process.GetCurrentProcess().Kill(); } }; Where IsValidToken() compares the public key token of the assembly being loaded against a list of authorized public key tokens hardcoded in my application as byte arrays. Is this a good security measure to prevent code injection attacks? Also, is this necessary given the fact that I will later obfuscate my application using NetReactor? I'm trying to prevent any "snooping"

Assembly.GetTypes() - ReflectionTypeLoadException

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 11:48:45
We implement a plugin framework for our application and load plugin assemblies using Assembly.Loadfrom. We then use GetTypes() and further examine the types with each plugin file for supported Interfaces. A path for the plugins is provided by the user and we cycle through each of the files in the folder to see if it (the plugin) supports our plugin interface. If it does, we create an instance, if not we move onto the next file. We build two versions of software from the one code base (appA_1 and appA_2). Loading the plugins works well when the plugins are loaded by the application that was

Loading Assemblies from a .Net Application in a 'Sandbox Environment'

半腔热情 提交于 2019-11-30 10:31:54
I am currently developing an application in where a user will dynamically choose dlls and the application will execute some of the methods in that dll. ( if you follow the first link, you will see that I am developing a sort of Robocode game application using the .Net Framework ). For example, when the battle starts, the run method from the dll is executed. Since whatever was specified in the run method will be executed, there are quite a bit of Security Constraints that have to be applied. Like for example, if the user who programmed the dll, instead of using only the methods that are

Assembly Loading Version Mismatch: Why is it loading?

£可爱£侵袭症+ 提交于 2019-11-30 10:17:51
I have two assemblies: HelloWorld.exe and Hello.dll. The exe is the main assembly and the dll is being used by the main assembly. I compiled both HelloWorld.exe (1.0.0) and Hello.dll (1.0.0). I placed the assemblies on a different folder. I then changed the version of Hello.dll to 2.0.0 and proceeded to overwrite the Hello.dll 1.0.0 with the 2.0.0 version. I then launch HelloWorld.exe and it worked fine. I expected it to crash and burn immediately because the referenced Hello.dll when I compiled the EXE was 1.0.0. Now, the 1.0.0 DLL has been replaced by 2.0.0 but it still worked! As per MSDN :