Speaking of file name inspired me to write another post about assembly name.
Windows supports long file path since Win95 time. It has a MAX_PATH limit, which is defined as 260.
Prior to .Net era, you seldom see long file name. If you poke around your system32 directory, you probably won't notice any thing longer than 10 charater(excluding extenstion). Guess people are slowly migrating from DOS 8.3 era. MAX_PATH is really a luxury.
This is suddenly changed in .Net era. If you installed .Net framework redist, you have System.Runtime.Serialization.Formatters.Soap.dll. If you installed Visual Studio, you have Microsoft.VisualStudioAnalyzer.PrimaryEventCollector.dll.
And I have seen longer. 6 or 7 dots, with more than 10 charaters between dots.
Now suddenly MAX_PATH is not looking good.
I certainly don't like short name. But don't these very long names go too far?
Neverthless, Let's do some simple caculation to see what is the longest assembly name that can fit in GAC.
As of today, stuff lives in GAC have the following format(Subject to change in the future):%windir%\assembly\GAC\<assembly name>\<version>_<culture>_<public key token>\<assembly name>.dll
Assume %windir%=C:\Windows, and <version> = 1.0.5000.0, <culture>=””, now all the non assembly name parts have a total of 59 character(Don't forget a null terminator). So maximum assembly name length is (MAX_PATH - 59) / 2 = 100 character.
Of course, if your version is longer than 1.0.5000.0, your limit is smaller.And smaller if you have a culture.And smaller if you want your assembly to be NGENed.