Microsoft Knowledge Base Email Alertz

KBAlertz.com: The Visual Studio Designer does not Respect Assembly Binding Redirection

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]

Search KbAlertz

Advanced Search

Webmasters
Put kbAlertz on your website.
[ Click Here for more! ]





ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
KBAlertz referrals get
** SIX MONTHS FREE **


Community Site



We Send hundreds of thousands of emails using ASP.NET Email


ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
KBAlertz referrals get
** SIX MONTHS FREE **




Mentioned In








Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks




Article ID: 955600 - Last Review: July 11, 2008 - Revision: 1.1

The Visual Studio Designer does not Respect Assembly Binding Redirection

Source: Microsoft Support

RAPID PUBLISHING

RAPID PUBLISHING ARTICLES PROVIDE INFORMATION DIRECTLY FROM WITHIN THE MICROSOFT SUPPORT ORGANIZATION. THE INFORMATION CONTAINED HEREIN IS CREATED IN RESPONSE TO EMERGING OR UNIQUE TOPICS, OR IS INTENDED SUPPLEMENT OTHER KNOWLEDGE BASE INFORMATION.

Action



So we recently came across an issue where Visual Studio 2005 and 2008 Designers were not respecting assembly binding redirection.



Example

We have a file which is now version 2 and stored in the GAC (http://msdn2.microsoft.com/en-us/library/yf1d93sz.aspx) .  So the assembly version is 2.0.0.0.  We have some existing customers using version 1 so we want to be able to use Assembly Binding Redirection (http://msdn2.microsoft.com/en-us/library/2fc472t2.aspx) to point them to the new version of the assembly.

For more information on configuring this, check out Configuring Assembly Binding Redirection (http://msdn2.microsoft.com/en-us/library/433ysdt1.aspx) .

The web page has code like:

<tc:TestContacts ID="QuickContacts1" runat="server">
    <tc:AContact Name="Test Tester"
        Email="test@test.com (mailto:test@test.com) "
        Phone="(999) 555-1212" />
    <tc:AContact Email="no@spam.thx (mailto:no@spam.thx) "
        Name="Mr. A. Nonymous"
        Phone="(999) 555-1234" />
</tc:TestContacts>

We also have a Register Assembly line at the top that points to the 1.0.0.0 version of the file.  And we have an entry in our web.config that looks like this:

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="Tester1" publicKeyToken="6ace53ab3256c766"/>
            <bindingRedirect oldVersion="1.0.0.0-1.1.0.0"
                             newVersion="2.0.0.0"/>
        </dependentAssembly>
    </assemblyBinding>
</runtime>

We could have done this in a policy file and got the same results.  So now we open this file in Design view inside Visual Studio and change a property of the TestContacts control.  For instance, adding an AccessKey.  Switching back to the Source view, we will now see:

<tc:TestContacts ID="QuickContacts1" runat="server">
    <samples.aspnet.cs.controls.acontact Name="Test Tester"
        Email="test@test.com (mailto:test@test.com) "
        Phone="(999) 555-1212" />
    <samples.aspnet.cs.controls.acontact Email="no@spam.thx (mailto:no@spam.thx) "
        Name="Mr. A. Nonymous"
        Phone="(999) 555-1234" />
</tc:TestContacts>

Result



This breaks the site and it no longer works.

Note: Assembly Binding Redirection works find in other scenarios, it just doesn’t work right inside the Designer.

Cause

Bug in the Designer

Resolution



This is fixed in Visual Studio 2008 Server pack 1



Other work arounds for Visual Studio 2005
  • Don’t use Assembly Binding Redirection at all and just leave the 1.0.0.0 version of the file in the GAC.  You will see a lot of .NET files do this, there are versions for .NET 1.0, 1.1, 2.0, etc all inside the GAC at the same time.
  • Change the existing files so that the Register Assembly line at the top of the web page points to the 2.0.0.0 version of the file.


Keep in mind that this is only a problem if you are actively changing the older files already, if you don’t touch the file it will be fine since this issue is only with the Designer.  So since you are already updating the file, it is trivial to update this line also.

More Information



Global Assembly Cache

http://msdn.microsoft.com/en-us/library/yf1d93sz.aspx (http://msdn.microsoft.com/en-us/library/yf1d93sz.aspx)



Assembly Binding Redirection

http://msdn.microsoft.com/en-us/library/2fc472t2.aspx (http://msdn.microsoft.com/en-us/library/2fc472t2.aspx)
Configuring Assembly Binding Redirection
http://msdn.microsoft.com/en-us/library/433ysdt1.aspx (http://msdn.microsoft.com/en-us/library/433ysdt1.aspx)

DISCLAIMER

MICROSOFT AND/OR ITS SUPPLIERS MAKE NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY, RELIABILITY OR ACCURACY OF THE INFORMATION CONTAINED IN THE DOCUMENTS AND RELATED GRAPHICS PUBLISHED ON THIS WEBSITE (THE “MATERIALS”) FOR ANY PURPOSE. THE MATERIALS MAY INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS AND MAY BE REVISED AT ANY TIME WITHOUT NOTICE.

TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, MICROSOFT AND/OR ITS SUPPLIERS DISCLAIM AND EXCLUDE ALL REPRESENTATIONS, WARRANTIES, AND CONDITIONS WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO REPRESENTATIONS, WARRANTIES, OR CONDITIONS OF TITLE, NON INFRINGEMENT, SATISFACTORY CONDITION OR QUALITY, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THE MATERIALS.

APPLIES TO
  • Microsoft Visual Studio 2005 Standard Edition
  • Microsoft Visual Studio 2008 Standard Edition
Keywords: 
kbnomt kbrapidpub KB955600
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate

Be the first to leave feedback, to help others about this knowledge base article.

(Optional) Name

(Optional) Public URL Or Email

Comments
No HTML -- Text Only Please