.net-assembly

The type or namespace name 'FormatterContext' could not be found .net 4.5

女生的网名这么多〃 提交于 2020-01-04 05:51:07
问题 My project framework : .net 4.5 Project Type : MVC4 I have added System.Json of framework 4.0. I have following code into Model -> JsonNetFormatter.cs and it's inheriting MediaTypeFormatter class: protected override System.Threading.Tasks.Task<object> OnReadFromStreamAsync(Type type, System.IO.Stream stream, System.Net.Http.Headers.HttpContentHeaders contentHeaders, FormatterContext formatterContext) { var task = Task<object>.Factory.StartNew(() => { var settings = new JsonSerializerSettings(

Provide an Explicit Assembly Name for a Dynamically Compiled ASP.NET Website's App_Code Folder?

瘦欲@ 提交于 2020-01-04 05:04:25
问题 In a dynamically compiled ASP.NET Website project, can the assembly for the App_Code folder be explicitly named? For example, under regular circumstances when I run an ASP.NET website the assembly name generated into the Temporary ASP.NET Files\ folder is partially randomized like App_Code.neizakfo.dll where neizakfo is the portion that can differ. Can I explicitly provide a name for the assembly like App_Code_Web1.dll ? Clarification By business requirements, the website cannot be

Order of Classes within an Assembly

隐身守侯 提交于 2020-01-03 18:59:05
问题 What determines the order of classes within an Assembly? And.. is there a way to change it? Additional info: you can check the ordering either through reflection yourself, or you can use a tool like ILDASM, disable the alphabetical sorting, and then you will also get the order. Order seems to be in a strange way determined by the compiler. I already tried some things.. like renaming the classes (order stays the same), also editing the .csproj file to change the order of the .cs files. My main

Order of Classes within an Assembly

拥有回忆 提交于 2020-01-03 18:58:02
问题 What determines the order of classes within an Assembly? And.. is there a way to change it? Additional info: you can check the ordering either through reflection yourself, or you can use a tool like ILDASM, disable the alphabetical sorting, and then you will also get the order. Order seems to be in a strange way determined by the compiler. I already tried some things.. like renaming the classes (order stays the same), also editing the .csproj file to change the order of the .cs files. My main

How to save assembly to disk?

我与影子孤独终老i 提交于 2020-01-03 17:07:29
问题 How I can save assembly to file? I.e. I mean not dynamic assembly but "normal" in-memory assemblies. Assembly[] asslist = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly ass1 in asslist) { // How to save? } This situation can occur when the application loads some referenced assemblies from resources. I want to save them to disk. It is impossible to extract assemblies form resources because they are encrypted there. 回答1: How about trying to serialize the assembly? It is serializable

How to use Microsoft Fakes Assemblies on Process.Start

99封情书 提交于 2020-01-03 16:16:10
问题 I would like to mock the System.Diagnostics.Process.Start call, so i added a Fakes Assembly for the System Assembly. The problem is that Start is a static method on System.Diagnostics.Process so i'm not getting a shim to be able to hock on a delegate for the Start method. What is the correct way of doing this? 回答1: So first of all you need to generate the Shim for the Process class. After you create the Fakes for System you should see a folder called 'Fakes'. Inside that folder you need to

How to use C# Code to List all Namespaces in .NetStandard Library in a .Net Standard Project

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-03 05:09:13
问题 How to use C# Code to List all Namespaces in .NetStandard Library 2.0 from within a .Net Standard Project. This is the Code which gives Namspaces in netStandard Library is 0; foreach (AssemblyName fooAssemblyName in Assembly.GetExecutingAssembly().GetReferencedAssemblies()) { Assembly assembly = Assembly.Load(fooAssemblyName.FullName); var namespaces = assembly.GetTypes() .Select(t => t.Namespace).Where(t => !string.IsNullOrEmpty(t)) .Distinct(); int count = namespaces.Count(); if

Given the choice, what are the pros/cons of mixed-mode assemblies vs. separate interop DLLs?

安稳与你 提交于 2020-01-02 00:27:14
问题 When a 3rd-party component is offered in both "mixed-mode assembly" and "separate interop dll" versions, what are the pros and cons of each? A good example is System.Data.SQLite. The above link has this to say: [Mixed-mode assembly] packages should only be used in cases where the assembly binary must be deployed to the Global Assembly Cache for some reason. But WHY? The mixed-mode assembly seems to work just fine in my projects, with no GAC installation (just xcopy to the application's exe

Could not load file or assembly 'Antlr3.Runtime' or one of its dependencies

浪子不回头ぞ 提交于 2020-01-01 12:07:15
问题 I find a similar question, but no solution for my issue. Could not load file or assembly 'Antlr3.Runtime' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded I'm getting this error only in IIS. I'm trying to deploy to IIS 7.5. I set the application pool as 4.0, Integrated. Earlier everything was working fine. After I installed framework 4.5 VS 2012 express I got an exception using the MachineKeyCryptography . So I

Assembly binding redirect not working

本秂侑毒 提交于 2020-01-01 08:18:17
问题 I am trying to deploy a test web app on Azure, but when I run the Azure emulator on my local machine I get this error from the Azure emulator console attached to my WebRole: System.TypeLoadException: Unable to load the role entry point due to the following exceptions: -- System.IO.FileLoadException: Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not