Dll and Exe with the same name = Problem?

1

I had a rather curious problem now.

I created a project (Console Application) named SpotifyApi in Visual Studio 2017 and soon after I downloaded the Spotify API in NuGet. When I first ran the code Visual Studio threw the following exception:

  

System.TypeLoadException was unhandled   Message: An unhandled exception of type 'System.TypeLoadException' occurred in mscorlib.dll   Additional information: Could not load the SpotifyAPI.Web.SpotifyWebAPI assembly type SpotifyAPI, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = null.

So I started searching the Internet and found out right here in the Stack ( Ask here ) that a Dll and an Exe can not contain the same name.

When I went to check, the API was named SpotifyApi.dll . Exactly the same name as the exe (SpotifyApi.exe)

In response the user explains that Visual Studio has already loaded a call into the Assembly for Spotify.exe, so it does not locate the DLL. But I would like to understand why such an intelligent IDE does not know that they are different files by extension. Why does this occur? I found it somewhat curious and I would like to know a little more about this "problem".

    
asked by anonymous 13.07.2017 / 21:44

1 answer

2

It's okay to have both of them with the same name (disregarding the extension).

They are assemblies that can not have the same name.

The .dll and .exe files are not the assemblies themselves, they are containers for them. You can get these names by reflection. You can also rename an assembly generated by your project through the project properties window in Visual Studio.

The name of each assembly is important information for the .NET platform. I leave it to you to study them and find out why (and learn lots of cool things on the way).

    
13.07.2017 / 22:10