Sunday, December 16, 2007

AppDomain CreateInstanceAndUnwrap w/ Visual Studio 2008

I recently converted a project form Visual Studio 2005 to Visual Studio 2008 RTM. I am using AppDomain.CurrentDomain.CreateInstanceAndUnwrap to dynamically create an instance similar to the following

string assembly = "Test.dll";
string type = "Test.MyClass";
MyClass obj = AppDomain.CurrentDomain.CreateInstanceAndUnwrap(assembly, type) as MyClass;

This worked fine in 2005 but gets an exception in 2008 - "could not load file or assembly or one of it's dependancies". Looking at the fusion log, which is now in the exception info window in Studio (very nice), I could see that it was looking for Test.dll.dll, Test.dll.exe. So, the extension is being appended to the end of the assembly name. After removing ".dll" from the name of the assembly, the code works fine.

Tuesday, December 11, 2007

.Net Framework 3.5 Redist...200MB!!!!

I went to download the .net framework 3.5 redist package and it is basically 200mb...wow!!! That is rather large compared to the other versions of the framework. I usually avoid the smaller setup bootstrapper since I don't want to wait for it when I am installing the framework on a server. But, what about deploying client apps? One client has a windows app and they are not going to want to include a 200mb redist with their package.

After reading a couple of forum posts, using the boostrapper looks to be the way to go. Using this, you should be able to download just the components that you need. Here are the links...

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2437304&SiteID=1

http://http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2451232&SiteID=1


You can download both versions of the setup here
http://www.microsoft.com/downloads/details.aspx?FamilyId=333325FD-AE52-4E35-B531-508D977D32A6&displaylang=en