Return values to the controller in the model from the ASP.NET MVC view

When we create an ASP.NET MVC web application, the model (an object) is the easiest way to return values from the view to the controller. For the view to be able to return the values in the model, make sure the model contains properties, not fields, for every value with { get; set; } public class MyViewModel { public …

The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)

When I made changes to the web.config file of an ASP.Net C# application, I have accidentally deleted a comma, and I started to get the runtime error message: The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047) Make sure all necessary commas are there in the config files, Visual Studio does not …

Connect to a MySQL database from Visual Studio 2017

As of today weI can connect to a MySQL database, but cannot generate the Entity Data Model from a MySQL database in Visual Studio 2017 To access a MySQL database from Visual Studio 2017 IMPORTANT: First install MySQL for Visual Studio, and after that install MySQL Connector/Net. If MySQL Connector/Net is already installed on your workstation, uninstall …

Generate Entity Framework Entity Data Model in Visual Studio 2017

Visual Studio 2017 has many project type options, and not all of them support the Entity Framework user interface to generate the Entity Framework Data Model (EDMX) file. If you create an ASP.NET Web Application(.NET Framework) you can add the EDMX file to it. The .NET Core projects do not support the Entity Framework Data Model …

The .NET MVC model has to have a parameterless constructor

When you create a class to be used as the model in a .NET MVC application, the class has to have a parameterless constructor. It is called during the POST when the user clicks the submit button of the form. If the class does not have a parameterless constructor, we will get the following generic …

An error occurred while signing

When you deploy and application in Microsoft Visual Studio with ClickOnce, you need to sign the installer with a key. To sign the project Visual Studio needs to use the signtool. If the ClickOnce feature is not enabled in Visual studio, it displays the following error message: An error occurred while signing: SignTool.exe was not found …

No mapping specified for instances of the EntitySet and AssociationSet in the EntityContainer

When you move your Visual Studio solution to another workstation you may encounter the following error message: System.Data.Entity.Core.MappingException was unhandled by user code HResult=-2146232032 Message=Schema specified is not valid. Errors: : error 2062: No mapping specified for instances of the EntitySet and AssociationSet in the EntityContainer … Source=EntityFramework   In this case it may help if …

Save the key file password in Visual Studio

When you have already set up the project signing of the C# application for ClickOnce deployment, and move the solution to another workstation you may get the following error message when you build the solution: Severity Code Description Project File Line Suppression State Error Cannot import the following key file: …..pfx. The key file may …

Visual Studio 2015 is very slow on Windows 10

When I have upgraded Windows 7 my computer to Windows 10 I have also installed Visual Studio 2015 professional. From the first moment Visual Studio 2015 was very slow. My computer was freezing all the time. I have read many articles about the slowness of Visual Studio 2015, but I cold not find anything that …

NUnit in Visual Studio 2015

To use NUnit in Visual Studio 2015 Create a unit test project and download NUnit from NuGet Start Visual Studio 2015 and open or create a solution In your solution create a new class library for your unit tests Right click the unit test project and select Manage NuGet Packages Type NUnit into the search …