Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Martin Rud 261 posts 1002 karma points c-trib
    May 16, 2022 @ 09:34
    Martin Rud
    0

    Error on TEST (but not on localhost) when installing Imgix client library: "The type 'Dictionary<,>' is defined..."

    Via Nuget I have installed the imgix-csharp (https://docs.imgix.com/libraries/imgix-csharp#installation) on my localhost. It works fine, for instance with this:

    @inherits Umbraco.Web.Mvc.UmbracoViewPage<Dictionary<string, object>>
    @using Imgix;
    @{
    var builder = new UrlBuilder("tinyofficewp.imgix.net")
    {
    SignKey = "xxxx",
    IncludeLibraryParam = false
    };
    var parameters = new Dictionary<String, String>();
    parameters["w"] = "400";
    parameters["h"] = "300"; @builder.BuildUrl("http://test.mydomain.dk/media/nztauqwu/myimage.jpg?&crop=0.193072264266913,0.3679576643291243,0.54677122557657687,0.37188582551436555&cropmode=percentage&width=550&height=412&quality=70&rnd=132970912634830000", parameters)
    }
    

    But when I deploy to a live environment, for instance my TEST I get this error:

    CS0012: The type 'Dictionary<,>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Collections, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
    

    I have an idea of the error since build gives warnings:

    Some NuGet packages were installed using a target framework different from the current target framework and may need to be reinstalled.
    

    And I see in packages.config that Imgix library is targeted .NET 4.6.1 and the rest of the project is targeted 4.8:

    ....
    <package id="ImageProcessor.Web.Config" version="2.5.0.100" targetFramework="net48" />
    <package id="Imgix" version="3.2.2" targetFramework="net461" />
    <package id="LightInject" version="5.4.0" targetFramework="net48" />
    ...
    

    But what must I do to fix it?

Please Sign in or register to post replies

Write your reply to:

Draft