How to check if an assembly was built using Debug or Release configuration?

Check this. The idea is that you get the list of assembly attributes using Assembly.GetCustomAttributes() and search for DebuggableAttribute and then find if such attribute has IsJITTrackingEnabled property set. public bool IsAssemblyDebugBuild(Assembly assembly) { return assembly.GetCustomAttributes(false).OfType<DebuggableAttribute>().Any(da => da.IsJITTrackingEnabled); }

What does it really mean to target a framework, and how do I maximize compatibility?

The frameworks are designed to be backwards-compatible; if you have a program written in .NET 2.0, you can run it in the 4.0 runtime, because none of the frameworks ever remove functionality that a prior version had (which is why we still have the non-generic collections like ArrayList, even though they’re deprecated in favor of … Read more

How do I find the fully qualified name of an assembly?

This is a shameless copy-paste from I Note It Down and is a simple way to get the FQN for the project output: Open Visual Studio Go to Tools –> External Tools –> Add Title: Get Qualified Assembly Name Command: Powershell.exe Arguments: -command “[System.Reflection.AssemblyName]::GetAssemblyName(\”$(TargetPath)\”).FullName” Check “Use Output Window”. The new tool appears under Tools –> … Read more

Using the Web Application version number from an assembly (ASP.NET/C#)

Here is some code I use that supports getting the application’s “main” assembly from either Web or non-web apps, you can then use GetName().Version to get the version. It first tries GetEntryAssembly() for non-web apps. This returns null under ASP.NET. It then looks at HttpContext.Current to determine if this is a web application. It then … Read more

Is there a way to specify assembly references based on build configuration in Visual Studio?

There is a way to do this, but you will have to hand edit your project files. The project files can have a Condition attribute applied to them in many of the elements, including the one for references. You can add these to your references to specify when the reference should be used: <Reference Include=”Product, … Read more

mscorlib.dll & System.dll

I work on the CLR/BCL team and just answered your email. Here it is pasted below: Jared’s answer on Stack Overflow is right on. mscorlib.dll is tightly bound to the CLR for the reasons he mentions. Note that mscorlib.dll itself doesn’t contain any native code (as Scott suggests), but there are many places where it … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)