<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4988410123339387098</id><updated>2011-04-21T10:59:43.302-07:00</updated><category term='C#'/><category term='C++/CLI'/><category term='Microsoft'/><category term='.NET'/><title type='text'>C hacker</title><subtitle type='html'>I am a Software/Firmware Engineer working for a Fortune 500 company. This blog is just a place for me to rant about coding and maybe occasionally provide a tip or two. I spend most of my time with C and C++ but I will also occasionally use C# and Python.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://c-hacker.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4988410123339387098/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://c-hacker.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Tabor</name><uri>http://www.blogger.com/profile/00920811734791007613</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>1</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4988410123339387098.post-124444536324078721</id><published>2008-03-14T15:57:00.000-07:00</published><updated>2008-07-29T14:35:51.003-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C++/CLI'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Microsoft'/><title type='text'>Microsoft has replaced DLL hell with .NET hell</title><content type='html'>I usually don't blog, but I though I should publish my experiences somewhere in hopes that they might help someone some day with .NET hell.&lt;br /&gt;&lt;br /&gt;Earlier today, I released a rapid prototyping tool to the members of my team. It worked fine on my machine, but as soon as I released it I was getting bug reports back. For the purposes of this post we can refer to the tool as &lt;i&gt;some_csharp.exe&lt;/i&gt;. When you executed &lt;i&gt;some_csharp.exe&lt;/i&gt; you would get the following output:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;C:\some_path&gt;some_csharp.exe&lt;br /&gt;&lt;br /&gt;Unhandled Exception: System.IO.FileLoadException: Could not load file or assembl&lt;br /&gt;y 'CSWrapper, Version=1.0.2938.18330, Culture=neutral, PublicKeyToken=null' or o&lt;br /&gt;ne of its dependencies. This application has failed to start because the applica&lt;br /&gt;tion configuration is incorrect. Reinstalling the application may fix this probl&lt;br /&gt;em. (Exception from HRESULT: 0x800736B1)&lt;br /&gt;File name: 'CSWrapper, Version=1.0.2938.18330, Culture=neutral, PublicKeyToken=n&lt;br /&gt;ull' ---&gt; System.Runtime.InteropServices.COMException (0x800736B1): This applica&lt;br /&gt;tion has failed to start because the application configuration is incorrect. Rei&lt;br /&gt;nstalling the application may fix this problem. (Exception from HRESULT: 0x80073&lt;br /&gt;6B1)&lt;br /&gt;  at SOME.SOME.Main(String[] args)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;So, obviously it looks like .NET is having trouble finding &lt;i&gt;CSWrapper.dll&lt;/i&gt;, so the first thing you do is get a directory listing. For the record, &lt;i&gt;CSWrapper.dll&lt;/i&gt; is written in C++/CLI.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;C:\some_path&gt;dir&lt;br /&gt;&lt;br /&gt;[stuff omitted]&lt;br /&gt;&lt;br /&gt;01/24/2008  11:30 AM            56,832 CSWrapper.dll&lt;br /&gt;03/14/2008  03:35 PM            20,480 some_csharp.exe&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;C:\some_path&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;That's funny, &lt;i&gt;some_csharp.exe&lt;/i&gt; can't find &lt;i&gt;CSWrapper.dll&lt;/i&gt; even though it is in the right place. So I had to take a second look at the error message. "Could not load file or assembly 'CSWrapper, Version=1.0.2938.18330, Culture=neutral, PublicKeyToken=null' &lt;b&gt;or one of its dependencies&lt;/b&gt;."&lt;br /&gt;&lt;br /&gt;Now, this is your first clue that .NET is crap. It has its fancy, managed, JIT compiled CLI and it can't even tell me which DLL it it missing? Even a simple C app could tell me which LoadLibrary() call failed. So now I am stuck trying to figure out on my own which library .NET couldn't find.&lt;br /&gt;&lt;br /&gt;Now, you would think that it would be &lt;b&gt;easy&lt;/b&gt; to figure out your program's requirements in Visual Studio 2005, right? &lt;b&gt;Wrong!&lt;/b&gt; I mean, Visual Studio (and .NET) are supposed to make your life easier, right? Shouldn't it be easy to get a list of my DLL's requirements? Even ILDasm was no help. It gives you some information about the manifest, but it didn't give me the information I needed. Thankfully, the copy of &lt;i&gt;CSWrapper.dll.intermediate.manifest&lt;/i&gt; in the bin/Debug directory of the CSWrapper project does tell you exactly what it is looking for. The pertinent part is as follows:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;assemblyIdentity type='win32' name='Microsoft.VC80.DebugCRT'&lt;br /&gt;version='8.0.50727.762' processorArchitecture='x86'&lt;br /&gt;publicKeyToken='1fc8b3b9a1e18e3b' /&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;So, I think I have the problem nailed down. My DLL needs version 8.0.50727.762 of the Microsoft CRT but the version that shipped with .NET 2.0 is only 8.0.50727.40. 8.0.50727.762 is the version that shipped with Visual Studio 2005 SP1. Thankfully, it is available as a redistributable package from Microsoft &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=200b2fd9-ae1a-4a14-984d-389c36f85647&amp;amp;displaylang=en"&gt;here&lt;/a&gt;. I am sure that this will fix the problem, but, no beans.&lt;br /&gt;&lt;br /&gt;I finally figure out that the publicly distributed version linked to above &lt;b&gt;does not&lt;/b&gt; contain Microsoft.VC80.DebugCRT. It contains Microsoft.VC80. That's right folks, you can't run the debug version of this DLL unless you have Visual Studio 2005 SP1 installed (which is why it worked on my system).&lt;br /&gt;&lt;br /&gt;So, I take a version of the DLL built in release mode and now my program works on the system with version 8.0.50727.762 of the CRT. However, this time I distribute the release version of the DLL with its very own copy of the CRT (it can be found in C:\Program&amp;nbsp;Files\Microsoft&amp;nbsp;Visual&amp;nbsp;Studio&amp;nbsp;8\VC\redist\x86\Microsoft.VC80.CRT).  Just to be explicit, my install package now looks like this:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;CSWrapper.dll&lt;br /&gt;some_csharp.exe&lt;br /&gt;Microsoft.VC80.CRT\Microsoft.VC80.CRT.manifest&lt;br /&gt;Microsoft.VC80.CRT\msvcm80.dll&lt;br /&gt;Microsoft.VC80.CRT\msvcp80.dll&lt;br /&gt;Microsoft.VC80.CRT\msvcr80.dll&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now my users don't have to grab the 8.0.50727.762 version of the CRT because it is already installed. The down side of this is that if Microsoft ever releases a patch for the CRT, my DLL will still be using the version it shipped with.&lt;br /&gt;&lt;br /&gt;I really like the C# language (even though I think Java is a better solution most of the time because it is actually cross-platform), but I am really starting to hate .NET.&lt;br /&gt;&lt;br /&gt;Reference: &lt;a href="http://www.news.com/2100-1012-991466.html"&gt;Microsoft promises end to 'DLL hell'&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4988410123339387098-124444536324078721?l=c-hacker.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://c-hacker.blogspot.com/feeds/124444536324078721/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4988410123339387098&amp;postID=124444536324078721' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4988410123339387098/posts/default/124444536324078721'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4988410123339387098/posts/default/124444536324078721'/><link rel='alternate' type='text/html' href='http://c-hacker.blogspot.com/2008/03/microsoft-has-replaced-dll-hell-with.html' title='Microsoft has replaced DLL hell with .NET hell'/><author><name>Tabor</name><uri>http://www.blogger.com/profile/00920811734791007613</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
