assemblies

Is it possible to save a dynamic assembly to disk?

不打扰是莪最后的温柔 提交于 2019-12-01 03:23:18
I recently bought Ayende's book Building DSLs in Boo (buy it, read it, it's awesome) but I'm coming up against an implementation problem and I want to see what the generated code looks like. I would normally use reflector to look at the code but in this case the assemblies are dynamic and only in memory. Is there a way to save dynamic assemblies to disk so that I can reflect them? EDIT / My Answer : Wow, it took awhile to come back to this one. Unfortunately I left an important bit out from the original question. Important Bit: I'm using Ayende's RhinoDSL library as he recommends in the book.

How to identify that an assembly has been compiled with/for .NET 4.5, as opposed to .NET 4.0?

强颜欢笑 提交于 2019-12-01 03:17:18
问题 I have some build agents that is building .NET code for us through a TeamCity setup, and I'm beginning to wonder if despite the project settings, they're outputting .NET 4.5 built assemblies. My doubts come from the fact that I don't know if Windows 2012 Server came with .NET 4.5 or 4.0 out of the box and thus whether it ever has had only 4.0 or any of the 4.0 assemblies available. How can I look at a assembly on disk and determine whether it has been built with .NET 4.0 or 4.5? As is evident

Use of specific version reference in Visual Studio 2008

拥有回忆 提交于 2019-12-01 02:46:23
I have an assembly, Foo, which has a reference to assembly Bar (version X.X.X.2000). In the properties, the specific version is set to False. I have both Bar (x.x.x.2000) and Bar (x.x.x.1000) in my local GAC . Everything is fine. On another machine, where no version of Bar is in the GAC, but Bar (x.x.x.1000) is located in the same directory as Foo, running Foo will fail claiming it can not find Barr (x.x.x.2000) with Could not load file or assembly 'Bar, Version=x.x.x.2000, Culture=neutral, PublicKeyToken=YXYXYXYXXYX' or one of its dependencies. The located assembly's manifest definition does

Debug dynamically loaded assembly

丶灬走出姿态 提交于 2019-12-01 01:47:09
问题 I am debugging an assembly which I loaded dynamically with Assembly.Load(Byte[]), but I am facing some problems. First of all, I can't move the yellow arrow in Visual Studio 2010 to step into other lines of code, and also I am getiing exceptions ("Cannot find the method on the object instance.") when trying to do a quick watch on objects from a third party library (controls from Infragistics for example.) Dim data = My.Computer.FileSystem.ReadAllBytes(file.FullName) Assembly.Load(data) When

Visual Basic, why can't I import “System.Drawing” when my only reference is “System”?

故事扮演 提交于 2019-12-01 01:35:43
问题 In Visual Studio 10 - Visual Basic, why can't I import "System.Drawing" when my only reference is "System"? I can import "System.Runtime.InteropServices". To reproduce my problem: 1. Create a New Project in Visual Studio 10 with Visual Basic Class Library template. 2. Add "Imports System.Drawing" and "Imports System.Runtime.InteropServices" at the beginning. 3. Remove all references except "System" in the References pane of the project properties. Result: Visual Studio cannot find "System

Deploying NetFwTypeLib to manage the Windows Firewall

纵饮孤独 提交于 2019-12-01 01:14:09
问题 My Windows service needs to create/remove certain rules from the Windows firewall. For this I interface with NetFwTypeLib in <windows>\system32\hnetcfg.dll via COM. It works great on my 64-bit Windows 7 machine , but testing on another 64-bit Windows 7 machine throws the following error: Service cannot be started. System.IO.FileNotFoundException: Could not load file or assembly 'Interop.NetFwTypeLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system

How to wrap multiple dll in a single dll [duplicate]

删除回忆录丶 提交于 2019-12-01 00:14:09
Possible Duplicate: Merging .net managed dlls I create a test project in which I referenced a dll from some other project. When I build my test project, I see different dll for test project and the referenced dll. I want to wrap both dll's in a single dll. How can I do it. Take a look at ILMerge: http://www.microsoft.com/downloads/en/details.aspx?familyid=22914587-b4ad-4eae-87cf-b14ae6a939b0&displaylang=en http://www.codeproject.com/KB/dotnet/mergingassemblies.aspx With ILMerge you can merge a bunch of assemblies by running the command like: ilmerge /out:MergedAssembly.dll ProjectAssembly1.dll

Work out the type of c# application a class contained in a DLL is being used by

情到浓时终转凉″ 提交于 2019-11-30 23:40:01
Is there any way to know in C# the type of application that is running. Windows Service ASP.NET Windows Form Console I would like to react to the application type but cannot find a way to determine it. You should have the client code tell your code what the context is and then work from that. At best, you will be able to guess based on external factors. If you must guess, this is what I would look for: For ASP.NET, I would look for HttpContext.Current For Windows Forms, I see if the static OpenForms collection on the Application class has any items in it. For Windows Presentation Foundation,

Is it possible to save a dynamic assembly to disk?

回眸只為那壹抹淺笑 提交于 2019-11-30 23:27:25
问题 I recently bought Ayende's book Building DSLs in Boo (buy it, read it, it's awesome) but I'm coming up against an implementation problem and I want to see what the generated code looks like. I would normally use reflector to look at the code but in this case the assemblies are dynamic and only in memory. Is there a way to save dynamic assemblies to disk so that I can reflect them? EDIT / My Answer : Wow, it took awhile to come back to this one. Unfortunately I left an important bit out from

Assemblies vs Class Libraries (.NET)

大憨熊 提交于 2019-11-30 21:43:14
Could anyone point out the advantage of using assemblies, in the 'context' of ASP.NET . As I understand it, assemblies run as executables, have a single entry point, and can be run inside an application domain, but I've found very few suitable examples on the web. An assembly is not just an executable... an assembly is essentially a .NET library that may have an executable entry point... Wikipedia article with description of assemblies First paragraph: In the Microsoft .NET framework, an assembly is a partially compiled code library for use in deployment, versioning and security. There are two