Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Writing USB Drive Portable Applications in C#

One of my favorite things about owning a USB flash storage device is hauling around a bunch of useful tools with me. I'd like to write some tools, and make them work well in this kind of environment. I know C# best, and I'm productive in it, so I could get a windows forms application up in no time that way.

But what considerations should I account for in making a portable app? A few I can think of, but don't know answers to:

1) Language portability - Ok, I know that any machine I use it on will require a .NET runtime be installed. But as I only use a few windows machines regularly, this shouldn't be a problem. I could use another language to code it, but then I lose out on productivity especially in regards to an easy forms designer. Are there any other problems with running a .NET app from a flash drive?

2) Read/Write Cycles - In C#, how do I make sure that my application isn't writing unnecessarily to the drive? Do I always have control of writes, or are there any "hidden writes" that I need to account for?

3) Open question: are there any other issues relating to portable applications I should be aware of, or perhaps suggestions to other languages with good IDEs that would get me a similar level of productivity but better portability?

like image 226
CodexArcanum Avatar asked Apr 22 '09 16:04

CodexArcanum


2 Answers

  • 1) There shouldn't be any problems running a .NET app from a flash drive.
  • 2) You should have control of most writes. Be sure you write to temp or some other location on the hard drive, and not on the flash drive. But write-cycles shouldn't be a problem - even with moderate to heavy usage most flashdrives have a life time of years.
  • 3) Just treat it like's it any app that has xcopy style deployment and try to account for your app gracefully failing if some dependency is not on the box.
like image 195
Michael Avatar answered Nov 09 '22 21:11

Michael


If you want to use com objects, use reg-free com and include the com objects with your program.

like image 27
Brian Avatar answered Nov 09 '22 22:11

Brian