Redigera

Dela via


Deploying a Driver to a Test Computer

Taking advantage of the Visual Studio development environment, the WDK provides a test feature that enables you to build, deploy, and debug a driver on a test computer. To successfully deploy a driver to a test system using the WDK, you must first set up and configure a test computer. You can set up and configure multiple computers if you want to test your driver under different testing scenarios.

Setting up the test computer

Note  If you run into difficulties setting up the test computer, see Troubleshooting Configuration of Driver Deployment, Testing and Debugging.

Setting deployment properties for your driver solution

From the property pages for your driver project, you have additional control over how you want your driver deployed for testing. You can choose to deploy the driver automatically whenever you build the driver solution in each configuration.

  1. Open the property pages for your driver project. Select and hold (or right-click) the driver project in Solution Explorer and select Properties.

  2. In the property pages for the driver project, select Configuration Properties, select Driver Install, and then select Deployment.

  3. Select a test computer that you have configured, or select the name of a computer that you want to configure for testing. See Provision a computer for driver deployment and testing (WDK 10).

    When you enable deployment for your driver package project, the driver is automatically deployed to the test computer you have selected when you build your solution. You can use the Deployment property page to configure options for driver installation and deployment. See Deployment Properties for Driver Package Projects.

  4. When you enable deployment on a test computer, you can also automatically enable and configure Driver Verifier, KMDF Verifier, or UMDF Verifier on the test computer to enhance the effectiveness of testing. To set these options for the driver package project, select Configuration Properties, select Driver Install, and then select the following property pages.

Building a driver and deploying the driver to test computer

  1. Before you deploy your driver, make sure that you can build your driver solution. A driver solution must include the driver and driver package so that the driver can be installed on the test computer. For more information, see Creating a Driver Package and Building a Driver.
  2. Before you deploy the driver to the test computer, you also need to sign the driver package. See Signing a Driver During Development and Testing.
  3. Select the test computer that you have configured.
  4. To deploy the driver, select Build Solution or Deploy Solution from the Build menu, or press F5 to build, deploy, and start debugging.
  5. On the test computer, you might see a dialog box asking you to confirm that changes should be made. In this case, deployment is paused until you confirm.

When you deploy a driver, the driver files are copied to the %Systemdrive%\drivertest\drivers folder on the test computer. If something goes wrong during deployment, you can check to see if the files are copied to the test computer. Verify that the .inf, .cat, test cert, and .sys files, and any other necessary files, are present %systemdrive%\drivertest\drivers folder.

Troubleshooting driver deployment

Here are some tips for troubleshooting driver deployment to a test computer when you use Visual Studio and the WDK.

Deployment fails due to Error code: 2

Add the following registry key:

HKLM\Software\Microsoft\DriverTest\Service

Under this key, create a DWORD value DebugSession, and set it to 0.

You only need to set this value once, and it persists for future deployments.

Can't find the deployment properties for the driver project
The deployment properties are only available if you have a driver package. If your driver solution does not have a driver package project, you need to add one. The driver package contains components, such as the INF file that are needed for installation. For more information, see Driver Packages and Creating a Driver Package.

After you have added the driver package, you can select and hold (or right-select) the driver package project in Solution Explorer and select Properties. In the property pages for the driver package, select Configuration Properties, select Driver Install, and then select Deployment.

Problems selecting, configuring or locating the target computer
For instruction on how to set up the target computer, using Windows Driver Kit (WDK) 8.1 and Windows Driver Kit (WDK) 8, see Provision a computer for driver deployment and testing (WDK 10). If you have problems with provisioning the target computer, see Troubleshooting Configuration of Driver Deployment, Testing and Debugging.

If the target computer is running an N or KN version of Windows, you must install the Media Feature Pack for N and KN versions of Windows. See Provision a computer for driver deployment and testing (WDK 10) for more information.

Problems installing the driver on 64-bit version of Windows
Starting with Windows Vista, all 64-bit versions of Windows require driver code to have a digital signature for the driver to load. See Signing a Driver and Signing a Driver During Development and Testing.

Problems installing the driver (general)
The WDK can deploy and install a driver package on a test computer, but only if the driver has all the necessary components for installation, such as an INF file. See Driver Packages more information. Make sure you can install the driver outside of Visual Studio and the WDK. For example, use the Device Console utility, Devcon to test whether you can install the driver. Make sure the device (if you have one) is connected to the target computer. For more information, see Device and Driver Installation and Creating a Driver Package.