罗斯林分析仪如何区分项目中的程序集和 nuget 包中的程序集

问题描述

例如我有 2 个项目。 ConsoleApplication 和 ClientLibrary。其中 ConsoleApplication 指的是 ClientLibrary。我如何确定 ConsoleApplication 包含对 ClientLibrary 的准确引用。

var callItemAssembly = context.SemanticModel.GetSymbolInfo(invocation).Symbol?.ContainingAssembly;
if (callItemAssembly == null)
  return;

var currentAssemblyIdentity = context.Compilation.Assembly.Identity;
if (callItemAssembly.Identity == currentAssemblyIdentity)
  return;
        
foreach (var currentMetadataReference in context.Compilation.References)
{
  // Is the link a project?          
}

地点:

  1. context = SyntaxNodeAnalysisContext (https://docs.microsoft.com/en-us/dotnet/api/microsoft.codeanalysis.diagnostics.syntaxnodeanalysiscontext?view=roslyn-dotnet-3.9.0)
  2. invocation = InvocationExpressionSyntax (https://docs.microsoft.com/en-us/dotnet/api/microsoft.codeanalysis.visualbasic.syntax.invocationexpressionsyntax?view=roslyn-dotnet-3.9.0)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)