.net-assembly

Custom Assembly Attribute to String

半世苍凉 提交于 2019-12-14 04:07:27
问题 I have defined a custom assembly attribute and am trying to call it into a string much like my previous post Calling Custom Assembly Attributes. I am now trying to accomplish the very same thing in c#. I have defined my custom attribute: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.InteropServices; using System.Reflection; namespace authenticator.Properties { public class SemverAttribute : Attribute { private string _number; public

Getting “main” Assembly version number

﹥>﹥吖頭↗ 提交于 2019-12-13 14:49:41
问题 I have a solution with libraries (DLLs) which are used in 2 identical projects (one for WP7, another for WP8). In one of the libraries I have the code which determines the version of the application. private static Version mVersion; public static Version Version { get { if (mVersion == default(Version)) { var lcAssembly = Assembly.GetExecutingAssembly(); var parts = lcAssembly.FullName.Split(','); var lcVersionStr = parts[1].Split('=')[1]; mVersion = new Version(lcVersionStr); } return

“Could not load file or assembly” when building using team city

主宰稳场 提交于 2019-12-13 11:38:58
问题 I'm running into an issue with unit tests on our Team City (8.0.4) build server - the code builds & runs all tests locally via Resharper and nCrunch. But when running on the server I get the following error, even though the Unity assembly exists in the same directory as the unit test assembly, and is referenced in the unit test assembly. SetUp method failed. SetUp : System.IO.FileNotFoundException : Could not load file or assembly 'Microsoft.Practices.Unity, Version=2.0.414.0, Culture=neutral

List of classes in an assembly C#

ⅰ亾dé卋堺 提交于 2019-12-13 11:26:54
问题 I want to get the list of classes in an assembly, as an output i want a List[Interface] not a List[string], as "Interface" is the interface from which inherits the classes of my assembly. I don't know if my question makes sense but if any one has the answer i would very much thankful. I already tried this solution: List of classes in an assembly, but it gives a list[string] containing the classes namesso it didn't help because i need the list of the classes that inherits from my interface.

.Net assembly override the Assembly.GetExecutingAssembly().CodeBase/Location of an external assembly

心不动则不痛 提交于 2019-12-13 08:24:39
问题 I have a reference to an external assembly DLL (say I copy it in c:\project\abc.dll) in the project setting. When I make a call to the exported method from that assembly I get runtime error. Because it is looking for a file abc.ini which is in c:\ABC while the .exe error message saying that it cannot find the abc.ini in c:\project The assembly seems looking for the folder returned by either Assembly.GetExecutingAssembly().CodeBase or Assembly.GetExecutingAssembly().Location for the abc.ini.

Include external .dll in Visual Studio Extension

泄露秘密 提交于 2019-12-13 07:41:35
问题 I have a problem using external libraries for my visual studio extension. Currently I have my own NuGet server on which I host my libraries, now since I dont want functionality twice I extracted some functions out of my extension into an existing library. The problem is however that whenever I want to use anything from that assembly I can not do so, since visual studio does not include the .dlls in the .vsix package. So far I have tried: using Assets to include the libraries from their

.NET Publisher Policy Target Framework

这一生的挚爱 提交于 2019-12-13 07:35:03
问题 SUMMARY How do I create a publisher policy assembly that targets the same framework version as the redirected assembly? TL;DR I have an Assembly.dll with version 1.x.y.0 and I also have a publisher policy for it named policy.1.0.Assembly.dll which redirects versions 1.0.0.0-1.x.y.0 to 1.x.y.0 . The Assembly.dll targets .NET Framework 3.5. Am I right in thinking that the policy.1.0.Assembly.dll should also target .NET Framework 3.5 for things to work correctly on all frameworks 3.5+? If yes,

Missing types using reflection on DLL

我是研究僧i 提交于 2019-12-13 07:12:58
问题 I'm writing a program that uses reflection to look at a DLL, and obtain the table names/enums within. After obtaining the assembly using the method "ReflectionOnlyLoadFrom" to avoid having to load all dependencies, I use the following code to grab the types: try { types = assembly.GetTypes(); } catch (ReflectionTypeLoadException ex) { types = ex.Types.Where(p => p != null).ToArray(); } This returns most of the types, but the ones I really need are not listed here. The commonality between the

How to access .Net dll in classic asp?

╄→尐↘猪︶ㄣ 提交于 2019-12-13 06:39:20
问题 I know this is a repeated question ,but no solution worked for me . I am having a custom .Net dll . I have to use this in both aspx and asp pages. Before accesing in asp ,i did the following things, 1.Build the dll project. 2.In VS2005 cmd prompt i ran sn -k MarkItUp.snk. 3.Referenced the key file in assembly.cs as [assembly: AssemblyKeyFileAttribute(@"C:\Projects\Xxx.xx.Utilities\bin\Debug\MarkItUp.snk")] 4.Then in VS2005 cmd prompt 1.tlbexp Xxx.xx.Utilities.dll /out:Xxx.xx.Utilities.tlb 2

Dynamically loaded Assembly not loading in new AppDomain

与世无争的帅哥 提交于 2019-12-13 06:17:49
问题 This is not a duplicate - I have reviewed this related StackOverflow question with no luck: How to Load an Assembly to AppDomain with all references recursively? I have two console applications. AssemblyLoaderTest.exe and testapp.exe I am trying to use AssemblyLoaderTest.exe to dynamically load testapp.exe and call a method from a class within testapp.exe So far the code works - the method "TestWrite()" in testapp.exe is executed correctly (and outputsuccess.txt is written), however , testapp