Repository navigation
Open
Description
Hi, I'm attempting to consume ADAPT and a plugin published by the Climate Corp for ADAPT but I'm having issues with my imports. Per the readme I'm attempting to run ADAPT with just the .NET core b/c I'm on a Mac. I have the dotnet CLI installed:
$ dotnet --version
2.2.207I have a route which consumes the an ADAPT plugin and also pulls in ADAPT itself:
using ClimateADAPT;
using AgGateway.ADAPT.PluginManager;
using AgGateway.ADAPT.ApplicationDataModel.ADM;
using AgGateway.ADAPT.ApplicationDataModel.Common;
using AgGateway.ADAPT.ApplicationDataModel.Products;
using AgGateway.ADAPT.ApplicationDataModel.Logistics;
using AgGateway.ADAPT.ApplicationDataModel.Equipment;
using AgGateway.ADAPT.ApplicationDataModel.LoggedData;
using AgGateway.ADAPT.ApplicationDataModel.Representations;
namespace adapt_converter.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class ClimateController : ControllerBase
{
// GET api/climate
[HttpGet]
public ActionResult<IEnumerable<string>> Get()
{
IPlugin ClimatePlugin = new ClimateADAPT.ClimateADAPTPlugin();
return new string[] { "test 1", "test 2" };
}
// ...But when I run my project and hit a route which tries to init the plugin, it fails with the following exception. Is it possible the DLL I pulled from the zip (on the releases page here) was not compiled to target just .NET core? Do I have to manually compile ADAPT from source and target only .NET core and use that DLL?
System.IO.FileLoadException: Could not load file or assembly 'AgGateway.ADAPT.ApplicationDataModel, Version=2.0.4.0, Culture=neutral, PublicKeyToken=null'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'AgGateway.ADAPT.ApplicationDataModel, Version=2.0.4.0, Culture=neutral, PublicKeyToken=null'
at adapt_converter.Controllers.ClimateController.Get()
at lambda_method(Closure , Object , Object[] )
at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters)
at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()
at Microsoft.AspNetCore.Routing.EndpointMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
my .csproj file looks like this (and the project has dlls in the lib directory for each one of these):
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<RootNamespace>adapt_converter</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<Reference Include="AgGateway.ADAPT.ApplicationDataModel">
<SpecificVersion>False</SpecificVersion>
<HintPath>lib\AgGateway.ADAPT.ApplicationDataModel.dll</HintPath>
</Reference>
<Reference Include="AgGateway.ADAPT.PluginManager">
<SpecificVersion>False</SpecificVersion>
<HintPath>lib\AgGateway.ADAPT.PluginManager.dll</HintPath>
</Reference>
<Reference Include="AgGateway.ADAPT.Representation">
<SpecificVersion>False</SpecificVersion>
<HintPath>lib\AgGateway.ADAPT.Representation.dll</HintPath>
</Reference>
<Reference Include="ClimateADAPT">
<HintPath>lib\ClimateADAPT.dll</HintPath>
</Reference>Metadata
Metadata
Assignees
Labels
No labels
Activity
JasonRoesbeke commentedon Jun 8, 2020
Hi @glenselle
I think this issue is more related to referencing the correct library.
You could look/search on stackoverflow:
Quick search: The located assembly's manifest definition does not match the assembly reference
Also check which ADAPT framework version your plugin references to, you may need to have an older version referenced to it.
Note that you could also get the Nuget package of the ADAPT framework for different versions.
glenselle commentedon Jun 18, 2020
@JasonRoesbeke Hi Jason, thanks for your reply. Quick question on the README. When it says: