appsetting.json assembly references not used

3 posts, 1 answers
  1. Ross
    Ross avatar
    9 posts
    Member since:
    Jul 2011

    Posted 23 Apr Link to this post

    Hi

    I am attempting to get trdp files to generate a pdf in a .net core application using ObjectDataSource.

    in my appsettings I have the following code to reference my dll.

    "telerikReporting": {
       "assemblyReferences": [
         {
           "name": "Goalie.Shared",
           "version": "1.0.0.0",
           "culture": "neutral",
           "publicKeyToken": "null"
         }
       ]
     }

     

    running the report results in error The assembly "EXTERNAL_ASSEMBLY_TYPE" is not permitted to be used by an ObjectDataSource component. Please include it in an AssemblyReferences element in the Telerik.Reporting configuration section of your application configuration file.

     

    But when I put in a app.config as suggested https://www.telerik.com/forums/reporting-asp-net-core-rest-service-configuration#f0fajfr44E6tvOjTRMr33g

     

    <?xml version ="1.0"?>
    <configuration>
      <configSections>
        <section
                    name="Telerik.Reporting"
                    type="Telerik.Reporting.Configuration.ReportingConfigurationSection, Telerik.Reporting"
                    allowLocation="true"
                    allowDefinition="Everywhere"/>
      </configSections>
      <Telerik.Reporting>
        <AssemblyReferences>
          <add name="Goalie.Shared" version="1.0.0.0" />
        </AssemblyReferences>
      </Telerik.Reporting>
    </configuration>

     

    everything works fine. 

     

    Should we still need this step? What are the requirements so that the telerikReporting section of the appsettings.json are read? I have made sure all of the dlls are installed as specified here https://docs.telerik.com/reporting/use-reports-in-net-core-apps

    Its not a big deal but seems un-nessesary. Any ideas?

     

  2. Answer
    Silviya
    Admin
    Silviya avatar
    354 posts

    Posted 25 Apr Link to this post

    Hi Ross,

    .NET Core applications provide new way of storing the configuration - a key-value JSON-based file named appsettings.json. To activate JSON file configuration, call the AddJsonFile extension method on an instance of ConfigurationBuilder. How to activate the appsettings.json as a config file of the project is elaborated in Manual Setup of HTML5 Report Viewer in an ASP.NET Core 2+ application - Connection Strings and Engine Configuration.

    Then use the already created ConfigurationService as a parameter for the ReportsController constructor to obtain the configuration information and to access the WebRootPath of the application.

    Additionally, Telerik Reporting ships with a ready-made ASP.NET Core example that demonstrates how to show the sample reports in an ASP.NET Core application. The example also shows how to inject an appsettings.json configuration file to the controller and how to initialize a WebHostBuilder so it runs under Windows and Linux.

    The example can be found in the \Examples\CSharp\Asp.NetCoreDemo sub-folder of the Telerik Reporting installation directory.

    Activating JSON-based configuration would prevent the necessity of using the app.config file.

    Regards,
    Silviya
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Ross
    Ross avatar
    9 posts
    Member since:
    Jul 2011

    Posted 25 Apr in reply to Silviya Link to this post

    Hi Silvia

    Activating JSON-based configuration did the trick, my startup method now looks like this and works great,

    public Startup(IHostingEnvironment env, IConfiguration config)
    {
        _config = config;
        var configurationBuilder = new ConfigurationBuilder()
            .SetBasePath(env.ContentRootPath)
            .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
            .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
     
        configurationBuilder.AddEnvironmentVariables();
        Configuration = configurationBuilder.Build();
    }

     

    Thanks Again

    Ross

Back to Top