Could not load file or assembly 'Microsoft.IdentityModel

I have developed a SharePoint provider hosted (MVC) app and hosted web application in iis of azure VM (WIN SERVER 2012). When we try to use application using an app, It throws below error. Server Error in '/' Application. Could not load file or assem

Load the assembly and create a class using Reflection

I could not find a way of creating a class object from given type and assembly definition using reflection. For my case, I have a string containing class and assembly name and need to create the object: string str = "My.Assembly.Namesapce.MyClass, My

The load assembly that was compiled by programming fails

We try to compile source code at runtime and then add the resulting assembly to an AppDomain. But in the moment even loading the assembly fails: string sourceCode = "using System;\r\n" + "public class Program1{\r\n" + " public sta

Create a Windows form as a class library

I am trying to make a windows form to be reused across several projects. So I thought this would be a class library. What I want to do is call WindowsForm.Show() as a static call. I've tried to create a class library but I cannot reach the resources

Using Custom DataContractResolver with Multiple Assemblies

I have following setup in a MEF application: Assembly MyBaseAssembly: namespace My.Namespace { [DataContract] public class Container { [DataMember] public Data Item { get; set; } } [DataContract] public class Data { [DataMember] public string Foo { g

See which method is currently used from a DLL

I know that I can open a DLL file with an assembly browser, such as ILSpy, to see the classes and methods that it contains. But if a process is currently using a DLL, is it possible to know what method it is currently using? And any other details, su

How to check the version of an assembly (dll)?

I have c# application and when I made a change, I am getting the error message: An unhandled exception of type 'System.TypeLoadException' occurred in WindowsFormsApplication1.exe Additional information: Could not load type 'TradeIdeas.TIProData.OddsM

How can I get the data type of a class in Reflection C #

I have a namespace called MyNamespace.Demo1, one static class called STClass and one property inside that class called prpAssm. How do I get the data-type of property prpAssm? Type classType = typeof(STClass); PropertyInfo propertyInfo = classType.Ge

Assembly.GetEntryAssembly () in NUnit

I am using NUnit to test one functionality where I need to load XML file to object. The XML file is in location of the Console Application. I have Following method where configuration will be read : public string GetConfiguration(TempFlexProcessor pr

Should the assemblies be physical files? - Web API

We have an MVC UI that will generically draw itself based on data types it gets from the WebAPI. On App start of the ui I call into my WebApi to pull the "LeadTypes" down in a list of Assemblies List using binary formatter to serialize and deser

Unable to find the specified assemblies

I'm on CRM 4.0 and I get the following error when I try to execute retrieval of multiple entities. Could not load file or assembly 'System.Core, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system

System.Drawing missing assembly or reference

I want to use the Bitmap class under an XNA project declared on System.Drawing but it says that I'm missing an assembly or reference. I added System.Drawing to my references and changed my target framework after seeing this post. I opened 3 or 4 new

How to access the class of another assembly via c #?

I have solution and my class in it. Then i add another project at my solution. So, i want to use another class B and its methods,field from my class A. Class B looks like: class B { public int field1; public int field2; public void Test() {} } How to

Avoid the GAC in the application

So I have some users getting this error System.MissingMethodException: Method not found: 'Void System.Net.Http.Headers.HttpHeaders.AddWithoutValidation(System.String, System.Collections.Generic.IEnumerable`1<System.String>)'. at System.Net.Http.Http

How to avoid using BuildManager.AddReferencedAssembly

We are developing a web application which has tons of plugin dll files. Now, we are able to load all the assemblies we need but we are using BuildManager.AddReferencedAssembly while doing this. Which - I guess - causes a little problem. The problem i

Kaspersky detects my ConsoleApplication as a Trojan

I've been searching for a while but I did not find any suitable answer to this question. I noticed that my antivirus started detecting my application as a trojan. My antivirus is Kaspersky 2013 and this is the type of trojan it has detected. http://w

Find classes not required in a given assembly

I have a huge .Net library with a few hundred classes in them. However, i only use a subset of this library. So i would like to create a new assembly only with the required and dependant classes instead of using the whole thing. Is there a quick, fre

Special characters in a namespace

I am considering using a character with a diacritical mark (e.g., ō) in a namespace for a custom framework. This idea has come up as a way to distinguish a product, but I want to to be sure this isn't a bad idea, and if there is anything about it tha

In C #, how can I get the name of the file that is running?

I would like to know how to pragmatically get the name of the running file not the assembly name but the name of the file in C# .NET, I tried System.Reflection.Assembly.GetEntryAssembly().GetName().Name this gives the name of the assembly but i am lo

Shared AssemblyInfo for uniform versioning through the solution

I've read about this technique: Basically it means to create a SharedAssemblyInfo.cs with versioning information about the assembly, and adding th

How to load an .exe file as a .NET assembly?

Can I just use?: Assembly.LoadFile Not sure if this is the way to do this? But when I try that approach, it throws a Could not load file or assembly "CustomControlLib" or one of its dependencies. The system cannot find the file specified. Any id

WebResource.axd empty or not found

I'm trying to export a control library in a .dll for other developers in the office to consume. The solution I original created looks like this: Solution 1: - Mri.Controls (Class Library) - Mri.FmTool (Web Application) Mri.FmTool references Mri.Contr