.net-assembly

Should assembly guid attribute vary for different target framework builds of the same .NET library?

不羁的心 提交于 2019-12-04 15:19:20
I am developing a .NET library in C# which has to address a wide set of target frameworks. I want to produce a nuget package that would install correctly according to the settings of the target project. In order to achieve that, I am using multiple .csproj files. Each of them is addressing a particular target framework (for example MyLibrary.net45.csproj would create the binaries in bin/*/net45 , MyLibrary.netstandard1.2.csproj would create the output in bin/*/netstandard1.2 , and so on). Then I create a single nuget package with the outputs of the above projects. At this stage, the different

Are signed .net assemblies ever fully verified when loaded, to check they haven't been modified?

柔情痞子 提交于 2019-12-04 14:53:57
I used to think that .net assemblies that were signed and/or strong-named were verified by the CLR when loaded, meaning that it wasn't possible for someone to edit the IL and still have a valid assembly. Then I listened to this great Herding Code podcast where Jon McCoy said that doesn't really happen (approx 12:47 in the podcast) - i.e. anyone can edit the IL and mess with your assembly and the CLR will not care. I know this sounds weird, but he seems to know what he's talking about, so perhaps it's just that I don't know exactly what scenarios he's referring to. Can someone explain if & when

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

前提是你 提交于 2019-12-04 09:20:26
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 uninstalled 4.5 framework and VS 2012 due to which this mess is happening. The exception I'm getting is below

ASP.NET Core 5.0 error CS0012: The type 'Object' is defined in assembly 'mscorlib

喜夏-厌秋 提交于 2019-12-04 09:13:37
In Visual Studio 2015 I have a kproj, in this project I wanted to add a reference to an assembly that is not available in any public nuget package source, so I've created my own nuget package and this way was able to add the reference to this assembly. The problem is that now I'm getting the following exception: ASP.NET Core 5.0 error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Any ideas on how to overcome this? Solved it. Removed the framework

App.config in Test Projects

China☆狼群 提交于 2019-12-04 07:57:09
问题 I'm building an ASP.NET app in VS2010. I have a number of separate assemblies (class libraries) and corresponding Test projects for each. In one of the class libraries I use an App.config file to store settings. The assembly itself uses the following code to retrieve settings: string tmp = ConfigurationManager.AppSettings["mySetting"]; The problem is that when I try to create a Unit Test in a separate test project, the test does not pick up the setting in the App.config file. If I COPY the

Why is warning CS1607 “The version specified for the 'product version' is not in the normal 'major.minor.build.revision' format” generated?

♀尐吖头ヾ 提交于 2019-12-04 06:14:27
Today I'm getting a The version specified for the 'product version' is not in the normal 'major.minor.build.revision' format warning. It's related to the use of AssemblyInformationalVersionAttribute . My assembly attributes are: [assembly: AssemblyInformationalVersion("XXX 1.1.0")] [assembly: System.Runtime.InteropServices.ComVisible(false)] Basically the compiler complains about XXX 1.1.0 that doesn't look like x.y.z.r . From MSDN: The informational version provides additional version information for an assembly, in string format. It is for informational purposes only and is not used at run

System.Data Assembly Not found

只谈情不闲聊 提交于 2019-12-04 05:36:30
I have a reference to System.Data in my windows service project. I keep getting the Exception : Could not load file or assembly 'System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified. I attach the FusionLog to my code and found out the following. For System.Data only visual studio is looking here: Assembly manager loaded from: C:\windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll And it should be looking here (all the other assemblies are but System.Data) Assembly manager loaded from: C:

How to detect a missing .NET reference at runtime?

自闭症网瘾萝莉.ら 提交于 2019-12-04 05:31:45
My application contains references to an external library (the SQL Server Management Objects). Apparently, if the library is not present on the run-time system, the application still works as long as no methods are called that use classes from this library . Question 1: Is this specified behaviour or just a (lucky) side effect of the way the CLR loads libraries? To detect whether the reference is accessible, I currently use code like this: Function IsLibraryAvailable() As Boolean Try TestMethod() Catch ex As FileNotFoundException Return False End Try Return True End Function Sub TestMethod()

How to load specific version of assembly from GAC

僤鯓⒐⒋嵵緔 提交于 2019-12-04 05:07:13
问题 For testing purpose I like to load a specific version of an DLL assembly from GAC. However, my program always load the latest version - I think driven by Policy Assemblies. var dll = Assembly.Load("Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342"); Console.WriteLine(dll.ToString()); Output: Oracle.ManagedDataAccess, Version=4.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342 Even though I specify version "4.121.1.0" in strong name it loads

What is best practise when instantiating a Castle Windsor container in a class library? [duplicate]

和自甴很熟 提交于 2019-12-04 03:31:32
问题 This question already has answers here : Dependency Inject (DI) “friendly” library (4 answers) Closed 3 years ago . I am wondering where the best place to instantiate the castle Windsor container is in a class library. Should I simply do it in the constructor of the class I am using or is there a single entry point for assemblies that I am unaware of? Thanks. 回答1: The configuration of an injected object graph is entirely dependent on the needs of the application that actually uses it. The