PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
[RESOLVED] How to get programs built with VS2012 to run stand alone-VBForums
Results 1 to 10 of 10

Thread: [RESOLVED] How to get programs built with VS2012 to run stand alone

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2020
    Posts
    9

    Resolved [RESOLVED] How to get programs built with VS2012 to run stand alone

    Hello;

    I experiment with creating programs with Visual Studio 2012 Express.

    I want to create executable's that will run on other computers. Originally I thought that because
    I could take the executable from the Release folder and place it in the folder I want to run it from
    (another issue) and run it without any problems that everything is OK. Then, I got another computer
    and transferred Visual Studio 2012 Express to it.

    I quickly learned that the programs I left on the first computer (this one) wouldn't even start
    without VS2012 installed.

    I guess I should also explain that I created my programs with some data files.
    Currently I have the files that I need to read AND write to in a folder in MY DOCUMENTS\MY SOFTWARE then in a separate folder for each program.
    The files that I ONLY need to read from are in PROGRAM FILES\MY SOFTWARE. and again an
    individual folder for the program.

    Just now, I used the PUBLISH wizard to publish one of the programs I created.
    I noticed that you DON"T get a chance to tell the publish wizard where you want the finished
    program to be placed. You don't even get a chance to include files you create necessary for it to run,
    then where to put them.

    I also want to know how best to build my programs: 32 bit, 64 bit, or any cpu?

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    22,941

    Re: How to get programs built with VS2012 to run stand alone

    Your compiled programs need the .Net Framework installed on the computer you want to run them on.
    You need to look at proper setup apps, instead of the clickonce installer. You'll have more flexibility.
    The CPU you compile for depends on the features you want to use and the OS you want to run your apps in. AnyCPU is the most versatile...

  3. #3
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    104,121

    Re: How to get programs built with VS2012 to run stand alone

    Maybe stick to asking one question per thread. If you have multiple questions, start multiple threads. That way, the conversation in each one will be coherent and consistent.

    The programs you create in VS 2012 will run fine on other machines. Even trying to install VS on other machines is silly because it should be obvious that that's not something that other users have to do. You just have to ensure that everything your app needs is present on the other machine and that your app looks for it in the right place. You really ought to have done some research on how to do that before now.

    If you used the Publish wizard in VS then you're using ClickOnce deployment. ClickOnce offers some useful features, e.g. automated updates, but in order to do that the apps are installed in the ClickOnce cache. This is generally not a big deal. To say that you NEED to read files from the Program Files folder is just wrong. What you need to do is read files from the program folder, wherever that may be. If it's under Program Files, so be it. If it's under the ClickOnce cache, so what?

    If you want files in the program folder then you should be adding them to your project in the Solution Explorer. If you want a subfolder, add that in the Solution Explorer and add the file to it there. You then set Build Action to Content and Copy to Output Directory to Copy if Newer. That file will then be copied to your output folder, both Debug and Release, and it should also be automatically included in the publish. You can confirm what files are published on the Publish page of the project properties.

    In order to access files in the program folder, assuming a WinForms app, you use the Application.StartupPath property, e.g.
    vb.net Code:
    1. Dim filePath = Path.Combine(Application.StartupPath, "File.ext")
    If the file is in a subfolder, incorporate that in the path:
    vb.net Code:
    1. Dim filePath = Path.Combine(Application.StartupPath, "Subfolder\File.ext")
    If you need to access files under the user's Documents folder, use a standard path for that too, e.g.
    vb.net Code:
    1. Dim filePath = Path.Combine(My.Computer.FileSystem.SpecialDirectories.MyDocuments, "Subfolder\File.ext")
    All of this will work whether you use ClickOnce, Windows Installer, manual copy or some other deployment technology.

    One thing that you cannot do, as far as I'm aware, is have ClickOnce place files under the Documents folder as part of the deployment. You can detect the first run and place the files there then but, if you'd rather do it as part of the deployment, ClickOnce is out. There is an extension for VS that allows you to create an old-style Setup project that creates a Windows Installer package. That will allow you to put files in the Documents folder at installation. That extension has not always been available though, so I'm not sure whether it was available for VS 2012. It is almost certainly not available for an Express edition regardless. If you were to install a Community edition then you would get more features (pretty much Pro but free) and extension support. You could also use a newer version than 2012.

    By the way, I forgot to mention the fact that this thread was posted in the wrong forum to start with. This forum is for VB.NET-specific questions. There is another forum dedicated to questions on Application Deployment. That's where this should have been posted and that's where I've asked the mods to move it.

  4. #4
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    22,941

    Re: How to get programs built with VS2012 to run stand alone

    Quote Originally Posted by jmcilhinney View Post
    I'm not sure whether it was available for VS 2012.
    It's available in VS2012 Pro, but it was developed by a third party company and i think you can still find it on the www

  5. #5
    Superbly Moderated NeedSomeAnswers's Avatar
    Join Date
    Jun 2002
    Location
    Manchester uk
    Posts
    2,604

    Re: How to get programs built with VS2012 to run stand alone

    I experiment with creating programs with Visual Studio 2012 Express.
    STOP right there, and uninstall VS 2012 Express. There is really no excuse for using such an old version of VS when you can get the newer community editions for free, also in the community editions you can add the Setup project (Microsoft Visual Studio Installer Project) back in as an extension which you can use to create setup packages for you !!!

    Both VS 2017 & VS 2019 allow you to do this !

    I guess I should also explain that I created my programs with some data files.
    Currently I have the files that I need to read AND write to in a folder in MY DOCUMENTS\MY SOFTWARE then in a separate folder for each program.
    You should be putting any files you need under the folder ProgramData\YourSoftware, then using the Setup program you can include the contents of that folder and when run it will install it alongside your app on the PC.

    I also want to know how best to build my programs: 32 bit, 64 bit, or any cpu?
    Unless you have a specific need, e.g you want to use a 64 bit 3rd party component, probably best to just go for x86 for now and keep it simple.
    Please Mark your Thread "Resolved", if the query is solved & Rate those who have helped you



  6. #6
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    22,941

    Re: How to get programs built with VS2012 to run stand alone

    Quote Originally Posted by NeedSomeAnswers View Post
    STOP right there, and uninstall VS 2012 Express. There is really no excuse for using such an old version of VS when you can get the newer community editions for free
    You can have as many versions of VS installed on your computer as you want. I have VS2008, VS2012, VS2015, VS2017, and VS2019. I regularly program in VB2008. Projects written in VB2008 can be opened in VS2008, or any newer version. Also most PCs these days will have at least .Net 3.5 Framework installed...

  7. #7
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    104,121

    Re: How to get programs built with VS2012 to run stand alone

    Quote Originally Posted by .paul. View Post
    It's available in VS2012 Pro, but it was developed by a third party company and i think you can still find it on the www
    Express editions definitely didn't support extensions in 2010 or earlier but VS 2012 Express did support a number of new features. I can't see specific mention of extension support though, which doesn't inspire confidence. I seem to recall extension support being spruiked as new in the first Community edition so I would expect that, if Windows Installer is desired, an upgrade to a more recent Community edition may be required. That's no bad thing though. It should be noted that any project created in VS 2012 will load and run in newer version without change.

  8. #8
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    104,121

    Re: How to get programs built with VS2012 to run stand alone

    Quote Originally Posted by michiganMan421 View Post
    I also want to know how best to build my programs: 32 bit, 64 bit, or any cpu?
    The default these days is to target Any CPU with Prefer 32-bit checked and you should probably only change that if you have a specific reason. That means that the app will run in a 32-bit process on any processor that supports it and in a 64-bit process otherwise. That gives you maximum compatibility.

  9. #9
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    34,706

    Re: How to get programs built with VS2012 to run stand alone

    Quote Originally Posted by jmcilhinney View Post
    The default these days is to target Any CPU with Prefer 32-bit checked and you should probably only change that if you have a specific reason. That means that the app will run in a 32-bit process on any processor that supports it and in a 64-bit process otherwise. That gives you maximum compatibility.
    I'm not sure when that Prefer 32-bit was added. It doesn't appear to exist in 2010, so it may not have been available in 2012, either.

    In any case, 2012 was a pretty lousy version of VS. It was ugly and added little of interest. Things got much better after that, with 2017 and now 2019 being considerable improvements over 2015, which was okay.
    My usual boring signature: Nothing

  10. #10
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    104,121

    Re: How to get programs built with VS2012 to run stand alone

    Quote Originally Posted by Shaggy Hiker View Post
    I'm not sure when that Prefer 32-bit was added. It doesn't appear to exist in 2010, so it may not have been available in 2012, either.
    Fair point.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width