.net-assembly

Handle loading of .net module into PowerShell

为君一笑 提交于 2019-12-23 05:49:33
问题 I have an .NET assembly that will get imported by a Powershell session using: Import-Module MyAssemblyFirst.dll What I need is to automatically load another custom assembly ( MyAssemblySecond.dll ) that I know about when MyAssemblyFirst.dll gets imported. The scenario I am looking for is: Import-Module MyAssemblyFirst.dll Import-Module MyAssemblySecond.dll but I would rather like to have only one Import-Module call: Import-Module MyAssemblyFirst.dll ...and somehow to trigger loading the

ILRepack for .Net Core Projects with MSBuild

帅比萌擦擦* 提交于 2019-12-23 04:22:33
问题 I want to integrate ILRepack in my MSBuild pipeline for a .Net Core project to merge all required dlls into a single exe/dll. The useful NuGet-Package ILRepack.MSBuild.Task seems well fitted for that, however the example in the GitHub readme does not quite work for .Net Core projects and I can't figure out how I have to change this to be compatible with a .Net Core project: <!-- ILRepack --> <Target Name="AfterBuild" Condition="'$(Configuration)' == 'Release'"> <ItemGroup> <InputAssemblies

Could not load file or assembly 'System.ComponentModel.Annotations' in published .Net 4.6.1 project referencing .Net Standard library

回眸只為那壹抹淺笑 提交于 2019-12-22 06:27:12
问题 PLEASE NOTE : This is not a duplicate of Could not load file or assembly 'System.ComponentModel.Annotations, Version=4.1.0.0. Unlike the issue linked, this issue occurs only after publishing the application. As you will see below, I have tried every solution proposed in that post with no success. This issue occurs in a WPF .Net Framework 4.6.1 project which references a .Net Standard 2.0 library which itself references the System.ComponentModel.Annotations NuGet package. The issue is

Could not load file or assembly 'System.ComponentModel.Annotations' in published .Net 4.6.1 project referencing .Net Standard library

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-22 06:26:26
问题 PLEASE NOTE : This is not a duplicate of Could not load file or assembly 'System.ComponentModel.Annotations, Version=4.1.0.0. Unlike the issue linked, this issue occurs only after publishing the application. As you will see below, I have tried every solution proposed in that post with no success. This issue occurs in a WPF .Net Framework 4.6.1 project which references a .Net Standard 2.0 library which itself references the System.ComponentModel.Annotations NuGet package. The issue is

Cannot install assembly to cache?

时光怂恿深爱的人放手 提交于 2019-12-22 05:02:14
问题 I am trying to add an assembly to the cache on Visual Studio 2010 Command Prompt. I get this error "Failure adding assembly to the cache: Attempt to install an assembly without a strong name". I am adding a ListTasks2.dll assembly from a WCF Service App called ListTasks2. I never had this issue with a similarly-named project, so why is it raising an issue now? NOTE: I tried signing it in Visual Studio and it still doesn't work. I wonder if it might be a permission issue. I used different user

Load a .NET assembly from the application's resources and run It from memory, but without terminating the main/host application

丶灬走出姿态 提交于 2019-12-22 04:11:29
问题 INTRODUCTION I'm using the next C# code example shared by David Heffernan ' for loading a .NET assembly from the application's resources and run It from memory: Assembly a = Assembly.Load(bytes); MethodInfo method = a.EntryPoint; if (method != null) method.Invoke(a.CreateInstance(method.Name), null); Here I just share an adaptation in VB.NET that I am using too: Public Shared Sub Execute(ByVal resource As Byte(), ByVal parameters As Object()) Dim ass As Assembly = Assembly.Load(resource) Dim

Load a .NET assembly from the application's resources and run It from memory, but without terminating the main/host application

夙愿已清 提交于 2019-12-22 04:11:09
问题 INTRODUCTION I'm using the next C# code example shared by David Heffernan ' for loading a .NET assembly from the application's resources and run It from memory: Assembly a = Assembly.Load(bytes); MethodInfo method = a.EntryPoint; if (method != null) method.Invoke(a.CreateInstance(method.Name), null); Here I just share an adaptation in VB.NET that I am using too: Public Shared Sub Execute(ByVal resource As Byte(), ByVal parameters As Object()) Dim ass As Assembly = Assembly.Load(resource) Dim

Binary serialization with dynamically loaded .Net assembly

巧了我就是萌 提交于 2019-12-22 04:09:05
问题 I serialized an instance of my class into a file (with BinaryFormatter ) After, in another project, I wanted to deserialize this file, but it did not work because my new project does not have the description of my old class. The .Deserialize() gets an exception Unable to find assembly '*MyAssembly, Version=1.9.0.0, Culture=neutral, PublicKeyToken=null'.*". But I have the .DLL of the assembly containing a description of the old class which I want to deserialize. I don't want to add a reference

Reference to assembly without strong name

有些话、适合烂在心里 提交于 2019-12-22 03:25:26
问题 Is there a way to reference a library without a strong name? When I add a reference to the assembly in references and rebuild solution everything is fine, but when I call the class from this assembly solution it doesn't build. Output says that referenced assembly should have strong name. What is the best solution? Strong naming library is not preferable. 回答1: I think the problem you have here is that the assembly you are trying to add the reference from is being signed with a strong name but

Modify Compiled .Net Exe

烂漫一生 提交于 2019-12-22 03:22:31
问题 I have an application written in C# (without the source of course), that needs to be changed a little bit. For example, I need to stop a few lines of code that create an unnecessary menu. So I think I should comment them out. The source code is not obfuscated. I know I can completely decompile, change, and compile again, using tools like Reflector/Reflexil. But everyone knows that by doing this, many parts of code won't compile again! Is there a way in Reflector (or any other product) that a