.net-assembly

Expose different type names (aliasing) from assembly

旧时模样 提交于 2019-12-05 01:05:14
问题 This question is related to a previous, unanswered question of mine, as I'm still solving the same problem; this is about a different approach though. I'm currently consuming a third-party SOAP web service in a C# .NET project. Unfortunately, the generated client proxy classes and class members have names that are inconsistent with my current conventions. Until advised otherwise, I'm left to presume that Svcutil doesn't support aliasing ( though, it certainly seem it would be most easily

Modify Compiled .Net Exe

夙愿已清 提交于 2019-12-05 00:35:50
I have an application written in C# (without the source of course), that needs to be changed a little bit. For example, I need to stop a few lines of code that create an unnecessary menu. So I think I should comment them out. The source code is not obfuscated. I know I can completely decompile, change, and compile again, using tools like Reflector/Reflexil. But everyone knows that by doing this, many parts of code won't compile again! Is there a way in Reflector (or any other product) that a part of could be disabled/changed without this process? Thanks. You might want to try dnSpy. It is a

How to use ICLRStrongName::StrongNameSignatureVerificationEx Method to identify delay signed assemblies

六眼飞鱼酱① 提交于 2019-12-05 00:35:40
问题 Can anybody please suggest how to use ICLRStrongName::StrongNameSignatureVerificationEx method to identify delay signed assembly. I could not find any example in the internet. I am not understanding how to work with this method. Please don't refer me any link, I am almost frustrated with different suggestions and different links available in the web. Can anybody please give code sample for the same. 回答1: I had the same problem and finally found the time to investigate. I really don't

Could not load file or assembly 'log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=1b44e1d426115821' or one of its dependencies

江枫思渺然 提交于 2019-12-05 00:09:41
I found several threads relating this issue, but none of those solved my issue. I have been previously using log4net version 1.2.10.0 in my ASP.NET services. I have updated it to current version which is log4net v2.0.8.0 , due to some third party libraries I also added the following lines in my web.config to to support/redirect old versions. <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" /> <

How can I see the strong name of my assembly?

落爺英雄遲暮 提交于 2019-12-04 23:44:26
I have a project, and I created a strong name key file for it. How can I tell what the strong name of my assembly is? It seems this should be obvious, but I can't find any reference to it. You can get the Fully Qualified Name by using a tool like Reflector or ILSpy. Select the assembly and it should be in top of it. For XNA in ILSpy : // C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.dll // Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553 If you don't want to use those tools, you can figure out

What is the structure of the public key of a signed assembly in C#?

时光总嘲笑我的痴心妄想 提交于 2019-12-04 18:35:05
Using this code to retrieve the public key bytes... var pubKey = AppDomain.CurrentDomain.DomainManager.EntryAssembly .GetName().GetPublicKey(); What is this common structure at the start (first 32 bytes) of the key? It's not ASN.1 and it might not be variable. I can google it and get repeats. // 00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 Is it all reversed or just part of it (e.g. the modulus at the end)? 52 53 41 31 is a string of RSA1 . My key's modulus is 1024 bit, so I was looking for something that described the length. 0x0400 ( 00 04 B.E.) would be 1024 (bits

Dynamically Loaded Assembly - Settings & Communication

不问归期 提交于 2019-12-04 17:00:47
Ok so... I have a WPF application (let's call it Launcher.exe ) which loads and executes another WPF application (let's call it Loaded.exe ) dynamically using something like this: Byte[] assemblyData; using (BinaryReader reader = new BinaryReader(new FileStream(filePath, FileMode.Open))) assemblyData = reader.ReadBytes(Convert.ToInt32(fs.Length)); Assembly assembly = Assembly.Load(assemblyData); MethodInfo method = assembly.EntryPoint; if (method != null) { Object instance = assembly.CreateInstance(method.Name); method.Invoke(o, null); } Now... the problem is that Launched.exe has its own

'Could not load file or assembly 'netstandard, Version=2.0.0.0, …'. Reference assemblies should not be loaded for execution

强颜欢笑 提交于 2019-12-04 16:58:20
问题 Goal: From a .NET 4.7 console app, using reflection with Assembly.GetType(), I am trying extract the Type of a netstandard 2.0 class from Assembly X. Then I want to create an instance of this Type with Activator.CreateInstance(). What I am trying to do: However, this assembly X has a dependency to netstandard 2.0. To be able to get the Type, netstandard dependency has to be loaded into the AppDomain. That's why when the AppDomain is requesting the netstandard assembly through the

Get company name and copyright information of assembly [duplicate]

ε祈祈猫儿з 提交于 2019-12-04 16:22:24
问题 This question already has answers here : Retrieve AssemblyCompanyName from Class Library (5 answers) Closed 6 years ago . I am using Assembly.GetEntryAssembly().GetName() to get application/assembly name and its version but I do not see any variable for company name and copyright. How do I get that? 回答1: You can use FileVersionInfo like this: var versionInfo = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location); var companyName = versionInfo.CompanyName; 回答2: From this answer

Namespace System.Web.Http.Results not found within asp.net web api application

↘锁芯ラ 提交于 2019-12-04 15:57:59
I have an asp.net web api application in which I have this line : using System.Web.Http.Results; My problem is that the namespace isn't recognized, I verified the dll system.Web.Http exists in the bin folder !! So I need to know: What is the reason of this problem? How can I fix it? You need reinstalling the NuGet package, which corrects broken dependencies. Open package manager and run Update-Package Microsoft.AspNet.WebApi -reinstall. The above solution didn't work for me as it was failing on some other package too. My solution was to delete the packages folder and rebuild the project, which