Search code examples
asp.netprofileasp.net-profilesbinary-serialization

ASP.NET Custom Profile Object Fails After Changing to MSBuild Deployment


We have an ASP.NET 2.0 web forms app that used to be deployed via a web deployment project. Recently we deployed a new version built by TFS/MSBuild and the change seems to have caused a problem with the deserialization of a custom profile object.

Here is the entry in our profile/properties section in web.config.

<add name="MyKey" type="OurApp.UserData" serializeAs="Binary" />

This did not change as a result of the build process, nor did OurApp.UserData change.

However, when the app attempts to read the data for a given user, nothing is found.

One obvious difference is that in the web deployment version, a single OurApp.dll was created for the web site, whereas the new version is composed of multiple, "name-mangled" assemblies. Could that cause the profile to miss reading the properties stored in the OurApp.UserData type?


Solution

  • The answer did in fact turn out to be the assembly names. After adding a aspnet_merge step to the build process and generating an assembly of the old name, all was well.

    Presumedly this indicates that the profile serialization routines embed the fully-qualified class name into the binary data representing object.