Dll and Exe with the same name = Problem?

Asked

Viewed 109 times

1

I had a somewhat curious problem now.

I created a project (Console Application) named Spotifyapi in Visual Studio 2017 and then downloaded the Spotify API in Nuget. When I went to run the code for the first time Visual Studio released the following exception:

System.Typeloadexception was unhandled Message: An unhandled Exception of type 'System.Typeloadexception' occurred in mscorlib.dll Additional information: Could not load type Spotifyapi.Web.Spotifywebapi from Assembly Spotifyapi, Version=1.0.0.0, Culture=neutral, Publickeytoken=null.

So I started searching the Internet and found out right here on Stack(Ask here) a Dll and an Exe cannot contain the same name.

When I checked, the API had the name Spotifyapi.dll. Exactly the same exe name (Spotifyapi.exe)

In the reply the user explains that Visual Studio has already loaded a call in Assembly to Spotify.exe, so it does not locate the dll. But I would like to understand why such a smart IDE doesn’t know that they are different files by extension. Why does this happen? I found it a little curious and would like to know a little more of this "problem".

1 answer

2


There is no problem in having the two with the same name (disregarding the extension).

Are the assemblies who may 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 change the name of a Assembly generated by a project of yours through the project properties window in Visual Studio.

inserir a descrição da imagem aqui

The name of each Assembly is an important piece of information for the .NET. platform I leave it to you to study them and find out why (and learn several more cool things along the way).

Browser other questions tagged

You are not signed in. Login or sign up in order to post.