assemblies

.NET - How can I tell if a dll is a 32bit or 64bit version of that dll

天涯浪子 提交于 2020-01-24 13:06:31
问题 We have a project in our application that builds in a 32bit or a 64bit version of a dll depending on the processor architecture on the machine that it is built on, to facilitate testing. I can likely predict the dll that will be used on a given machine, but we have several devs, some with 64bit machines, some with 32bit machines, and I want to be able to check if builds they put to the live server have gone up with the 32bit version of the dll or the 64bit version of the dll. Checking

What is the earliest entrypoint that the CLR calls before calling any method in an assembly?

与世无争的帅哥 提交于 2020-01-23 00:20:08
问题 In the past years I've occasionally been wondering what equivalent of the (in)famous DLL_PROCESS_ATTACH was available in the .NET world. Any documentation I have says, slightly simplified, that the earliest entry point to a class is the static constructor (cctor), but you cannot influence when it is called, nor can you define one cctor that's guaranteed to be called prior to any other cctor or field initializer, hack, it may not even be called at all if the class is never used. So, if you

Why is the build failing in Visual Studio because it cannot resolve namespaces from referenced assemblies?

点点圈 提交于 2020-01-22 17:15:49
问题 I have 3 class library projects. Lets call them A, B & C. I have added project reference of A & B into the project C. A & B are building without any error or warning. Code(Class file) from the project C uses public classes from A & B. When I add project reference in C and look at the class file (before building project C) in the C project, I can clearly see that all the classes and namespaces from A & B are resolved. When I hover my mouse on the class name (class from either A or B), it shows

How to mark a .net assembly as safe?

二次信任 提交于 2020-01-22 08:50:05
问题 How do i mark as assembly as "safe"? Alternatively, how do i have Visual Studio tell me when something in my assembly is not "safe"? Sometimes you cannot use an assembly unless it is "safe" (e.g. from SQL Server). i would like my assembly to be marked as safe. If my assembly cannot be marked as safe because it's not safe, i'd like to know how i can know that my assembly is not safe. There are some concepts in Visual Studio that seem to relate to safe-ness, that may or may not have anything to

How to reference a namespace from a specific assembly?

ぐ巨炮叔叔 提交于 2020-01-20 16:52:30
问题 So here is my problem. My (test) project references both Castle Windsor and Rhino Mocks. I am creating a class which implements Castle.Core.Interceptor.IInterceptor from the Castle.Core.dll assembly In building Rhino Mocks, Ayende used Castle.Core.Interceptor and includes the whole darn namespace inside the Rhino.Mocks.dll So when I try to build, I get the error The type 'Castle.Core.Interceptor.IInterceptor' exists in both 'c:...\Libraries\Rhino.Mocks.dll' and 'c:...\Libraries\Castle.Core

How do I find out if a .NET assembly contains unmanaged code?

一曲冷凌霜 提交于 2020-01-19 13:37:28
问题 .NET assemblies that contain a mixture of managed and unmanaged code cannot be ILMerged with other assemblies. How can I verify if a given .NET assembly contains purely managed code, or a mix of managed and unmanaged code? 回答1: Run the PEVerify tool against your assembly. PEVerify.exe is installed along with Visual Studio, e.g. this one comes with Visual Studio 2012: C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\PEVerify.exe 回答2: As suggested by nobugz, an easier way

How do I find out if a .NET assembly contains unmanaged code?

会有一股神秘感。 提交于 2020-01-19 13:37:07
问题 .NET assemblies that contain a mixture of managed and unmanaged code cannot be ILMerged with other assemblies. How can I verify if a given .NET assembly contains purely managed code, or a mix of managed and unmanaged code? 回答1: Run the PEVerify tool against your assembly. PEVerify.exe is installed along with Visual Studio, e.g. this one comes with Visual Studio 2012: C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\PEVerify.exe 回答2: As suggested by nobugz, an easier way

How to add resource to existing signed assembly

蹲街弑〆低调 提交于 2020-01-15 01:49:16
问题 Given: - an assembly (e.g. "SomeLib.dll") - a text file (e.g. "myconfig.xml") I need to embed the file myconfig.xml into the existing assembly SomeLib.dll Please consider before pressing "Answer": I know about resources embeding during compile (csc.exe .. /embedresource:file ... ). The thing is that I need to embed a resource after assembly has created. Is it possible? I also know about ILMerge. But havn't found how it could help. 回答1: You can use Cecil for this: load an assembly, add a

asymmetric key creation over network

家住魔仙堡 提交于 2020-01-14 09:26:26
问题 I'm attempting to add an assembly to a database in SQL2008 using an asymmetric key. We're adding the assembly using a hex string (adding assemblies to servers through sql queries only) USE [master] GO IF NOT EXISTS (SELECT * from sys.asymmetric_keys where name = 'ManagedAsymmetricKey') BEGIN CREATE ASYMMETRIC KEY ManagedAsymmetricKey FROM FILE = 'C:\Managed.dll' CREATE LOGIN CLRLogin FROM ASYMMETRIC KEY ManagedAsymmetricKey GRANT UNSAFE ASSEMBLY TO CLRLogin END GO USE [$dbName] GO CREATE

.NET: Should executables be strong-name signed? What about private DLLs?

五迷三道 提交于 2020-01-11 18:40:09
问题 My application consists of three assemblies: a single EXE which references a couple of DLLs. The DLLs are private to my application - they are used only by this executable. Should these assemblies be given a strong name? FxCop suggests that they should - for all of the assemblies it currently produces: CA2210: Sign <assembly> with a strong name key. However, this advice says: In general, you should avoid strong-naming application EXE assemblies. and you may want to avoid strong-naming