VS2010 build-time serialization for fast run-time loading?

124 Views Asked by At

In Visual Studio 2010 under .NET4, is there a good way to instance, populate, and binary-serialize classes as part of the build process? I am writing an application which takes several seconds to load a complex set of interrelated classes to the same "startup state" each time, and I suspect if I could load them from a serialized image, load times would virtually disappear.

My question is not about XNA, but I recently spent some time playing around with Xbox programming under the XNA Framework. The Framework adds an interesting pre-processing feature (the Content Pipeline) which does exactly what I have described: important classes from the main application can be instanced and populated (using a different block of code which is only used during build-time pre-processing), then serialized to a deployment file. This serialized version is reloaded at runtime to significantly improve initialization performance. (Under XNA this process also allows target-platform tweaks like byte-order changes which don't matter for my question.)

I realize I'd have to manually kick off deserialization, I know it wouldn't be automated to that extent -- my concern is on the build side.

Does anything like this exist for VS2010 outside the XNA Framework? This is not T4-style codegen (which still requires runtime processing, although it would probably perform better than reading an external file), and I'm not sure whether I could just write a separate project to create and dump those classes to disk then safely reload them later in a different project (some experimentation is probably called for), but even if that works, it still lacks integration with the build process. I can't just hijack the XNA Framework plugin as it has many XNA-specific ties and the load-side process is XNA only.

Note that I'm willing to consider reasonably-priced third-party plugins (I wouldn't balk at $30 or $40 for this, but I'm not buying a tool that costs hundreds of dollars).

0

There are 0 best solutions below