In a Visual C++ project, how do I give users redistributable .dll files? - visual-studio

I'm a new C++ / visual studio learner so sorry if I don't know something that might be obvious.
Alright so I understand that to get my programs to run on machines without VS I need to distribute the correct .dll files to them. Here are my questions:
How do I know what files to distribute? Once I know the files I need, where can I find them? I already have the .dll package microsoft provides installed but I don't know where to find it or the files in it.
How do I supply these files to the user? Can I just include the files with the installer and then on program start through code move the files to the correct spot? How do I do this? Is it possible to move the files to the correct location through the installer or do I have to do it when the program launches for the first time?
Thanks! Sorry if I left out information or if I formatted this question improperly.

You can choose to statically link your application, then no C++ DLLs are needed.
Otherwise, Microsoft has "redistributable package" EXEs for each version of Visual Studio that you can include with the files that you provide to users. Your installer then runs these as a sub-install. (It does something like start another process that runs that package then waits for it to finish.)
Google visual studio redistributable.
Normally you would use a setup program / installer like InstallShield or WIX, and some of them already have built-in support for adding the redistributables for C++ and DirectX.

Related

Visual Studio 2012 - cannot find vsvars32.bat to use gacutil to install extra tools

I am running Visual Studio 2012 (version 11.0.50727.1)
I have been trying to install https://jsonsource.codeplex.com/, a tool to allow JSON data to be imported using SSIS. To install this, once I have copied the dll's into the correct folder, I need to register them using gacutilexe. this is where my problem starts. I am supposed to run Gacutil.exe from the Visual Studio command line. This is supposed to be present in the Start Menu as VS2012 x86 Native Tools Command Prompt (it isn't), I am also supposed to be able to access it using vsvars32.bat (using the add external tools menu in Visual Studio, and supplying the location of vsvars32.bat as an argument). However, I cannot find vsvars32.bat anywhere within my C drive.
I have found several versions of GacUtil.exe in various subfolders of C:\program files(x86)\Microsoft SDKs\Windows, although the installation guide lead me to believe it should be in C:\Program Files\Microsoft SQL Server\120\DTS\PipelineComponents, i.e. where I copied the dll's for the tool I am installing. I'm not sure which of these (if any) I should be using once I get to the visual studio command prompt. Could do with advice here as well.
vsvars32 is meant to be somewhere within C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools, but it is definitely not present any where within the Visual Studio folder.. There are also folders for Visual Studio 9 and 10, but these do not contain vsvar32 anywhere within them either.
if anyone could help I would be very much indebted - My options as to how to deal with the JSON source files otherwise are extremely limited. (using Management Studio 2012 rather than 2016, so can't use OPENJSON. If anyone can suggest any alternatives, let me know. This includes just any option to get the entire JSON file file into a cell - I could probably build some kind of extensive string manipulation to script to split it all out once I've got them in there, although this seems like entirely the wrong way to go about things...)
The first time you install the 3rd party package in Nuget Package manager, it will automatically download the .dll to your user temp folder, once you close it, it will gone, but it will register for you. If you need to find where the exactly location is, simply double click that new added .dll in solution window, if you try to reinstall, but it does not allow you to do that, delete the package.config file, and try to reinstall that package. Once that is added again, do not forget to double click that .dll, to see where is reside, move to your own folder, register using gacutil -i command, and should be good.

How to compile apache httpd with visual studio 2013 comunity edition?

Please if someone could tell me a good guide on how to compile the apache server in visual studio 2013. What happens is when I open the downloaded project file, it asks me to modify some files and when I try to do so I get a bunch of error massages.
As I understand the source files downloaded from the apache servers is for unix systems and I read somewhere that the files need to be modified in order to be compiled for windows. Now another question here is, why would you need to modify the source code for windows shouldn't the compilers do this while compiling and output a file that runs on windows regardless of what functions are called in the source file?
As you can tell I am kind of confused with this hole thing, I don't think its a complicated matted, just needs some explaining, thanks.

add own path to the targetpath during installation

I want to attach my own folder name to the "DefaultLocation" during msi installation (using VS 2005). Currently all programs installs at "C:\Program Files (x86)". I want to append some "xyz" path to the installation path during installation. So, once the user clicks next, the path for the installation should be "C:\Program Files (x86)\xyz".
Can anyone tell me how to do this in the windows installer.
The short answer is no, because here is nothing in Visual Studio setup projects to support that. You'd need the ability to change the target directory in the UI sequence after that dialog, that's what's missing.
VS setup projects are limited in their support for all the features of Windows Installer, so migrating to a different tool would be useful if this is the kind of customization you're looking for.
Could anyone tell you how to do this in Windows Installer? Technically yes. You'd need somebody who knows enough about the insides of MSI files generated by VS to design a solution (a custom action based off the Next button?) and change the MSI file manually to do it, and how to repeat that after every build (a post build script), and for you or your company to understand enough to fix it if it stops working. That doesn't seem practical compared to just using a tool that will let you do it. My apologies for the editorial but if VS doesn't support it your choices are limited.

How to create my an installer for my DLL?

I am currently using Visual C++ to develop my DLL program. This DLL also uses outside executables inside my local hard drive.
When doing testing, I manually install the DLL using this command regsvr32 filename.dll at the Windows command prompt.
What I would like to do now is an installer, like the Installshield etc. So, after this I can easily install it on other Windows machines without the need to manually use the command prompt, copying those separates executables into the hard drive and so on.
Is there a way to do this the open source way? or Is it available inside Visual Studio? Need advice on best practice.
Another possibility since you're already using VS, you can create a "Setup and deployment project", found under "Other Project Types". This allows you amongst other things to select the output of another VS project (in the same solution), add registry entries, package files from the file system, and register (regsvr32) files. To register a DLL (once you have added it to the project), change the "Register" entry on the "Properties" Window to vsdrfCOMSelfReg. However if you're packaging other executables off the hard drive, I'm not sure how you would make sure that they run. You prob have to make sure that you package all their run-times and dependencies.
AFAIR this functionality is not available in the express editions of VS.
WiX is open source, and there's a free (no cost) version of InstallShield available for Visual Studio 2010, so both.

Opening vbp Visual Basic Project

I have got some old sources written in Visual Basic. There are *.bas, *.cls, *.frm and *.vbp files. As I understand, vbp is a project file. But I cannot open it with my Visual Studio 2008.
What version of VS should I install to open *.vbp file? Google says it is Visual Studio 6, but I am not sure and I cannot find Visual Studio 6 for downloading. Is there any publicly available free edition of Visual Studio 6 with Visual Basic?
Thanks.
vbp is indeed a VB 5/6 Project File.
VS6/VB5/VB6 are not free, so if you want to build the project you will need to spend $5 on ebay.
The VB5 Control Creation Edition (build COM components only) was the only free version MS released.
Older versions of VS.net included a way to import a VBP and upgrade it to VB.NET, but YMMV (significantly).
Edit; If you just want to look at the source/project structure all the files except .frx are plain ascii.
If you have an MSDN subscription, then VB6 is available as a free download. Otherwise try ebay like Alex suggests, but it usually costs significantly more than $5.
Microsoft recommends users get a 3rd party conversion program called ArtinSoft,
http://msdn.microsoft.com/en-us/ff793478
When opening the vbp file which is the project file, you will most likely have an import wizard show up, which after trying to import the project it will likely tell you there are a bunch of dependencies vb6 used to use which .net does not and will error out. You need to have vb5/6 installed or at least the dependency files installed in order to proceed with the import. You can view source code from the plain ascii text files of the .frM files.
To get a working copy of visual basic follow the following steps.
after much research I found out that the original Vb6 was distributed as a disk set, all CD's are just ISO files built up of folders and files. You can get a copy of an original ISO here. There is a google drive version floating around on the web of the ISO but personally that just seems really sketchy to me.
https://winworldpc.com/product/microsoft-visual-bas/60
in order to use the ISO you will need to unzip the ISO with WinRar, so download a copy of WinRar (its a widely used file archiver tool)
follow the install instructions here https://youtu.be/LXvd8IRw_ZI
"How to Install Visual Basic 6.0 on Windows 7/8/8.1/10" by "Matthew Marcelo"
** be sure to run the installation as administrator ** .\Micrsosoft Visual Basic 6.0\extracted\SETUP.EXE
after getting everything installed I realized I needed a copy of the MSDN library (version October 1999) which is the developer documentation for using VB6, that is found here https://winworldpc.com/product/msdn/october-1999
--
if you are like me and had to get VB6 working because of a very old legacy project and you had no clue what .OCX (controller) files were, and you got a bunch of error messages when you open the main project .VBP file, when you get ahold of the files and install them, installing them as admin usually does the trick by making a batch file, or running an administrator powershell/cmd window
regsvr32.exe \path\to\file.ocx
you need Visual Basic, not Visual Studio to open these files. or you can open it using a normal text editor like sublime text file separately. but if you want to open it like a project then you should use Microsoft Visual Basic 6.0 / 5.0 . There is a portable version too.
If you still want to open .vbp file using visual studio try to use VB tools for Visual Studio. I think it will help you.

Resources