本文整理汇总了C#中AssemblyName类的典型用法代码示例。如果您正苦于以下问题:C# AssemblyName类的具体用法?C# AssemblyName怎么用?C# AssemblyName使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AssemblyName类属于命名空间,在下文中一共展示了AssemblyName类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetAssemblies
/// <summary>
/// Gets the assemblies in the current application domain.
/// </summary>
/// <returns></returns>
public Assembly[] GetAssemblies()
{
if (_loadedAssemblies == null)
{
_loadedAssemblies = new List<Assembly>();
var folder = Package.Current.InstalledLocation;
var operation = folder.GetFilesAsync();
var task = operation.AsTask();
task.Wait();
foreach (var file in task.Result)
{
if (file.FileType == ".dll" || file.FileType == ".exe")
{
var filename = file.Name.Substring(0, file.Name.Length - file.FileType.Length);
var name = new AssemblyName { Name = filename };
var asm = Assembly.Load(name);
_loadedAssemblies.Add(asm);
}
}
}
return _loadedAssemblies.ToArray();
}
开发者ID:pars87,项目名称:Catel,代码行数:30,代码来源:AppDomain.cs
示例2: Main
static int Main(string[] args)
{
Options options = new Options();
List<Export> exports = new List<Export>();
if (!ParseArgs(args, options) || !ParseDefFile(options.deffile, exports))
{
return 1;
}
AssemblyName name = new AssemblyName(Path.GetFileNameWithoutExtension(options.outputFile));
name.Version = options.version;
name.KeyPair = options.key;
AssemblyBuilder ab = universe.DefineDynamicAssembly(name, AssemblyBuilderAccess.Save);
ModuleBuilder modb = ab.DefineDynamicModule(name.Name, options.outputFile);
foreach (Export exp in exports)
{
ExportMethod(modb, exp);
}
modb.CreateGlobalFunctions();
if (options.win32res != null)
{
ab.DefineUnmanagedResource(options.win32res);
}
else
{
if (options.description != null)
{
ab.SetCustomAttribute(new CustomAttributeBuilder(universe.Import(typeof(System.Reflection.AssemblyTitleAttribute)).GetConstructor(new Type[] { universe.Import(typeof(string)) }), new object[] { options.description }));
}
ab.DefineVersionInfoResource(options.product, options.version.ToString(), options.company, options.copyright, null);
}
ab.Save(options.outputFile, options.peKind, options.machine);
return 0;
}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:33,代码来源:implib.cs
示例3: _Startup
private static void _Startup()
{
AssemblyName[] referencAssemblyNames = Assembly.GetExecutingAssembly().GetReferencedAssemblies();
AssemblyName[] allAssemblyNames = new AssemblyName[referencAssemblyNames.Length + 1];
referencAssemblyNames.CopyTo(allAssemblyNames, 1);
allAssemblyNames[0] = Assembly.GetExecutingAssembly().GetName();
foreach (AssemblyName assemblyName in allAssemblyNames)
{
Assembly assembly = Assembly.Load(assemblyName);
Type[] types = assembly.GetTypes();
foreach (Type type in types)
{
if(typeLookupTable.ContainsKey(type.FullName))
continue;
typeLookupTable.Add(type.FullName, type);
if (type.IsDefined(typeof (OldName), false))
{
OldName oldNameInfo = (OldName) type.GetCustomAttributes(typeof (OldName), false)[0];
oldNameLookupTable.Add(oldNameInfo.Name, type.FullName);
}
}
}
}
开发者ID:Awesome-MQP,项目名称:Storybook,代码行数:28,代码来源:TypeHelper.cs
示例4: test_0_load_dynamic
public static int test_0_load_dynamic()
{
AssemblyName
an
=
new
AssemblyName();
an.Name
=
"NOT.EXISTS";
AssemblyBuilder
ab
=
AppDomain.CurrentDomain.DefineDynamicAssembly(an,
AssemblyBuilderAccess.RunAndSave);
ModuleBuilder
mb
=
ab.DefineDynamicModule("NOT.EXISTS");
Assembly
b
=
Assembly.LoadWithPartialName
("NOT.EXISTS");
if
(b
==
null)
return
0;
else
return
1;
}
开发者ID:robertmichaelwalsh,项目名称:Multilex,代码行数:34,代码来源:loader.cs
示例5: Main
public static int Main () {
AssemblyName assemblyName = new AssemblyName();
assemblyName.Name = "customMod";
assemblyName.Version = new Version (1, 2, 3, 4);
AssemblyBuilder assembly
= Thread.GetDomain().DefineDynamicAssembly(
assemblyName, AssemblyBuilderAccess.RunAndSave);
ModuleBuilder module = assembly.DefineDynamicModule("res.exe", "res.exe");
TypeBuilder genericFoo = module.DefineType ("GenericFoo", TypeAttributes.Public, typeof (object));
genericArgs = genericFoo.DefineGenericParameters ("T");
fooOpenInst = genericFoo.MakeGenericType (genericArgs);
EmitCtor (genericFoo);
EmitTargetMethod (genericFoo);
EmitTestEvents (genericFoo);
TypeBuilder moduletype = module.DefineType ("ModuleType", TypeAttributes.Public, typeof (object));
MethodBuilder main = moduletype.DefineMethod ("Main", MethodAttributes.Public | MethodAttributes.Static, typeof (void), null);
ILGenerator il = main.GetILGenerator ();
Type strInst = genericFoo.MakeGenericType (typeof (string));
il.Emit (OpCodes.Newobj, TypeBuilder.GetConstructor (strInst, ctor));
il.Emit (OpCodes.Callvirt, TypeBuilder.GetMethod (strInst, testEvents));
il.Emit (OpCodes.Ret);
genericFoo.CreateType ();
Type res = moduletype.CreateType ();
res.GetMethod ("Main").Invoke (null, null);
return 0;
}
开发者ID:Zman0169,项目名称:mono,代码行数:34,代码来源:bug-389886-2.cs
示例6: AboutViewModel
public AboutViewModel()
{
string name = Assembly.GetExecutingAssembly().FullName;
AssemblyName assemblyName = new AssemblyName(name);
Version = assemblyName.Version.ToString();
}
开发者ID:salfab,项目名称:Open-Todo,代码行数:7,代码来源:AboutViewModel.cs
示例7: CurrentDomainOnAssemblyResolve
private Assembly CurrentDomainOnAssemblyResolve(object sender, ResolveEventArgs args)
{
var name = new AssemblyName(args.Name).Name;
var searchPaths = new[] {
"",
Path.Combine(name, "bin", "net45")
};
var basePath = _originalApplicationBase ?? AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
foreach (var searchPath in searchPaths)
{
var path = Path.Combine(basePath,
searchPath,
name + ".dll");
if (File.Exists(path))
{
return Assembly.LoadFile(path);
}
}
return null;
}
开发者ID:Gidra,项目名称:KRuntime,代码行数:25,代码来源:DomainManager.cs
示例8: Main
static void Main(string[] args)
{
AssemblyName an = new AssemblyName();
an.Name = "HelloWorld";
AssemblyBuilder ab = Thread.GetDomain().DefineDynamicAssembly(an, AssemblyBuilderAccess.RunAndSave);
ModuleBuilder module = ab.DefineDynamicModule("b.dll");
TypeBuilder tb = module.DefineType("type", TypeAttributes.Public | TypeAttributes.Class);
MethodBuilder mb = tb.DefineMethod("test",
MethodAttributes.HideBySig | MethodAttributes.Static |
MethodAttributes.Public, typeof(void), null);
ILGenerator ig = mb.GetILGenerator();
//
// This is the actual test:
// Generate a method signature that contains modopts and modreqs
// and call that. It has no name or anything, not sure how this
// is actually used, but we at least generate the stuff
//
SignatureHelper sh = SignatureHelper.GetMethodSigHelper (module, CallingConventions.HasThis, typeof(int));
sh.AddArgument (typeof (bool));
Type [] req = new Type [] { typeof (System.Runtime.CompilerServices.IsBoxed) };
sh.AddArgument (typeof (string), req, null);
Type [] opt = new Type [] { typeof (System.Runtime.CompilerServices.IsConst) };
sh.AddArgument (typeof (byte), null, opt);
sh.AddArgument (typeof (int), null, opt);
sh.AddArgument (typeof (long), null, opt);
ig.Emit (OpCodes.Call, sh);
ig.Emit(OpCodes.Ret);
tb.CreateType();
ab.Save ("b.dll");
}
开发者ID:Zman0169,项目名称:mono,代码行数:34,代码来源:sighelpermod.cs
示例9: CreateDynamicMethod
public void CreateDynamicMethod()
{
#if SAVE_ASSEMBLY
if (_assemblyBuilder == null)
{
AssemblyName assemblyName = new AssemblyName("ExpressionAssembly");
_assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.RunAndSave, "I:\\Trash");
_moduleBuilder = _assemblyBuilder.DefineDynamicModule("ExpressionModule", "ExpressionModule.module");
}
string typeName = String.Format("Expression{0}", _typeCount);
_typeCount++;
_typeBuilder = _moduleBuilder.DefineType(typeName, TypeAttributes.Class | TypeAttributes.Public);
FieldBuilder filedBuilder = _typeBuilder.DefineField("Source", typeof(string), FieldAttributes.Public | FieldAttributes.Static | FieldAttributes.Literal);
filedBuilder.SetConstant(_source);
_methodBuilder = _typeBuilder.DefineMethod("Evaluate", MethodAttributes.Public | MethodAttributes.Static, typeof(object), new Type[] { typeof(object[]) });
_ilGenerator = _methodBuilder.GetILGenerator();
#else
_dynamicMethod = new DynamicMethod("Expression", typeof(object), new Type[] { typeof(object[]) }, GetType().Module);
_ilGenerator = _dynamicMethod.GetILGenerator();
#endif
}
开发者ID:chenzuo,项目名称:nquery,代码行数:25,代码来源:ILEmitContext.cs
示例10: GetLocation
/// <summary>
/// Returns the original location of the corresponding assembly if available, otherwise returns the location of the shadow copy.
/// If the corresponding assembly is not in the GAC, null is returned.
/// </summary>
public static string GetLocation(AssemblyReference assemblyReference){
if (assemblyReference == null) { Debug.Fail("assemblyReference == null"); return null; }
lock(GlobalAssemblyCache.Lock){
if (!GlobalAssemblyCache.FusionLoaded){
GlobalAssemblyCache.FusionLoaded = true;
System.Reflection.Assembly systemAssembly = typeof(object).Assembly;
//^ assume systemAssembly != null && systemAssembly.Location != null;
string dir = Path.GetDirectoryName(systemAssembly.Location);
//^ assume dir != null;
GlobalAssemblyCache.LoadLibrary(Path.Combine(dir, "fusion.dll"));
}
IAssemblyEnum assemblyEnum;
CreateAssemblyEnum(out assemblyEnum, null, null, ASM_CACHE.GAC, 0);
if (assemblyEnum == null) return null;
IApplicationContext applicationContext;
IAssemblyName currentName;
while (assemblyEnum.GetNextAssembly(out applicationContext, out currentName, 0) == 0){
//^ assume currentName != null;
AssemblyName aName = new AssemblyName(currentName);
if (assemblyReference.Matches(aName.Name, aName.Version, aName.Culture, aName.PublicKeyToken)){
string codeBase = aName.CodeBase;
if (codeBase != null && codeBase.StartsWith("file:///"))
return codeBase.Substring(8);
return aName.GetLocation();
}
}
return null;
}
}
开发者ID:tapicer,项目名称:resource-contracts-.net,代码行数:33,代码来源:AssemblyCache.cs
示例11: Main
public static void Main()
{
AssemblyName name = new AssemblyName();
name.Name="HelloWorld";
//.assembly HelloWorld{}
AssemblyBuilder asmBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(name,AssemblyBuilderAccess.RunAndSave);
ModuleBuilder mod = asmBuilder.DefineDynamicModule ("HelloWorld","HelloWorld.exe");//.module HelloWorld.exe
//.class private auto ansi initbeforefield Helloworld
TypeBuilder myClass = mod.DefineType("HelloWorld",TypeAttributes.AutoClass | TypeAttributes.AnsiClass | TypeAttributes.BeforeFieldInit,null,PackingSize.Unspecified);
//.method public hidebysig static void Main() cil managed
MethodBuilder method = myClass.DefineMethod("Main",MethodAttributes.Public | MethodAttributes.Static | MethodAttributes.HideBySig ,CallingConventions.Standard,typeof(void),null);
ILGenerator ilGen = method.GetILGenerator();
ilGen.Emit(OpCodes.Ldstr,"Hello World"); //ldstr "Hello World"
MethodInfo writeLineInfo = typeof(System.Console).GetMethod
(
"WriteLine" ,
BindingFlags.Static | BindingFlags.Public | BindingFlags.InvokeMethod,
null,
CallingConventions.Any | CallingConventions.VarArgs ,
new Type[] {typeof(string)},null
);
ilGen.EmitCall(OpCodes.Call,writeLineInfo,null);//call void [mscorlib]System.Console::Write(string)
ilGen.Emit(OpCodes.Ret);//ret
asmBuilder.SetEntryPoint(method);//make .entrypoint
myClass.CreateType();
Console.WriteLine("Run before save:");
myClass.InvokeMember("Main", BindingFlags.InvokeMethod | BindingFlags.Static | BindingFlags.Public ,null, null,null);
asmBuilder.Save("HelloWorld.exe");
Console.WriteLine("HelloWorld.exe saved...\nRun after save:");
AppDomain.CurrentDomain.ExecuteAssembly("HelloWorld.exe");
}
开发者ID:rags,项目名称:playground,代码行数:31,代码来源:HelloWorldEmitter.cs
示例12: QueryAssemblyInfo
public int QueryAssemblyInfo(uint dwFlags, [MarshalAs(UnmanagedType.LPWStr)] string pszAssemblyName, ref AssemblyName.ASSEMBLY_INFO pAsmInfo)
{
pAsmInfo = new AssemblyName.ASSEMBLY_INFO();
pAsmInfo.cbAssemblyInfo = 1; // just needs to be nonzero for our purposes
// All they need here is pszCurrentAssemblyPathBuf to be filled out.
// pszAssemblyName is the strong name (as returned from MonoAssemblyName.GetDisplayName),
// like "System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
//
// Mono stores them in monoDir\lib\mono\gac\ASSEMBLY_NAME\VERSION__PUBLICKEYTOKEN\ASSEMBLY_NAME.dll
//
// .. so this strong name : "System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
// .. would be located here: monoDir\lib\mono\gac\System.Core\4.0.0.0__b77a5c561934e089\System.Core.dll
string [] parts = pszAssemblyName.Split( new string[] {", "}, StringSplitOptions.RemoveEmptyEntries );
string sAssemblyName = parts[0];
string sVersion = parts[1].Split( new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries )[1];
string sPublicKeyToken = parts[3].Split( new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries )[1];
string sGACDir = MonoGACHelpers.GetGACDir();
sGACDir = Path.Combine( sGACDir, sAssemblyName );
sGACDir = Path.Combine( sGACDir, sVersion + "__" + sPublicKeyToken );
pAsmInfo.pszCurrentAssemblyPathBuf = Path.Combine( sGACDir, sAssemblyName + ".dll" );
Debug.Assert( false );
return 0;
}
开发者ID:Refresh06,项目名称:visualmutator,代码行数:28,代码来源:MonoAssemblyCache.cs
示例13: Contains
/// <param name="codeBaseUri">Uri pointing to the assembly</param>
public static bool Contains(Uri codeBaseUri){
if (codeBaseUri == null) { Debug.Fail("codeBaseUri == null"); return false; }
lock(GlobalAssemblyCache.Lock){
if (!GlobalAssemblyCache.FusionLoaded){
GlobalAssemblyCache.FusionLoaded = true;
System.Reflection.Assembly systemAssembly = typeof(object).Assembly;
//^ assume systemAssembly != null && systemAssembly.Location != null;
string dir = Path.GetDirectoryName(systemAssembly.Location);
//^ assume dir != null;
GlobalAssemblyCache.LoadLibrary(Path.Combine(dir, "fusion.dll"));
}
IAssemblyEnum assemblyEnum;
int rc = GlobalAssemblyCache.CreateAssemblyEnum(out assemblyEnum, null, null, ASM_CACHE.GAC, 0);
if (rc < 0 || assemblyEnum == null) return false;
IApplicationContext applicationContext;
IAssemblyName currentName;
while (assemblyEnum.GetNextAssembly(out applicationContext, out currentName, 0) == 0){
//^ assume currentName != null;
AssemblyName assemblyName = new AssemblyName(currentName);
string scheme = codeBaseUri.Scheme;
if (scheme != null && assemblyName.CodeBase.StartsWith(scheme)){
try{
Uri foundUri = new Uri(assemblyName.CodeBase);
if (codeBaseUri.Equals(foundUri)) return true;
#if !FxCop
}catch(Exception){
#else
}finally{
#endif
}
}
}
return false;
}
}
开发者ID:tapicer,项目名称:resource-contracts-.net,代码行数:36,代码来源:AssemblyCache.cs
示例14: Main
public static int Main()
{
try
{
#if DESKTOP
Assembly a = Assembly.Load("system, processorArchitecture=somebadvalue");
#else
AssemblyName an = new AssemblyName("system, processorArchitecture=somebadvalue");
#endif
}
catch(System.IO.FileLoadException e)
{
if(e.ToString().ToUpper().IndexOf("UNKNOWN ERROR") == -1)
{
//we didn't get "Unknown error" in the exception text
Console.WriteLine("Pass");
return 100;
}
else
{
Console.WriteLine("Wrong exception text: " + e.ToString());
Console.WriteLine("FAIL");
return 101;
}
}
Console.WriteLine("Didn't catch FileLoadException. FAIL");
return 99;
}
开发者ID:CheneyWu,项目名称:coreclr,代码行数:28,代码来源:repro177066.cs
示例15: Check
public static int Check(AssemblyName asmN){
String strVersion = asmN.ToString();
int index = strVersion.ToLower().IndexOf("version=");
if(asmN.Version==null){
if(index==-1){
Console.WriteLine("Passed: both asmName.ToString() version and asmName.Version are null.");
return 100;
}else{
Console.WriteLine("Failed: asmName.Version != asmName.ToString() Version");
Console.WriteLine ("\tasmName.Version = \"{0}\"", asmN.Version);
Console.WriteLine ("\tasmName.ToString() = \"{0}\"", strVersion);
return 101;
}
}else{
strVersion = strVersion.Substring(index+8,7);
if(strVersion.Equals(asmN.Version.ToString())){
Console.WriteLine("Passed: asmName.Version == asmName.ToString() Version");
return 100;
}else{
Console.WriteLine("Failed: asmName.Version != asmName.ToString() Version");
Console.WriteLine ("\tasmName.Version = \"{0}\"", asmN.Version);
Console.WriteLine ("\tasmName.ToString() = \"{0}\"", strVersion);
return 101;
}
}
}
开发者ID:CheneyWu,项目名称:coreclr,代码行数:26,代码来源:test.cs
示例16: ResolveAssembly
public static Assembly ResolveAssembly(string assemblyName)
{
if (nullCache.ContainsKey(assemblyName))
{
return null;
}
var requestedAssemblyName = new AssemblyName(assemblyName);
var assembly = Common.ReadExistingAssembly(requestedAssemblyName);
if (assembly != null)
{
return assembly;
}
Common.Log("Loading assembly '{0}' into the AppDomain", requestedAssemblyName);
assembly = Common.ReadFromEmbeddedResources(assemblyNames, symbolNames, requestedAssemblyName);
if (assembly == null)
{
nullCache.Add(assemblyName, true);
// Handles retargeted assemblies like PCL
if (requestedAssemblyName.Flags == AssemblyNameFlags.Retargetable)
{
assembly = Assembly.Load(requestedAssemblyName);
}
}
return assembly;
}
开发者ID:Klako,项目名称:ShitChat,代码行数:30,代码来源:ILTemplate.cs
示例17: Main
public static void Main(string[] args)
{
string basedir = AppDomain.CurrentDomain.BaseDirectory;
using (FileStream fs = File.Open (Path.Combine (basedir, "key.snk"), FileMode.Open)) {
AssemblyName asmname = new AssemblyName ();
asmname.Name = "snafu2";
asmname.KeyPair = new StrongNameKeyPair (fs);
AssemblyBuilder asm = AppDomain.CurrentDomain.DefineDynamicAssembly (asmname, AssemblyBuilderAccess.RunAndSave);
ModuleBuilder mod = asm.DefineDynamicModule (asmname.Name + ".dll");
TypeBuilder type = mod.DefineType ("bar", TypeAttributes.Public);
MethodBuilder meth = type.DefineMethod ("foo", MethodAttributes.Static | MethodAttributes.Public, typeof (string), Type.EmptyTypes);
ILGenerator il = meth.GetILGenerator ();
il.Emit (OpCodes.Newobj, typeof (other.MainClass).GetConstructor (Type.EmptyTypes));
il.Emit (OpCodes.Call, typeof (other.MainClass).GetMethod ("Main", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static));
il.Emit (OpCodes.Ret);
Type t = type.CreateType ();
asm.Save (asmname.Name + ".dll");
Assembly baked = Assembly.LoadFrom (Path.Combine (basedir, asmname.Name + ".dll"));
Assert.AreEqual ("internal", baked.GetType ("bar").GetMethod ("foo").Invoke (null, null), "#1");
Assert.AreEqual ("internal", t.GetMethod ("foo").Invoke (null, null), "#2");
}
}
开发者ID:mono,项目名称:gert,代码行数:26,代码来源:test.cs
示例18: CreateEventHandler
ResolveEventHandler CreateEventHandler(string assemblyPath)
{
var basePath = Path.GetDirectoryName (assemblyPath);
return (obj, args) =>
{
try
{
var assemblyFullName = new AssemblyName(args.Name);
var assemblyShortName = assemblyFullName.Name;
var location = Path.Combine(basePath, args.Name);
if (File.Exists(location + ".dll"))
{
return Assembly.LoadFile(location + ".dll");
}
if (File.Exists(location + ".exe"))
{
return Assembly.LoadFile(location + ".exe");
}
return null;
}
catch
{
return null;
}
};
}
开发者ID:benjamin-bader,项目名称:Fody,代码行数:30,代码来源:WeaverDependencyResolver.cs
示例19: CanAddAttribute
public void CanAddAttribute()
{
var type = typeof (SomeClass);
AssemblyName aName = new AssemblyName("SomeNamespace");
AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly(aName, AssemblyBuilderAccess.Run);
ModuleBuilder mb = ab.DefineDynamicModule(aName.Name);
TypeBuilder tb = mb.DefineType(type.Name, TypeAttributes.Public, type);
TypeDescriptor.AddAttributes(type);
Type[] attrCtorParams = {typeof (string)};
ConstructorInfo attrCtorInfo = typeof (DynamicAttribute).GetConstructor(attrCtorParams);
if (attrCtorInfo != null)
{
CustomAttributeBuilder attrBuilder = new CustomAttributeBuilder(attrCtorInfo, new object[] {"Some Value"});
tb.SetCustomAttribute(attrBuilder);
}
Type newType = tb.CreateType();
SomeClass instance = (SomeClass) Activator.CreateInstance(newType);
DynamicAttribute attr = (DynamicAttribute) instance.GetType().GetCustomAttributes(typeof (DynamicAttribute), false).SingleOrDefault();
Assert.AreEqual("Test", instance.Value);
Assert.IsNotNull(attr);
Assert.AreEqual(attr.Value, "Some Value");
}
开发者ID:Foxpips,项目名称:ProgrammingCSharp,代码行数:27,代码来源:DynamicAttribute.cs
示例20: Main
public static int Main()
{
try
{
AssemblyName an = new AssemblyName("noname,PublicKeyToken=null");
int expected = 0;
if (an.GetPublicKeyToken() == null)
{
Console.WriteLine("!!!ERROR-001: Public key token unexpectedly null. Expected length: " + expected.ToString());
Console.WriteLine("FAIL");
return 98;
}
if (an.GetPublicKeyToken().Length != expected)
{
Console.WriteLine("!!!ERROR-002: Public key token length not as expected. Expected: " + expected.ToString() + ", Actual: " + an.GetPublicKeyToken().Length.ToString());
Console.WriteLine("FAIL");
return 99;
}
}
catch (Exception e)
{
Console.WriteLine("!!!ERROR-XXX: Unexpected exception : " + e);
Console.WriteLine("FAIL");
return 101;
}
Console.WriteLine("Pass");
return 100;
}
开发者ID:l1183479157,项目名称:coreclr,代码行数:30,代码来源:test0792.cs
注:本文中的AssemblyName类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论