5

I created a simple calculator in C# for work. It's just one executable file. I was thinking of putting a single copy of it on a network drive and send everyone a shortcut to it to access it. I'm new to this kind of thing, so is this a bad idea?

With it in one place I can easily update it when needed.

It's a very small application; around 33k. The maximum number of users will be around 50.

3
  • 4
    should be fine until someone replaces it with a malicious exe
    – hunter
    Nov 4, 2010 at 13:36
  • @wayne - I read through the answers and comments and it looks to me that your application is a useful business related custom calculator that is only used by internal users. As such I think it may be better delivered as a small Asp.net web app rather than an explicit program - especially as you said users are not allowed to install new programs
    – Peter M
    Nov 4, 2010 at 14:56
  • Thanks for everyone's comments. They all helped open my eyes to certain pitfalls and problems. Cheers guys.
    – Wayne
    Nov 5, 2010 at 13:02

4 Answers 4

7

I would go for ClickOnce. Basically you right click on your project in visual studio and choose publish.

You get a simple web-based installer, a start menu shortcut on your clients and an autoupdate feature.

4
  • The trouble is I am developing this at home. The PCs I work with do not have VB installed, and the users are not allowed to install new porgrams.
    – Wayne
    Nov 4, 2010 at 14:15
  • @Wayne, You can create the install package at home and copy to the network share at work. Even quite restricted users are allowed to install ClickOnce applications. You should really try. If they can not install the app anyway you can configure ClickOnce to use "Online" mode. Then the application is always run from the network and no shortcut will be installed.
    – Albin Sunnanbo
    Nov 4, 2010 at 16:12
  • 1
    @Wayne, by the way, in my opinion business applications should be developed at work during work time with at least source control and backup in place, sanctioned by your boss. This makes the application the responsibility of your company, not you and might save both you and your company some trouble in the future.
    – Albin Sunnanbo
    Nov 4, 2010 at 16:18
  • Thanks for your comments. I will give this a go. I don't actually work in development. Im just trying to get my name noticed there by developing a simple program. I have gone through the correct procedure in work, so I can't do anything until they approve it. But I appreciate the advice.
    – Wayne
    Nov 5, 2010 at 0:01
4

There are a few issues you might run into:

  • Security setting for users might prevent them from running executables on a network drive
  • If there are any user-specific settings stored in the config file this won't work as each user will need their own copy of the file
  • Any network problems are going to mean your users can't access the application

Personally, I prefer users to have a copy on their own hard drive. It's a bit more maintenance but you can always do something like write a batch file to allow them to easily copy any program updates from the network to their computer.

1
  • ...and just to add another issue: moderately savvy users will copy your exe locally, and then complain about not getting the update! See Albin's answer: ClickOnce to a network share should fulfil your requirements nicely. Nov 4, 2010 at 13:40
2

Prior to .NET 3.5 SP1 applications that are run from a network location run in a Partial Trust environment. This affects what the application can do.

http://msdn.microsoft.com/en-us/library/ms364059%28VS.80%29.aspx

Most developers get a rather rude first introduction to partial trust when they accidentally run their projects from a network share as opposed to their local drive. Because default policy grants restricted permissions to code that's not on the local drive, suddenly things that used to work in the program start throwing security exceptions. Actions that are obviously security related, such as calls to File.Open, now throw SecurityExceptions. But many things that don't appear to have any security sensitivity also begin throwing that same exception, such as the PropertyGrid control in a Windows Forms application. The newsgroups abound with these problems.

So whether or not this is ok in your situation depends on the framework version installed on the client and what your application actually needs to do.

2
  • 1
    This isn't true as of 3.5SP1. blogs.msdn.com/b/shawnfa/archive/2008/05/12/…
    – Robert Jeppesen
    Nov 4, 2010 at 13:51
  • @Robert Jeppesen, thanks for the link. I updated my answer; I hadn't heard about this change. It's good news.
    – Sam
    Nov 4, 2010 at 14:54
1

If it is a simple calculator, then it is completely safe to do so.

But if you do file, registry or network operations (basically, any external interaction) you should check the other answers.

4
  • Basically it does simple +-*/ and works out some custom percetages that we use frequently. It also has a dropdown menu with some weblinks. That's all it does.
    – Wayne
    Nov 4, 2010 at 13:59
  • there is a config text file with some values in. I was thinking about an absolute link to the location of this file on the network. Would multiple instances of the calculator trying to read this config file on start cause a problem?
    – Wayne
    Nov 4, 2010 at 14:12
  • No problems, if all you do is read. To keep the network free, you might want to parse the contents of the file in memory.
    – Vercas
    Nov 4, 2010 at 21:03
  • If you want INI-file structure and you need a parser, ask me! I have made a fully working INI class a few months ago.
    – Vercas
    Nov 4, 2010 at 21:08

You must log in to answer this question.