简体   繁体   English

NSB ScriptBuilderTask 无法解析自己的程序集 nuget package

[英]NSB ScriptBuilderTask cannot resolve assembly of own nuget package

We have a microservice architecture and share some code between our services using a nuget package called "HC.Framework".我们有一个微服务架构,并使用名为“HC.Framework”的 nuget package 在我们的服务之间共享一些代码。

When i try to build a solution that is using this nuget package (that has all the configs for NSB and stuff) i get the following exception:当我尝试构建一个使用此 nuget package(具有 NSB 和东西的所有配置)的解决方案时,出现以下异常:

1>MSBUILD : error : SqlPersistenceTask: An unhandled exception occurred:
1>MSBUILD : error : Exception:
1>MSBUILD : error : Failed to resolve assembly: 'HC.Framework, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
1>MSBUILD : error : StackTrace:
1>MSBUILD : error :    at Mono.Cecil.BaseAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
1>MSBUILD : error :    at Mono.Cecil.DefaultAssemblyResolver.Resolve(AssemblyNameReference name)
1>MSBUILD : error :    at Mono.Cecil.MetadataResolver.Resolve(TypeReference type)
1>MSBUILD : error :    at Mono.Cecil.TypeReference.Resolve()
1>MSBUILD : error :    at CecilExtensions.FindInTypeHierarchy[T](TypeDefinition type, Func`2 search)
1>MSBUILD : error :    at SagaDefinitionReader.TryGetCoreSagaDefinition(TypeDefinition type, SagaDefinition& definition)
1>MSBUILD : error :    at AllSagaDefinitionReader.GetSagas(Action`2 logger)
1>MSBUILD : error :    at SagaWriter.WriteScripts(BuildSqlDialect dialect)
1>MSBUILD : error :    at ScriptGenerator.Generate()
1>MSBUILD : error :    at InnerTask.Execute()
1>MSBUILD : error :    at NServiceBus.Persistence.Sql.SqlPersistenceScriptBuilderTask.Execute()
1>MSBUILD : error : Source:
1>MSBUILD : error : NServiceBus.Persistence.Sql.ScriptBuilderTask
1>MSBUILD : error :

I'm not sure what the issue is here?我不确定这里有什么问题? Below is a snippet of a saga class:下面是一个传奇 class 的片段:

using System.Threading.Tasks;
using NServiceBus;
using HC.Swatson.Processor.Saga.Command;
using HC.Framework.NSB;
using HC.Swatson.Application.Command;
using HC.Integration.ReplyMessages.Sendgrid;

namespace HC.Swatson.Processor.Saga
{
    public class SendWrongPredictionEmailSD : BaseSagaData<SendWrongPredictionEmailCMD>
    {
        public SendWrongPredictionEmailSD() : base(totalSteps: 2) { }
    }

    public class SendWrongPredictionEmailSAGA :
        Saga<SendWrongPredictionEmailSD>,
        IAmStartedByMessages<SendWrongPredictionEmailCMD>,
        IHandleMessages<ReplyMessage<SendWrongPredictionEmail2CMD>>,
        IHandleMessages<EmailHasBeenSentRM>
    {
...

We also specify the following configuration in the HC.Framework package:我们还在 HC.Framework package 中指定如下配置:

[assembly: SqlPersistenceSettings(
    MsSqlServerScripts = true,
    MySqlScripts = false,
    OracleScripts = false,
    PostgreSqlScripts = false,
    ProduceOutboxScripts = true,
    ProduceSagaScripts = true,
    ProduceSubscriptionScripts = true,
    ProduceTimeoutScripts = true
    )]

The only maybe helpfull info i can think of is that we are upgrading from .net5 to 6, this might be related?我能想到的唯一可能有用的信息是我们正在从 .net5 升级到 6,这可能是相关的?

Any ideas on why this might ocure is welcome!欢迎任何关于为什么会发生这种情况的想法!

Just install NServiceBus in your project where you want to use it只需在您要使用它的项目中安装 NServiceBus

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM