.net-assembly

Assembly Versioning and Dll Versioning in Team City

孤街醉人 提交于 2019-12-03 11:33:36
问题 I want to have these Versions in a format like this.. {Major}.{Minor}.{Build}.{patch} how to set this in the assembly info patcher in team city? so that it will automatically increment the versions for each time it builds... i want some guidance and help in this...?!? 回答1: TeamCity can version assemblies for you with the AssemblyInfo Patcher build feature. To take advantage of this: Create a build parameter called %Major.Minor% . Set this manually to some value, e.g. 1.0 . On the General

JIT code generation techniques

一曲冷凌霜 提交于 2019-12-03 11:15:07
问题 How does a virtual machine generate native machine code on the fly and execute it? Assuming you can figure out what are the native machine op-codes you want to emit, how do you go about actually running it? Is it something as hacky as mapping the mnemonic instructions to binary codes, stuffing it into an char* pointer and casting it as a function and executing? Or would you generate a temporary shared library (.dll or .so or whatever) and load it into memory using standard functions like

Omit localized versions of assemblies from the build output

China☆狼群 提交于 2019-12-03 10:35:11
In one of my projects, I am using an awesome library called Humanizer . This library comes in many language variations (I counted 38). When I build my project, I then see all these folders like "af", "ar", "bg", "bn-BD", ..., "zh-Hant" with assemblies containing the localized resources for this library. My issue is that my project is English-only and I have no interest in having all those localized assemblies in my build output. Is there some good way of omitting them from the build? I am looking for general solutions to this problem. It happens with libraries other than Humanizer, like

'Could not load file or assembly 'netstandard, Version=2.0.0.0, …'. Reference assemblies should not be loaded for execution

邮差的信 提交于 2019-12-03 10:18:47
Goal: From a .NET 4.7 console app, using reflection with Assembly.GetType(), I am trying extract the Type of a netstandard 2.0 class from Assembly X. Then I want to create an instance of this Type with Activator.CreateInstance(). What I am trying to do: However, this assembly X has a dependency to netstandard 2.0. To be able to get the Type, netstandard dependency has to be loaded into the AppDomain. That's why when the AppDomain is requesting the netstandard assembly through the AssemblyResolve event, I simply load the dll like this : var netStandardDllPath = @"C:\Users\xxx\.nuget\packages

Get company name and copyright information of assembly [duplicate]

会有一股神秘感。 提交于 2019-12-03 09:31:12
This question already has answers here : Retrieve AssemblyCompanyName from Class Library (5 answers) I am using Assembly.GetEntryAssembly().GetName() to get application/assembly name and its version but I do not see any variable for company name and copyright. How do I get that? You can use FileVersionInfo like this: var versionInfo = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location); var companyName = versionInfo.CompanyName; George Duckett From this answer for the company name: Assembly currentAssem = typeof(CurrentClass).Assembly; object[] attribs = currentAssem

Making TeamCity Version Match .NET Assembly Version

a 夏天 提交于 2019-12-03 07:16:53
问题 Right now our assemblies have a version number like 2.0.831.0. As I understand it, that's major version, minor version, date and build number. If I make a change and build again on the same day it's 2.0.831.1, 2.0.831.2 etc. My TeamCity build number format is simply 2.{0} where {0} is an auto incremented number that just goes on forever (2.195, 2.196 etc). How do I make TeamCity look exactly like the assembly version? We want to be able to associate the Change Log with the assembly version so

FileNotFound when load assembly with dependency to another domain

一个人想着一个人 提交于 2019-12-03 05:58:56
I'm trying to make application with plugins. I have MainLib.dll, where I made some commnon interface(let it be ICommon ) with 1 method. Then, I made 2 .dlls(plugins) which have reference to MainLib.dll and implement the ICommon in some classes. Also, I removed all the references in this .dlls exept System . Then, I created an application, which monitors folder ".\\Plugins" and loads all .dlls in newDomain , check if the types in .dll implement ICommon (so this application also reference to MainLib.dll). If yes - add the name of .dll in some list. And now here the problem : before I tried to

Not allowed to load assembly from network location

只谈情不闲聊 提交于 2019-12-03 05:41:07
I've recently set up a new Windows Server 2012 R2 environment and installed Visual Studio 2012 . Now I'm having a problem with multiple .NET 4.5 project's I migrated from my old server, a Windows Server 2008 machine. This never occurred on the old server. When trying to load an assembly from a network location, I run into the following issue: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be

Determine the load context of an assembly

China☆狼群 提交于 2019-12-03 05:19:48
Given a loaded Assembly is there a way (in code) to determine which of the 3 load contexts it was loaded into (default Load , LoadFrom, or Neither )? In Suzanne Cook's "Choosing a Binding Context" article, there are some disadvantages that occur when an assembly is loaded into the LoadFrom . In particular, my library uses deserialization and encounters an InvalidCastException when loaded into the LoadFrom context. Currently my library fails very late (it fails when it executes the problematic deserialization code--see my example ). I'd like to make it fail much earlier in these circumstances

Get dependent assemblies?

纵然是瞬间 提交于 2019-12-03 05:04:42
问题 Is there a way to get all assemblies that depend on a given assembly? Pseudo: Assembly a = GetAssembly(); var dependants = a.GetDependants(); 回答1: If you wish to find the dependent assemblies from the current application domain, you could use something like the GetDependentAssemblies function defined below: private IEnumerable<Assembly> GetDependentAssemblies(Assembly analyzedAssembly) { return AppDomain.CurrentDomain.GetAssemblies() .Where(a => GetNamesOfAssembliesReferencedBy(a) .Contains