|
-
Dec 26th, 2006, 08:48 PM
#1
Thread Starter
Lively Member
[2005] Serialization and different namespaces
Hi All,
I am trying to perform some simple BINARY serialization for my first time and am having a problem I thought would be easy to solve.
I serialize a simple object to a file on disk, this object is for testing only and contains 2 string member variables - simple.
I can serialize the object just fine but want to de-serialize into a DIFFERENT PROJECT and hence different namespace. When I try to de-serialize the object it get a System.Runtime.Serialization.SerializationException:
Message="Unable to find assembly 'HollyTerm, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'."
How do solve this?
Thanks,
Matt.
Last edited by GottaGetITDone; Dec 26th, 2006 at 09:42 PM.
Reason: Overlooked important details...
-
Dec 26th, 2006, 09:12 PM
#2
Re: [2005] Serialization and different namespaces
How are you serializing/deserializing the object? Should just create a .obj file with the associated XML data. Then this can be loaded into any project that has that type defined, provided that you give it the right location to the file. Does your second project have that same type defined?
-
Dec 26th, 2006, 09:31 PM
#3
Thread Starter
Lively Member
Re: [2005] Serialization and different namespaces
Hey Gige!
I am not implementing the ISerializable interface, I am letting .NET do the work for me with a BinaryFormatter.
Yes the second project has the class added to it so that it can be instantiated from the file on disk.
I am not familiar with the .obj file you speak of...
Thanks,
Matt.
-
Dec 26th, 2006, 09:35 PM
#4
Re: [2005] Serialization and different namespaces
hmm well I havent ever messed with binary serialization... I was just referring to using the Xml.Serialization.XmlSerializer class to serialize and deserialize using a streamreader...
-
Dec 26th, 2006, 09:41 PM
#5
Thread Starter
Lively Member
Re: [2005] Serialization and different namespaces
Cool cool gige, thanks for the attempt...
Maybe I should have told everyone I was dealing with binary serialization...
-
Dec 26th, 2006, 09:45 PM
#6
Re: [2005] Serialization and different namespaces
Is this for remoting? because the whole idea of remoting is to protect against what you are trying to do...
-
Dec 26th, 2006, 09:51 PM
#7
Thread Starter
Lively Member
Re: [2005] Serialization and different namespaces
Dude, that is exactly the question that I just asked in another post...
I dunno if its for remoting, I'm starting to think it is but am having a little trouble getting off the ground, I hadn't heard of remoting until a few hours ago so I'm a little lost.
Check this out:
http://www.vbforums.com/showthread.php?t=444639
-
Dec 27th, 2006, 12:36 AM
#8
Thread Starter
Lively Member
Re: [2005] Serialization and different namespaces
OK here is the answer (to the original question)...obvious really, still, it didn't occur to my dim mind.
Create the object in its own solution and compile it to an assembly, include this assembly in both projects and boom, you can serialize and deserialize that object in any namespace.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|