本文整理汇总了C#中AssemblyInfo类的典型用法代码示例。如果您正苦于以下问题:C# AssemblyInfo类的具体用法?C# AssemblyInfo怎么用?C# AssemblyInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AssemblyInfo类属于命名空间,在下文中一共展示了AssemblyInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: IsAssemblyInGAC
public static bool IsAssemblyInGAC(string assemblyName)
{
var assembyInfo = new AssemblyInfo { cchBuf = 512 };
assembyInfo.currentAssemblyPath = new string('\0', assembyInfo.cchBuf);
IAssemblyCache assemblyCache;
var hr = CreateAssemblyCache(out assemblyCache, 0);
if (hr == IntPtr.Zero)
{
hr = assemblyCache.QueryAssemblyInfo(
1,
assemblyName,
ref assembyInfo);
if (hr != IntPtr.Zero)
{
return false;
}
return true;
}
Marshal.ThrowExceptionForHR(hr.ToInt32());
return false;
}
开发者ID:Ullink,项目名称:NugetConverter,代码行数:27,代码来源:GacUtil.cs
示例2: LoadAssemblyFrom
/// <summary>
/// Registers the specified assembly and resolves the types in it when the AppDomain requests for it.
/// </summary>
/// <param name="assemblyFilePath">The path to the assemly to load in the LoadFrom context.</param>
/// <remarks>This method does not load the assembly immediately, but lazily until someone requests a <see cref="Type"/>
/// declared in the assembly.</remarks>
public void LoadAssemblyFrom(string assemblyFilePath)
{
if (!this.handlesAssemblyResolve)
{
AppDomain.CurrentDomain.AssemblyResolve += this.CurrentDomain_AssemblyResolve;
this.handlesAssemblyResolve = true;
}
Uri assemblyUri = GetFileUri(assemblyFilePath);
if (assemblyUri == null)
{
throw new ArgumentException(Resources.InvalidArgumentAssemblyUri, "assemblyFilePath");
}
if (!File.Exists(assemblyUri.LocalPath))
{
throw new FileNotFoundException();
}
AssemblyName assemblyName = AssemblyName.GetAssemblyName(assemblyUri.LocalPath);
AssemblyInfo assemblyInfo = this.registeredAssemblies.FirstOrDefault(a => assemblyName == a.AssemblyName);
if (assemblyInfo != null)
{
return;
}
assemblyInfo = new AssemblyInfo() { AssemblyName = assemblyName, AssemblyUri = assemblyUri };
this.registeredAssemblies.Add(assemblyInfo);
}
开发者ID:CarlosVV,项目名称:mediavf,代码行数:37,代码来源:AssemblyResolver.Desktop.cs
示例3: AddAssemblyToList
private void AddAssemblyToList(AssemblyInfo info)
{
if (info != null && info.IsManagedAssembly)
{
listViewAssemblies.Items.Add(CreateListViewItem(info));
}
}
开发者ID:rharrisxtheta,项目名称:StrongNameSigner,代码行数:7,代码来源:MainForm.cs
示例4: Render
private void Render(XmlWriter reportBuilder, AssemblyInfo assemblyInfo, IEnumerable<ContextInfo> contexts)
{
reportBuilder.WriteStartElement("testsuite");
reportBuilder.WriteAttributeString("name", assemblyInfo.Name);
// gather statistics
var specsInThisAssembly = contexts.SelectMany(x => SpecificationsByContext[x]);
var specsByResult = specsInThisAssembly.GroupBy(x => ResultsBySpecification[x].Status)
.ToDictionary(x => x.Key, x => x.Count());
reportBuilder.WriteAttributeString("test", specsInThisAssembly.Count().ToString());
reportBuilder.WriteAttributeString("failures", specsByResult.ContainsKey(Status.Failing) ? specsByResult[Status.Failing].ToString() : "0");
reportBuilder.WriteAttributeString("skipped",
((specsByResult.ContainsKey(Status.Ignored) ? specsByResult[Status.Ignored] : 0) +
(specsByResult.ContainsKey(Status.NotImplemented) ? specsByResult[Status.NotImplemented] : 0)).ToString());
foreach (var entry in contexts.GroupBy(x => x.Concern))
{
RenderTestsForConcern(reportBuilder, entry.Key, entry);
}
reportBuilder.WriteEndElement();
}
开发者ID:aloker,项目名称:machine.specifications,代码行数:25,代码来源:JUnitReportGenerator.cs
示例5: LoadAssemblyFrom
/// <summary>
/// Registers the specified assembly and resolves the types in it when the AppDomain requests for it.
/// </summary>
/// <param name="assemblyFilePath">The path to the assemly to load in the LoadFrom context.</param>
/// <remarks>This method does not load the assembly immediately, but lazily until someone requests a <see cref="Type"/>
/// declared in the assembly.</remarks>
public async void LoadAssemblyFrom(string assemblyFilePath)
{
//if (!this.handlesAssemblyResolve)
//{
// AppDomain.CurrentDomain.AssemblyResolve += this.CurrentDomain_AssemblyResolve;
// this.handlesAssemblyResolve = true;
//}
Uri assemblyUri = GetFileUri(assemblyFilePath);
if (assemblyUri == null)
{
throw new ArgumentException(ResourceHelper.InvalidArgumentAssemblyUri, "assemblyFilePath");
}
StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(new Uri(assemblyUri.AbsoluteUri));
AssemblyName assemblyName = new AssemblyName { Name = file.DisplayName };
if (this.loadedAssemblies.Any(a => assemblyName == a.AssemblyName))
{
return;
}
var assembly = Assembly.Load(assemblyName);
var assemblyInfo = new AssemblyInfo() { AssemblyName = assemblyName, AssemblyUri = assemblyUri, Assembly = assembly };
this.loadedAssemblies.Add(assemblyInfo);
}
开发者ID:xperiandri,项目名称:PortablePrism,代码行数:33,代码来源:AssemblyResolver.Desktop.cs
示例6: RunTestAsync
public async Task<TestResult> RunTestAsync(AssemblyInfo assemblyInfo, CancellationToken cancellationToken)
{
var contentFile = _contentUtil.GetTestResultContentFile(assemblyInfo);
var assemblyPath = assemblyInfo.AssemblyPath;
var builder = new StringBuilder();
builder.AppendLine($"{Path.GetFileName(assemblyPath)} - {contentFile.Checksum}");
builder.AppendLine("===");
builder.AppendLine(contentFile.Content);
builder.AppendLine("===");
Logger.Log(builder.ToString());
try
{
var cachedTestResult = await _dataStorage.TryGetCachedTestResult(contentFile.Checksum);
if (cachedTestResult.HasValue)
{
Logger.Log($"{Path.GetFileName(assemblyPath)} - cache hit");
return Migrate(assemblyInfo, cachedTestResult.Value);
}
}
catch (Exception ex)
{
Logger.Log($"Error reading cache {ex}");
}
Logger.Log($"{Path.GetFileName(assemblyPath)} - running");
var testResult = await _testExecutor.RunTestAsync(assemblyInfo, cancellationToken);
await CacheTestResult(contentFile, testResult).ConfigureAwait(true);
return testResult;
}
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:30,代码来源:CachingTestExecutor.cs
示例7: GetVersion
public static string GetVersion(AssemblyInfo info)
{
Assembly assembly = Assembly.GetExecutingAssembly();
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
try
{
switch (info)
{
case AssemblyInfo.Title:
return fvi.ProductName;
case AssemblyInfo.Version:
int major = fvi.FileMajorPart;
int minor = fvi.FileMinorPart;
int rev = fvi.FileBuildPart;
string version =
major.ToString(CultureInfo.InvariantCulture) + "." +
minor.ToString(CultureInfo.InvariantCulture) + "." +
rev.ToString(CultureInfo.InvariantCulture);
return version;
case AssemblyInfo.Company:
return fvi.CompanyName;
}
}
catch (Exception)
{
return null;
}
return null;
}
开发者ID:extofer,项目名称:milo-portscanner,代码行数:32,代码来源:Services.cs
示例8: BuildTestResultContent
private string BuildTestResultContent(AssemblyInfo assemblyInfo)
{
var builder = new StringBuilder();
var assemblyPath = assemblyInfo.AssemblyPath;
builder.AppendLine($"Assembly: {Path.GetFileName(assemblyPath)} {GetFileChecksum(assemblyPath)}");
builder.AppendLine($"Display Name: {assemblyInfo.DisplayName}");
builder.AppendLine($"Results File Name; {assemblyInfo.ResultsFileName}");
var configFilePath = $"{assemblyPath}.config";
var configFileChecksum = File.Exists(configFilePath)
? GetFileChecksum(configFilePath)
: "<no config file>";
builder.AppendLine($"Config: {Path.GetFileName(configFilePath)} {configFileChecksum}");
builder.AppendLine($"Xunit: {Path.GetFileName(_options.XunitPath)} {GetFileChecksum(_options.XunitPath)}");
AppendReferences(builder, assemblyPath);
builder.AppendLine("Options:");
builder.AppendLine($"\t{nameof(_options.Test64)} - {_options.Test64}");
builder.AppendLine($"\t{nameof(_options.UseHtml)} - {_options.UseHtml}");
builder.AppendLine($"\t{nameof(_options.Trait)} - {_options.Trait}");
builder.AppendLine($"\t{nameof(_options.NoTrait)} - {_options.NoTrait}");
builder.AppendLine($"Extra Options: {assemblyInfo.ExtraArguments}");
return builder.ToString();
}
开发者ID:vcsjones,项目名称:roslyn,代码行数:25,代码来源:ContentUtil.cs
示例9: AssemblyInfoExecute
public void AssemblyInfoExecute()
{
AssemblyInfo task = new AssemblyInfo();
task.BuildEngine = new MockBuild();
task.CodeLanguage = "cs";
string outputFile = Path.Combine(testDirectory, "AssemblyInfo.cs");
task.OutputFile = outputFile;
task.AssemblyTitle = "AssemblyInfoTask";
task.AssemblyDescription = "AssemblyInfo Description";
task.AssemblyConfiguration = "";
task.AssemblyCompany = "Company Name, LLC";
task.AssemblyProduct = "AssemblyInfoTask";
task.AssemblyCopyright = "Copyright (c) Company Name, LLC 2005";
task.AssemblyTrademark = "";
task.ComVisible = false;
task.CLSCompliant = true;
task.Guid = "d038566a-1937-478a-b5c5-b79c4afb253d";
task.AssemblyVersion = "1.2.3.4";
task.AssemblyFileVersion = "1.2.3.4";
task.AssemblyInformationalVersion = "1.2.3.4";
task.AssemblyKeyFile = @"..\MSBuild.Community.Tasks\MSBuild.Community.Tasks.snk";
Assert.IsTrue(task.Execute(), "Execute Failed");
Assert.IsTrue(File.Exists(outputFile), "File missing: " + outputFile);
}
开发者ID:464884492,项目名称:msbuildtasks,代码行数:25,代码来源:AssemblyInfoTest.cs
示例10: CreateListViewItem
private static ListViewItem CreateListViewItem(AssemblyInfo info)
{
var item = new ListViewItem(new string[]
{
Path.GetFileName(info.FilePath),
info.DotNetVersion,
(info.IsAnyCpu ? "Any CPU" : info.Is32BitOnly ? "x86" : info.Is64BitOnly ? "x64" : "UNKNOWN") + (info.Is32BitPreferred ? " (x86 preferred)" : string.Empty),
info.IsSigned ? "Yes" : "No",
info.FilePath
});
item.Tag = info.FilePath;
item.UseItemStyleForSubItems = false;
// Update the color of the signed column.
if (info.IsSigned)
{
item.SubItems[3].ForeColor = Color.Green;
}
else
{
item.SubItems[3].ForeColor = Color.Red;
}
return item;
}
开发者ID:rharrisxtheta,项目名称:StrongNameSigner,代码行数:26,代码来源:MainForm.cs
示例11: FrmAbout
public FrmAbout()
{
InitializeComponent();
var ai = new AssemblyInfo();
this.Text = String.Format( "О {0}", ai.AssemblyTitle );
this.txt_vesion_null.Text = String.Format( "{0}", ai.AssemblyVersion );
this.txt_cr.Text = ai.AssemblyCopyright;
}
开发者ID:EpicMorg,项目名称:EMHP,代码行数:8,代码来源:FrmAbout.cs
示例12: CreateTestCacheData
private static TestCacheData CreateTestCacheData(AssemblyInfo assemblyInfo, string resultsFileName, CachedTestResult testResult)
{
return new TestCacheData()
{
TestResultData = CreateTestResultData(resultsFileName, testResult),
TestSourceData = CreateTestSourceData(assemblyInfo)
};
}
开发者ID:XieShuquan,项目名称:roslyn,代码行数:8,代码来源:WebDataStorage.cs
示例13: OnAssemblyStart
public override void OnAssemblyStart(AssemblyInfo assembly)
{
_originalDirectory = Directory.GetCurrentDirectory();
if (assembly.Location != null)
{
Directory.SetCurrentDirectory(Path.GetDirectoryName(assembly.Location));
}
}
开发者ID:machine,项目名称:machine.specifications,代码行数:8,代码来源:AssemblyLocationAwareListener.cs
示例14: LoadFrom
public IAssemblyInfo LoadFrom(string assemblyName)
{
Assembly assembly = Assembly.LoadFrom(assemblyName);
IAssemblyInfo assemblyInfo = new AssemblyInfo();
assemblyInfo.Name = assembly.FullName;
assemblyInfo.Types = LoadTypes(assembly);
return assemblyInfo;
}
开发者ID:noronha1978,项目名称:Introspectator,代码行数:8,代码来源:AssemblyLoader.cs
示例15: Shell
static Shell()
{
Input = Console.In;
Output = Console.Out;
Error = new ErrorConsoleWriter(Console.Error);
CommandsResolver = Infrastucture.CommandsResolver.Default;
HelpBuilder = HelpBuilder.Default;
AssemblyInfo = new AssemblyInfo(Assembly.GetEntryAssembly() ?? Assembly.GetExecutingAssembly());
}
开发者ID:satejnik,项目名称:commandshell,代码行数:9,代码来源:Shell.cs
示例16: GetAssemblyTime
public long GetAssemblyTime(AssemblyInfo assemblyInfo)
{
if (_assemblyTimes.ContainsKey(assemblyInfo))
{
return _assemblyTimes[assemblyInfo];
}
return -1;
}
开发者ID:jcbozonier,项目名称:machine.specifications,代码行数:9,代码来源:TimingRunListener.cs
示例17: About
public About()
{
InitializeComponent();
AssemblyInfo entryAssemblyInfo = new AssemblyInfo(System.Reflection.Assembly.GetEntryAssembly());
Titletb.Text = entryAssemblyInfo.ProductTitleAndVersion;
Descriptiontb.Text = entryAssemblyInfo.Description;
Copyrightb.Text = entryAssemblyInfo.Copyright;
}
开发者ID:CoffeeNova,项目名称:ventenergy,代码行数:9,代码来源:About.xaml.cs
示例18: AssemblyInfo_GetCurrentAssemblyInfo_InformationsIsCorrect
public void AssemblyInfo_GetCurrentAssemblyInfo_InformationsIsCorrect()
{
var assemblyInfo = new AssemblyInfo(Assembly.GetAssembly((typeof(AssemblyInfoTests))));
Assert.AreEqual("Alexander Krylkov", assemblyInfo.CompanyName);
Assert.AreEqual("Licensed under LGPL", assemblyInfo.Copyright);
Assert.AreEqual("Simplify.Core unit tests", assemblyInfo.Description);
Assert.AreEqual("Simplify", assemblyInfo.ProductName);
Assert.AreEqual("Simplify.Core.Tests", assemblyInfo.Title);
Assert.AreEqual("1.0.0.0", assemblyInfo.Version.ToString());
}
开发者ID:nora1879,项目名称:Simplify,代码行数:11,代码来源:AssemblyInfoTests.cs
示例19: Initialize
public void Initialize()
{
var info = new AssemblyInfo();
AboutDescriptionLabel.Text = info.Description;
AboutProductLabel.Text = info.Title;
var changeLog = ClassLibrary.Helper.FindResource<string>("ChangeLog.txt");
ChangeLogTextBox.Text = changeLog;
var license = ClassLibrary.Helper.FindResource<string>("License.txt");
LicenseTextBox.Text = license;
LicenseTabPage.Text = string.Format("{0} {1} License", Application.ProductName, new Version(Application.ProductVersion).ToString(2));
}
开发者ID:JocysCom,项目名称:PassGen,代码行数:11,代码来源:AboutControl.cs
示例20: OnAssemblyStart
public override void OnAssemblyStart(AssemblyInfo assembly)
{
var asm = Assembly.LoadFrom(assembly.Location);
var assemblyContexts = _explorer.FindAssemblyContextsIn(asm);
assemblyContexts.Each(assemblyContext =>
{
assemblyContext.OnAssemblyStart();
_executedAssemblyContexts.Add(assemblyContext);
});
}
开发者ID:yonglehou,项目名称:machine.specifications,代码行数:11,代码来源:AssemblyContextRunListener.cs
注:本文中的AssemblyInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论