ArticleDirectory
-
- Walkthrough: Create a cab file
Cab File Project-deployment in Visual Studio
Cab File Project
Http://technet.microsoft.com/zh-cn/windows/fwb783c5)
You can create a. cab file to package ActiveX controls that can be downloaded from a Web server to a web browser.
Unlike other deployment projects, no editor is provided to process the cab project. Files and project outputs can be added to the cab project of Solution Explorer. properties can be set in the Properties window or on the project properties page.
The properties of the cab Project allow you to specify the compression level, implement the Authenticode signature, set the display name and version information, and specify the location of the dependent files on the web.
Note:
The system does not calculate the dependencies of the cab project. You must determine and reference all Dependencies by yourself.
Create or add a cab Project
(Http://technet.microsoft.com/zh-cn/magazine/aa291420 (vs.71). aspixel)
The cab project is used to create compressed (. Cab) files that are used to download components to a web browser. If you wantCodeUse this option when running on the client computer instead of the server.
Create a new cab Project
- On the File menu, point to add project, and click New project ".
- In the "Add new project" dialog box, select the "Install and deploy project" folder.
- Select "cab project ".
Add an existing cab project to the solution
- On the File menu, point to add project, and click existing project ".
- In the displayed "add existing project" dialog box, browse to the location of the cab project and click "open ".
Walkthrough: Create a cab file
The following walkthrough shows how to create a cab file for the ActiveX control and deploy it on a web site so that it can be downloaded to the end user's browser.
Create a cab project for ActiveX Controls
- On the "file" menu, point to "new" and select "project ".
- In the Create Project dialog box, select "Install and deploy Project" in the "project type" pane, and select "cab Project" in the "template" pane ". In the Name box, typeAxcontrol.
- Click OK to close the dialog box.
- In Solution Explorer, select the "axcontrol" project. On the "project" menu, choose "add"> "File ".
- In the Add file dialog box, browse and find the ActiveX control (. ocx), and click OK to close the dialog box.
Note:You can use ActiveX Control created by Visual Studio. NET or any. ocx file in the system directory.
- On the "project" menu, select "properties ".
- In the "Project Properties" dialog box, select the "Authenticode signature" check box, and enter "Certificate file", "Private Key File", and "timestamp server ". Click OK to close the dialog box.
Note:This step is optional. However, if you do not use the Authenticode signature, you will not be able to download the cab file to the browser unless the browser's security settings allow you to download the unsigned ActiveX control.
- On the "generate" menu, select "generate axcontrol ".
Create a web applicationProgram
-
- On the File menu, choose add project> new project ".
- In the Add new project dialog box, select Visual Basic Project in the project type pane, and select ASP. NET web application in the template pane ". In the "location" box, typeHttp: // localhost/axcontrolweb.
-
- Click OK to close the dialog box.
-
- Select the Toolbox window. On the Tools menu, select Add/Remove toolbox items ".
-
- In the "Custom toolbox" dialog box, select the same ActiveX Control used in the previous process.
-
- Click OK to close the dialog box.
-
- In the Toolbox window, select the ActiveX control and drag it to the webform1.aspx designer.
-
- On the "project" menu, select "add existing item ".
-
- In the "add existing items" dialog box, locate the project directory and find the generated cab file. The default path is \ Documents and Settings \Yourloginname\ Axcontrol \Project Configuration\ Axcontrol. Cab. By default, "project configuration" is "debugging ". Click OK to close the dialog box.
Note:You may need to type the file name (axcontrol. Cab) in the "file name" field ).
-
- In the webform1.aspx designer, select the ActiveX control.
-
- In the "properties" window, selectCodebaseProperties and click the ellipsis () button.
- In the create URL dialog box, select axcontrol. cab from the directory pane, and click OK to close the dialog box.
Note:If you change the cab file project, you need to regenerate the cab file project, delete the old cab file from the web project, and repeat steps 6 and 7. This is necessary because the cab file in the web project is actually a copy of the generated cab file.
-
- On the "generate" menu, select "generate SOLUTION ".
Test installation
- Browse to the web page of the computer where the ActiveX control is not registered (http ://Computername/Axcontrolweb/webform1.aspx ). Make sure that the control is installed on this computer and the Authenticode dialog box is displayed.
Http://technet.microsoft.com/zh-cn/library/aa291417
Http://technet.microsoft.com/zh-cn/magazine/aa291420 (vs.71). aspx
Http://technet.microsoft.com/zh-cn/library/fwb783c5 (V = vs.80)
Http://blog.bossma.cn/dotnet/csharp-activex-cab/ (C # Develop ActiveX control and make cab package)