Results 1 to 21 of 21

Thread: Run on older .net

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2020
    Posts
    11

    Run on older .net

    I'm writing a utility that can be run directly from a thumb drive, without installation. I want it to run on any computer. The trouble is, some computers have older versions of .net installed. If I try to run my application, I get an error message. How can I make it compatible with older versions?

    It needs to be run from a thumb drive immediately without installing anything on the other computer. I don't have the authority or the time to change what's on them.

  2. #2
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,582

    Re: Run on older .net

    When you set up the project you should choose to target the 4.0 framework (I wouldn't support anything older than that).
    All the later 4.x.y frameworks should support 4.0, so should run the code.
    "Anyone can do any amount of work, provided it isn't the work he is supposed to be doing at that moment" Robert Benchley, 1930

  3. #3
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,196

    Re: Run on older .net

    I know there are several VB 2010 programs of mine that target 3.5 still running. Some of my 2010 programs even targeted 2.0. I'm retire so they wont be getting updated.

  4. #4

    Thread Starter
    New Member
    Join Date
    Jan 2020
    Posts
    11

    Re: Run on older .net

    Quote Originally Posted by passel View Post
    When you set up the project you should choose to target the 4.0 framework.
    How do I do that?

    (I wouldn't support anything older than that).
    I would. It needs to run on older machines, which have older versions of .Net installed.

    All the later 4.x.y frameworks should support 4.0, so should run the code.
    But the target machine might not have 4.0, and in fact frequently doesn't.

  5. #5
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: Run on older .net

    Project-->Properties-->Compile-->Target CPU

  6. #6
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,582

    Re: Run on older .net

    Not Target CPU , but Target Framework.
    And its under the "Advance Compile Options" of the compile page.
    Of course the location may depend on the version of Visual Studio you're using.

    But, perhaps you should also change Target CPU to x86 as well. Simpler to hardcode 32-bit rather than have the executable choose.

    And you can target older frame works, but I figured 4.0 would cover any OS back to Windows 7. If you need to go back to XP, then by all means choose 3.x or 2.x if you must.
    "Anyone can do any amount of work, provided it isn't the work he is supposed to be doing at that moment" Robert Benchley, 1930

  7. #7
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: Run on older .net

    Quote Originally Posted by passel View Post
    Not Target CPU , but Target Framework.
    Ooops. My mistake. Target Framework it is.

  8. #8

    Thread Starter
    New Member
    Join Date
    Jan 2020
    Posts
    11

    Re: Run on older .net

    Quote Originally Posted by passel View Post
    Not Target CPU , but Target Framework.
    And its under the "Advance Compile Options" of the compile page.
    That worked, thank you.

  9. #9
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: Run on older .net

    Quote Originally Posted by passel View Post
    And you can target older frame works, but I figured 4.0 would cover any OS back to Windows 7. If you need to go back to XP, then by all means choose 3.x or 2.x if you must.
    The 4.0 Framework goes back to WinXP, which covers any PC made 2002 and newer.
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  10. #10

    Thread Starter
    New Member
    Join Date
    Jan 2020
    Posts
    11

    Re: Run on older .net

    Actually, it doesn't seem to be working after all.

    I'm getting an error message saying that it needs .Net 3.5, this from a machine with windows 10 installed, and .net 4.5 or later included.

  11. #11
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,582

    Re: Run on older .net

    Correct.
    Machines from Win7 on should have some version of 4.X framework installed, so something written to 4.0 should run on all of them.
    For WinXP, you would want to target 3.5 or earlier, unless someone installed a 4.x framework on the earlier OS.
    Likewise, for later OS's, e.g. Win10, if you want a 3.X framework to run, someone would have had to install or enabled it at some point, it doesn't necessarily come pre-installed as part of the OS, i.e. it is included as part of the OS distribution, but not installed by default.

    Refer to Microsoft .Net Framework versions and dependencies
    In addition, if your app targets version 2.0, 3.0, or 3.5, your users may be required to enable the .NET Framework 3.5 on a Windows 8, Windows 8.1, or Windows 10 computer before they can run your app.
    I get the impression from the documentation, that the 3.5 Framework may be provided as part of the later OSs (7, 8, 8.1, 10), but not be enabled by default. You may have to enable or install the provided Framework.
    Last edited by passel; Jan 19th, 2020 at 11:04 PM.
    "Anyone can do any amount of work, provided it isn't the work he is supposed to be doing at that moment" Robert Benchley, 1930

  12. #12

    Thread Starter
    New Member
    Join Date
    Jan 2020
    Posts
    11

    Re: Run on older .net

    As I said, I can't enable or install the framework.

    It has to run on a bunch of different machines that I don't own, and only have brief access to. And it has to run from a thumb drive without installing. I don't have the authority or the time to install or change anything on the machines.

  13. #13
    PowerPoster PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Pontypool, Wales
    Posts
    2,458

    Re: Run on older .net

    Quote Originally Posted by Ron Miel 2 View Post
    As I said, I can't enable or install the framework.

    It has to run on a bunch of different machines that I don't own, and only have brief access to. And it has to run from a thumb drive without installing. I don't have the authority or the time to install or change anything on the machines.
    The problem then becomes you have no way of knowing if any of the machines have a particular version of the framework installed or not, even though various versions of windows ship with .Net it is an optional component and people may have not installed it.

  14. #14
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,929

    Re: Run on older .net

    It seems that your best option may be to write it for 3.5 (to support older computers), then compile two versions of it each time (3.5 and 4.0).

    That will take a little extra work each time you release it, and you will have two executables with most computers only being able to only run one or the other, but you should be able to run at least one of them without having to install anything.

  15. #15
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: Run on older .net

    The biggest issue I'm seeing with his posts is he's got too wide of a range of machine and framework versions to support.
    Really what it comes down to is there are 2 categories going on here, the Win98 to WinXP machines which are very likely to have the 2.0 Framework installed, but anything newer than WinXP is not likely to have the 2.0 Framework installed/enabled for Win 8/8.1/10 it's disabled by default but is likely to have the 4.0 Framework installed (is enabled by default too) but the 4.0 Framework only works for WinXP and newer.

    The way I see it he's got to have 2 versions of his program on the flash drive: one is compiled for the 2.0 Framework to be used on older than WinXP computers and the other version targets the 4.0 Framework which he can use on the WinXP & newer computers.
    By targeting those 2 frameworks you get the widest possible range of computers with .Net installed, of course WinXP (and especially older) did not ship with any .Net Frameworks installed so neither of the programs will run until you install .Net.
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  16. #16
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,582

    Re: Run on older .net

    Just write the utility in VB5, include the vb5 runtimes on the stick, and no installation necessary on any OS.
    "Anyone can do any amount of work, provided it isn't the work he is supposed to be doing at that moment" Robert Benchley, 1930

  17. #17
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: Run on older .net

    @passel

    VB5???

  18. #18
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,235

    Re: Run on older .net

    Ok, vb6.

  19. #19
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: Run on older .net

    Yeah... You can just include vbrun600.dll on your memory stick... Much easier, but horses for courses. VB.Net is generally better

  20. #20
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,582

    Re: Run on older .net

    I haven't done either, but perhaps I thought of VB5 because I was remembering code development, not code execution.
    I think some preferred VB5 over VB6 because you could do VB5 development off of a stick without having to install the development environment, whereas VB6 required installing on the local machine.

    I guess there was a hacked version of VB6 that allowed developing without installation, but that was definitely illegal, whereas vb5 didn't need a hack.
    Again, I've never bothered with any of this (although I did keep VB3 on a stick for simple on the go code generation utility for awhile, i.e. as a convenience to generate small one bits of code to test one thing or another or process a data file, etc... until it wasn't supported by the OS's any longer). Never actually tried VB5 for that purpose.

    I was being a bit "tongue in cheek", because of the "challenges" of a universal .Net, especially for old machines. If you need to support old machines, then perhaps an old compiler would fit the bill.

    Of course, if the utility takes advantage of things in .Net that would be more difficult to realize in VB6, then that is its own issue.
    Last edited by passel; Jan 21st, 2020 at 02:25 PM.
    "Anyone can do any amount of work, provided it isn't the work he is supposed to be doing at that moment" Robert Benchley, 1930

  21. #21
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: Run on older .net

    20 comments later and I just now realized we've all been focusing on what Framework(s) he should target to get the maximum probability of his program being able to run on end machines, but we don't even know what "utility" his app even does, maybe it's a utility app that doesn't need to be a compiled and a Windows Command (cmd) script is all that's needed.
    Quote Originally Posted by Ron Miel 2 View Post
    I'm writing a utility that can be run directly from a thumb drive, without installation.
    What is it that your app does?
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

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