Cannot add Controller to asp.net Core MVC Project because of error: The specified runtimeconfig.json does not exist

1k views Asked by At

I am trying to learn about the MVC structure of Asp.NET core MVC. Therefore, I am trying to build a small web app similar to the ecommerce system 'simplcommerce' whose code is open source.

My Solution is split into three parts: 1. Modules 2. Infrastructure 3. WebHost

In the Modules part, I have five different Modules (e.g. Contacts, Core) which have their own Controllers, Models, ViewModels and Views.

Now I am trying to add a new Controller into the Contacts Module. I have already added two Controllers earlier, which was no problem at all. But after having changed lots of things (like adding and deleting dependencies, adding Models and Views, etc.) I receive the following error-message when trying to add a new Controller:

"There was an error running the selected code generator: 'The specified runtimeconfig.json [C:...\TestApplication\TestAppplication.Module.Contacts\bin\Debug\netcoreapp2.0\TestApplication.Module.Contacts.runtimeconfig.json] does not exist. "

I have checked the folder from the error message and there is no TestApplication.Module.Contacts.runtimeconfig.json.

But I have also checked the same folder in the original SimplCommerce solution, which I have copied parts from, and there is no such file either.

Where is the file from the error message specified? And what can I do to solve this problem?

Thank you very much in advance!

1

There are 1 answers

3
Vladimir On

This file is automatically generated by Visual Studio when you build the project. Interesting thins is that when I removed this file and added new Controller to my test project, this file appeared although I haven't built the solution. The issue looks like your project cannot be compiled.

Make sure that the project does not have any compile-time errors and try to rebuild it before you add the Controller.