You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: "Deploy an App By Using the Redistributable Package (C++) | Microsoft Docs"
3
3
ms.custom: ""
4
-
ms.date: "11/04/2016"
4
+
ms.date: "09/17/2018"
5
5
ms.technology: ["cpp-ide"]
6
6
ms.topic: "conceptual"
7
7
dev_langs: ["C++"]
@@ -25,9 +25,9 @@ You must have these components to complete this walkthrough:
25
25
26
26
### To use the Visual C++ Redistributable Package to deploy an application
27
27
28
-
1. Create and build an MFC application by following the first three steps in [Walkthrough: Deploying a Visual C++ Application By Using a Setup Project](../ide/deploying-visual-cpp-application-by-using-the-vcpp-redistributable-package.md).
28
+
1.Create and build an MFC application by following the steps in [Walkthrough: Deploying a Visual C++ Application By Using a Setup Project](walkthrough-deploying-a-visual-cpp-application-by-using-a-setup-project.md).
29
29
30
-
2. Create a file, name it setup.bat, and add the following commands to it. Change `MyMFCApplication` to the name of your project.
30
+
1. Create a file, name it setup.bat, and add the following commands to it. Change `MyMFCApplication` to the name of your project.
31
31
32
32
```cmd
33
33
@echo off
@@ -36,55 +36,55 @@ You must have these components to complete this walkthrough:
1. At a command prompt or in the **Run** window, run iexpress.exe.
42
42
43
-
2. Select **Create new Self Extraction Directive file** and then choose the **Next** button.
43
+
1. Select **Create new Self Extraction Directive file** and then choose the **Next** button.
44
44
45
-
3. Select **Extract files and run an installation command** and then choose **Next**.
45
+
1. Select **Extract files and run an installation command** and then choose **Next**.
46
46
47
-
4. In the text box, enter the name of your MFC application and then choose **Next**.
47
+
1. In the text box, enter the name of your MFC application and then choose **Next**.
48
48
49
-
5. On the **Confirmation prompt** page, select **No Prompt** and then choose **Next**.
49
+
1. On the **Confirmation prompt** page, select **No Prompt** and then choose **Next**.
50
50
51
-
6. On the **License agreement** page, select **Do not display a license** and then choose **Next**.
51
+
1. On the **License agreement** page, select **Do not display a license** and then choose **Next**.
52
52
53
-
7. On the **Packaged files** page, add the following files and then choose **Next**.
53
+
1. On the **Packaged files** page, add the following files and then choose **Next**.
54
54
55
55
- Your MFC application (.exe file).
56
56
57
-
- vcredist_x86.exe. This file is located in \Program Files\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages\vcredist_x86\\.
57
+
- vcredist_x86.exe. This file is located in \Program Files (x86)\Microsoft Visual Studio \<version>\SDK\Bootstrapper\Packages\. You can also download this file from [Microsoft](https://www.microsoft.com/download/confirmation.aspx?id=5555).
58
58
59
59
- The setup.bat file that you created in the earlier step.
60
60
61
-
8. On the **Install Program to Launch** page, in the **Install Program** text box, enter the following command line and then choose **Next**.
61
+
1. On the **Install Program to Launch** page, in the **Install Program** text box, enter the following command line and then choose **Next**.
62
62
63
63
**cmd.exe /c "setup.bat"**
64
64
65
-
9. On the **Show window** page, select **Default** and then choose **Next**.
65
+
1. On the **Show window** page, select **Default** and then choose **Next**.
66
66
67
-
10. On the **Finished message** page, select **No message** and then choose **Next**.
67
+
1. On the **Finished message** page, select **No message** and then choose **Next**.
68
68
69
-
11. On the **Package Name and Options** page, enter a name for your self-extracting setup file, select the **Store files using Long File Name inside Package** option, and then choose **Next**. The end of the file name must be Setup.exe—for example, MyMFCApplicationSetup.exe.
69
+
1. On the **Package Name and Options** page, enter a name for your self-extracting setup file, select the **Store files using Long File Name inside Package** option, and then choose **Next**. The end of the file name must be Setup.exe—for example, *MyMFCApplicationSetup.exe*.
70
70
71
-
12. On the **Configure restart** page, select **No restart** and then choose **Next**.
71
+
1. On the **Configure restart** page, select **No restart** and then choose **Next**.
72
72
73
-
13. On the **Save Self Extraction Directive** page, select **Save Self Extraction Directive (SED) file** and then choose **Next**.
73
+
1. On the **Save Self Extraction Directive** page, select **Save Self Extraction Directive (SED) file** and then choose **Next**.
74
74
75
-
14. On the **Create package** page, choose **Next**.
75
+
1. On the **Create package** page, choose **Next**. Choose **Finish**.
76
76
77
-
4. Test the self-extracting setup file on the other computer, which does not have the Visual C++ libraries:
77
+
1. Test the self-extracting setup file on the other computer, which does not have the Visual C++ libraries:
78
78
79
-
1. On the other computer, download a copy of the setup file, and then install it by running it and following the steps that it provides.
79
+
1. On the other computer, download a copy of the setup file, and then install it by running it and following the steps that it provides. Depending on the options selected, installation might require the **Run as administrator** command.
80
80
81
-
2. Run the MFC application.
81
+
1. Run the MFC application.
82
82
83
83
The self-extracting setup file installs the MFC application that is in the folder that you specified in step 2. The application runs successfully because the Visual C++ Redistributable Package installer is included in the self-extracting setup file.
84
84
85
85
> [!IMPORTANT]
86
-
> To determine which version of the runtime is installed, the installer checks the registry key \HKLM\SOFTWARE\Microsoft\VisualStudio\11.0\VC\Runtimes\\[platform]. If the currently installed version is newer than the version that the installer is attempting to install, the installer returns success without installing the older version and leaves an additional entry on the installed programs page in the Control Panel.
86
+
> To determine which version of the runtime is installed, the installer checks the registry key \HKLM\SOFTWARE\Microsoft\VisualStudio\\\<version>\VC\Runtimes\\<platform>. If the currently installed version is newer than the version that the installer is attempting to install, the installer returns success without installing the older version and leaves an additional entry on the installed programs page in the Control Panel.
title: "Compiling a C++ Program that Targets the CLR | Microsoft Docs"
3
3
ms.custom: ""
4
-
ms.date: "11/04/2016"
4
+
ms.date: "09/17/2018"
5
5
ms.technology: ["cpp-ide"]
6
6
ms.topic: "conceptual"
7
7
dev_langs: ["C++"]
@@ -13,66 +13,70 @@ ms.workload: ["cplusplus"]
13
13
---
14
14
# Walkthrough: Compiling a C++ Program that Targets the CLR in Visual Studio
15
15
16
-
You can create Visual C++ programs that use .NET classes and compile them by using the Visual Studio Development Environment.
16
+
You can create Visual C++ programs that use .NET classes and compile them by using the Visual Studio Development Environment.
17
+
18
+
For this procedure you can type your own Visual C++ program or use one of the sample programs. The sample program that we use in this procedure creates a text file named textfile.txt and saves it to the project directory.
19
+
20
+
## Prerequisites
17
21
18
-
For this procedure you can type your own Visual C++ program or use one of the sample programs. The sample program that we use in this procedure creates a text file named textfile.txt and saves it to the project directory.
19
-
20
-
## Prerequisites
21
-
22
-
These topics assume that you understand the fundamentals of the C++ language.
23
-
24
-
### To create a new project in Visual Studio and add a new source file
25
-
26
-
1. Create a new project. On the **File** menu, point to **New**, and then click **Project**.
27
-
28
-
1. From the Visual C++ project types, click **CLR**, and then click **CLR Empty Project**.
29
-
30
-
1. Type a project name.
31
-
32
-
By default, the solution that contains the project has the same name as the new project, but you can enter a different name. You can enter a different location for the project if you want.
33
-
34
-
Click **OK** to create the new project.
35
-
36
-
1. If Solution Explorer is not visible, click **Solution Explorer** on the **View** menu.
37
-
38
-
1. Add a new source file to the project:
39
-
40
-
- Right-click the **Source Files** folder in Solution Explorer, point to **Add** and click **New Item**.
41
-
42
-
- Click **C++ File (.cpp)** and type a file name and then click **Add**.
43
-
44
-
The **.cpp** file appears in the **Source Files** folder in Solution Explorer and a tabbed window appears where you type the code you want in that file.
45
-
46
-
1. Click in the newly created tab in Visual Studio and type a valid Visual C++ program, or copy and paste one of the sample programs.
47
-
48
-
For example, you can use the [How to: Write a Text File (C++/CLI)](../dotnet/how-to-write-a-text-file-cpp-cli.md) sample program (in the **File Handling and I/O** node of the Programming Guide).
49
-
50
-
If you use the sample program, notice that you use the `gcnew` keyword instead of `new` when creating a .NET object, and that `gcnew` returns a handle (`^`) rather than a pointer (`*`):
For more information on the new Visual C++ syntax, see [Component Extensions for Runtime Platforms](../windows/component-extensions-for-runtime-platforms.md).
55
-
56
-
1. On the **Build** menu, click **Build Solution**.
57
-
58
-
The **Output** window displays information about the compilation progress, such as the location of the build log and a message that indicates the build status.
59
-
60
-
If you make changes and run the program without doing a build, a dialog box might indicate that the project is out of date. Select the checkbox on this dialog before you click **OK** if you want Visual Studio to always use the current versions of files instead of prompting you each time it builds the application.
61
-
62
-
1. On the **Debug** menu, click **Start without Debugging**.
63
-
64
-
9. If you used the sample program, when you run the program a command window is displayed that indicates the text file has been created. Press any key to close the command window.
65
-
66
-
The **textfile.txt** text file is now located in your project directory. You can open this file by using Notepad.
22
+
These topics assume that you understand the fundamentals of the C++ language.
23
+
24
+
### To create a new project in Visual Studio and add a new source file
25
+
26
+
1. Create a new project. On the **File** menu, point to **New**, and then click **Project**.
27
+
28
+
1. From the Visual C++ project types, click **CLR**, and then click **CLR Empty Project**.
67
29
68
30
> [!NOTE]
69
-
> Choosing the empty CLR project template automatically set the **/clr** compiler option. To verify this, right-click the project in **Solution Explorer** and clicking **Properties**, and then check the **Common Language Runtime support** option in the **General** node of **Configuration Properties**.
70
-
71
-
## What's Next
72
-
73
-
**Previous:**[Walkthrough: Compiling a Native C++ Program on the Command Line](../build/walkthrough-compiling-a-native-cpp-program-on-the-command-line.md)|**Next:**[Walkthrough: Compile a C Program on the Command Line](../build/walkthrough-compile-a-c-program-on-the-command-line.md)
74
-
75
-
## See Also
76
-
77
-
[C++ Language Reference](../cpp/cpp-language-reference.md)<br>
> If the **CLR Empty Project** type is missing (Visual Studio 2017 only), select **Open Visual Studio Installer** in the left pane of the **New Project** dialog box. Install the option located under **Desktop development with C++** in the **Optional** components section, named **C++/CLI Support**.<br/>
32
+
33
+
1. Type a project name.
34
+
35
+
By default, the solution that contains the project has the same name as the new project, but you can enter a different name. You can enter a different location for the project if you want.
36
+
37
+
Click **OK** to create the new project.
38
+
39
+
1. If **Solution Explorer** is not visible, click **Solution Explorer** on the **View** menu.
40
+
41
+
1. Add a new source file to the project:
42
+
43
+
- Right-click the **Source Files** folder in **Solution Explorer**, point to **Add** and click **New Item**.
44
+
45
+
- Click **C++ File (.cpp)** and type a file name and then click **Add**.
46
+
47
+
The **.cpp** file appears in the **Source Files** folder in **Solution Explorer** and a tabbed window appears where you type the code you want in that file.
48
+
49
+
1. Click in the newly created tab in Visual Studio and type a valid Visual C++ program, or copy and paste one of the sample programs.
50
+
51
+
For example, you can use the [How to: Write a Text File (C++/CLI)](../dotnet/how-to-write-a-text-file-cpp-cli.md) sample program (in the **File Handling and I/O** node of the Programming Guide).
52
+
53
+
If you use the sample program, notice that you use the `gcnew` keyword instead of `new` when creating a .NET object, and that `gcnew` returns a handle (`^`) rather than a pointer (`*`):
For more information on the new Visual C++ syntax, see [Component Extensions for Runtime Platforms](../windows/component-extensions-for-runtime-platforms.md).
58
+
59
+
1. On the **Build** menu, click **Build Solution**.
60
+
61
+
The **Output** window displays information about the compilation progress, such as the location of the build log and a message that indicates the build status.
62
+
63
+
If you make changes and run the program without doing a build, a dialog box might indicate that the project is out of date. Select the checkbox on this dialog before you click **OK** if you want Visual Studio to always use the current versions of files instead of prompting you each time it builds the application.
64
+
65
+
1. On the **Debug** menu, click **Start without Debugging**.
66
+
67
+
1. If you used the sample program, when you run the program a command window is displayed that indicates the text file has been created.
68
+
69
+
The **textfile.txt** text file is now located in your project directory. You can open this file by using Notepad.
70
+
71
+
> [!NOTE]
72
+
> Choosing the empty CLR project template automatically set the `/clr` compiler option. To verify this, right-click the project in **Solution Explorer** and clicking **Properties**, and then check the **Common Language Runtime support** option in the **General** node of **Configuration Properties**.
73
+
74
+
## What's Next
75
+
76
+
**Previous:**[Walkthrough: Compiling a Native C++ Program on the Command Line](../build/walkthrough-compiling-a-native-cpp-program-on-the-command-line.md)<br/>
77
+
**Next:**[Walkthrough: Compile a C Program on the Command Line](../build/walkthrough-compile-a-c-program-on-the-command-line.md)<br/>
78
+
79
+
## See Also
80
+
81
+
[C++ Language Reference](../cpp/cpp-language-reference.md)<br/>
0 commit comments