« DevTeach Comes to Toronto | Main | AdventureWorks 2008 Examples--Not So Easy to Install »

CLR Executables Fail to Deploy

After having installed Visual Studio SP1 and SQL Server 2008, I wanted to make sure my existing CLR demos worked. I have a number of unique examples (that are included in my latest book) that illustrate basic to complex functions, stored procedures, aggregates and user-defined types--all implemented in CLR (Visual Basic.NET) languages.

So, I attached my existing Biblio example database to the new SQL Server 2008 instance and pulled up an existing (and working) example in Visual Studio 2008 (SP1). Since I wanted to be able to use step-through debugging, I switched to the X86 configuration (this is a 64-bit system and the Framework does not support 64-bit STD). This was my downfall. Once I clicked on F5 to compile, deploy and debug the example, it failed with:

An error occurred in the Microsoft .NET Framework while trying to load assembly id 65737. The server may be running out of resources, or the assembly may not be trusted with PERMISSION_SET = EXTERNAL_ACCESS or UNSAFE. Run the query again, or check documentation to see how to solve the assembly trust issues. For more information about this error:
System.IO.FileLoadException: Could not load file or assembly 'prjtablefromdelimitedlist, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
Sure, I checked Google and found a MS article on the issue--or it said it was. Unfortunately it did not help. I tried the other suggestions. I then created a new test database and tried to deploy the CLR function there. It worked. What was different? Well, in the second case, I had left the configuration on "Any CPU".

I filed a Connect bug. If you think this is an issue, vote for it. https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=361684

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)