CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 26
  1. #1
    Join Date
    Oct 2006
    Posts
    82

    Question C# Program Distribution

    After many years programming in C++, I'm considering moving to C#. However choosing an IDE may be a problem if I want to create programs that run without an IDE.

    For example, it does not look like Visual C# under .Net V2.0 allows creation of a distributable application. See the the HowTo about setting debug and release configurations. Is there another IDE/framework that would allow that? For Windows under the .NET V2.0 framework? Under Linux? or both?
    Last edited by Lou Arnold; January 11th, 2007 at 09:45 AM. Reason: correct grammer

  2. #2
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940

    Re: C# Program Distribution

    You can redistribute an executable written in C# on any machine : they have to have the appropriate version of the .NET framework installed on them though (i.e. the one which the exe was built against).

    If your exes could only be run on machines which had the Visual Studio IDE installed on them then it'd be pretty limited indeed... but this isn't the case.

    Darwen.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

  3. #3
    Join Date
    Oct 2006
    Posts
    82

    Question Re: C# Program Distribution

    Thanks, Darwen, but maybe I didn't state the context correctly. I was thinking of using Visual C# 2005 Express. The MSDN HowTo I mentioned does not apply to C# - implying that with this version of Visual C#, one cannot create a distributable application. Do you have any documentation or experience contradicting this?

  4. #4
    Join Date
    Nov 2006
    Location
    North Bend, WA
    Posts
    487

    Re: C# Program Distribution

    Could you give us info on how to find the article you are talking about (either a web link or an MSDN ms-help link)? I understood that VC# Express was limited, but I thought you could create applications that would run fine on other systems with .NET.

    I haven't installed VC# Express yet because the only reason I need it is for XNA.

  5. #5
    Join Date
    Jan 2007
    Posts
    70

    Re: C# Program Distribution

    I have recently installed VC#2005 Express too. I understand the confusion. MS uses a somewhat strange wording in the description of the "Publish" function, which led me to think that it was maybe primarily intended for programs running directly from a web site or a file share.

    However, after testing I can confirm that it is possible to redistribute programs to PCs which do not have the IDE installed. The .Net Compact Framework 2.0 is required, but the installer for your program will download and install that too, if missing.

    When using the "Publish" function, select the option to make the program installable "From a CD-ROM or DVD-ROM". After finishing the wizard, you will have a folder containing a setup.exe and a number of other files which are unfortunately necessary for the installation. No option to distribute everything in one file, it seems.

    The setup.exe contains a very basic installer. It will install the program and make a shortcut in the Start menu without asking any questions at all. (If the installer installs .Net CF 2.0 too, you will be asked to agree to the EULA, and that's it).

  6. #6
    Join Date
    Oct 2006
    Posts
    82

    Question Re: C# Program Distribution

    The URL for the article is:
    http://msdn2.microsoft.com/en-us/lib...s5(VS.80).aspx

    It is entitled "How to: Set Debug and Release Configuration". At the very start there is text and a table:
    -------------------------------------------------------------
    This topic applies to:

    Vis Studio Edition Vis Basic C# C++ J#
    Express No No Yes No
    Standard Yes Yes Yes Yes
    Pro/Team Yes Yes Yes Yes
    -------------------------------------------------------------

    I haven't yet found a reference that says a C-Sharp executable can be distributed (with or without specific DLLS). If anyone has found such info, pls let me know. And yes, one would assume that the .NET Framework is installed on the systems that the app will be installed on.
    There is some implication that a web application can be distributed, but not a Windows applications.

    Since I have the Vis C# 2005 Express, I could use it, but suggestions for other IDEs are welcome - particularly one that is hosted on both Windows and Linux. I am running Windows 2000 Pro SP4 on one system and a Fedora Core 5 on another much slower computer.

  7. #7
    Join Date
    Oct 2006
    Posts
    82

    Question Re: C# Program Distribution

    Perhaps I misunderstand all this. The Publish Wizard tries to create a web application. I don't want to create a web application. Am I using the wrong language?
    Last edited by Lou Arnold; January 12th, 2007 at 04:22 PM.

  8. #8
    Join Date
    Nov 2006
    Location
    North Bend, WA
    Posts
    487

    Re: C# Program Distribution

    All I get from the article is that it doesn't apply to C# Express, and it's only about how to switch between Debug and Release targets and change their settings. It doesn't really have anything to do with distributing an application (note that "Release" in this context just means that it doesn't contain debug code and symbols).

    The "Publish" function Allan is referring to can be found in the "Build" menu. Look for it at the bottom of the middle group.

    It sounds like Allan has already verified that you can build and distribute applications built with C# Express, but you should be able to verify that yourself if you already have VC#.

    There are C# IDEs that work on both Windows and Linux platforms, but I haven't worked with them.

  9. #9
    Join Date
    Nov 2006
    Location
    North Bend, WA
    Posts
    487

    Re: C# Program Distribution

    I ran across an article that explains why the "How To" article doesn't apply to C# Express. In C# Express, if you run a program under the IDE, it automatically runs it in Debug mode. To build the release version, you have to use Ctrl+Shift+B. Or, you can turn on the advanced IDE options as mentioned here: http://cygon.nuclex.org/2006/07/02/d...ual-c-express/

    So far, I haven't seen anything to indicate that you can't distribute C# apps built with this product.

  10. #10
    Join Date
    Nov 2006
    Location
    North Bend, WA
    Posts
    487

    Re: C# Program Distribution

    Quote Originally Posted by Lou Arnold
    Perhaps I misunderstand all this. The Publish Wizard tries to create a web application. I don't want to create a web application. Am I using the wrong language?
    Are you telling it to put the output into a directory on your filesystem? I typed in "C:\deploy\MyApplication1" into the box, and it then allowed me to choose to deploy it for CD/DVD-ROM.

    It does have the abiloty create web pages so that your users can download and install the app from the web, but you can choose to have it be just a set of files.

  11. #11
    Join Date
    Oct 2006
    Posts
    82

    Re: C# Program Distribution

    Yep, I ran a test with the Publish Wizard. Its unusual, but seems to allow saving the executable to web site, to a file share (assume some intranet common file store) or to a CD or DVD (why would one do that rather than just to a local disk folder.....anyway. I guess the wnaser is yes - you can distribute it.

  12. #12
    Join Date
    Oct 2006
    Posts
    82

    Re: C# Program Distribution

    to dcell59...
    Thanks for the article. I will review it. Its good to hear that I can distribute an application.

  13. #13
    Join Date
    Nov 2006
    Location
    North Bend, WA
    Posts
    487

    Re: C# Program Distribution

    Quote Originally Posted by Lou Arnold
    Yep, I ran a test with the Publish Wizard. Its unusual, but seems to allow saving the executable to web site, to a file share (assume some intranet common file store) or to a CD or DVD (why would one do that rather than just to a local disk folder.....anyway. I guess the wnaser is yes - you can distribute it.
    When you choose CD/DVD, it actually puts it into a local disk folder. The dialog asks "How will users install your application?" and how it builds the installer depends on these things. If your application is on a web site or file share, the application can be installed permanently or temporarily, and can be updated as needed. If it's on a CD/DVD, it doesn't need all of that.

    It's worth your while to read up on ClickOnce deployment.

  14. #14
    Join Date
    Apr 2004
    Location
    England, Europe
    Posts
    2,492

    Re: C# Program Distribution

    I recommend using InnoSetup instead, it's a very easy to use installation package generator and it's free!


    http://www.jrsoftware.org/isinfo.php
    My hobby projects:
    www.rclsoftware.org.uk

  15. #15
    Join Date
    Jan 2007
    Posts
    70

    Re: C# Program Distribution

    Quote Originally Posted by dcell59
    It's worth your while to read up on ClickOnce deployment.
    Heh, never heard of it before. But I can see now that the strange wording I referred to is very identical to the wording on the MS ClickOnce webpage:

    http://msdn2.microsoft.com/en-US/lib...z4(VS.80).aspx

    After reading that page, including the "any user can install these programs" stuff, I began to check where the program from my test was installed. I found it here:

    C:\Documents and Settings\aho\Local Settings\Apps\2.0\BXWW3V6A.728\7DZAD0E9.Y49\udpc..tion_8f0ff60a51edcbe9_0001.0000_ee967965f0442e86

    So basically, every user on the PC will have to install the program to be able to run it if it installed with the installer created by C# Express. And the random letters in the install path are different for every user. On the bright side, it seems to offer good options for automatic updates.

    I guess this is not an installer you would want for all programs. In some situations this will be better, but there is also a lot of situations where I would want my programs to be installed to a folder under c:\Program Files\ by a user with administrative right, ready to user for any other user on the PC.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured