Hi!
I’ll leave it written down in a post so I will not forget later. Let’s start with the context
- We work with a web App. For example, a Microsoft Bot App with Visual Studio
- The deployment of it is done to Azure as part of an automated process (DevOps rules!)
- Everything works perfectly
Until in a moment you find that your Web App does not work anymore. And when you try to navigate one of the controllers, a message like the following may appear
Multiple types were found that match the controller named ‘messages’. This can happen if the route that services this request (‘api/{controller}/{id}’) found multiple controllers defined with the same name but differing namespaces …
There are several reasons why this usually happens. However, one of the most popular is that you have renamed or changed some namespaces and new Dlls have been generated as part of the solution. The problem is that, by default, and as a mechanism to save processing time, the deployments only copy the assemblies that have been modified to the destination location. In this case, to an IIS folder, so a mix of files is in the bin folder.
Before continuing I have to take up the words of the great Damian Brady (@damovisa):
Friends don’t let friends right-click publish
The first time you have seen an option that allows you to clean the destination directory and then copy the compilation directory is in the Publish option of a website in Visual Studio 2017
Well, if you have configured the publication of your website as part of a Build – Releases process, it is in this last section that you will find the option [Remove additional files at destination], which will eliminate the unnecessary Assemblies of your solution.
Happy Coding!
Greetings @ Toronto
El Bruno
Wow, awesome weblog structure! How long have you been running a blog for? you make running a blog glance easy. The total glance of your web site is excellent, as smartly as the content!
LikeLike