Install the software help device that comes with the DirectX SDK . For me, this allowed the use of XNA unit tests on a Hyper-V virtual machine. It should do the trick for any virtual environment, since it implements the full DirectX device in software and does not rely on available hardware or virtualized drivers. It will not be swiftly fast, but it should work.
Installing the main parts of the DirectX SDK is sufficient; further installation and configuration are not required.
(almost forgotten) In the code that installs the device, you must indicate the type of device you are using:
var deviceType = (hardwareDevice ? DeviceType.Hardware : DeviceType.Reference); var graphicsDevice = new GraphicsDevice(GraphicsAdapter.DefaultAdapter, deviceType, ...);
As a side note: in XNA 4.0, the selection of a reference or hardware device is moved to the GraphicsAdapter using the UseReferenceDevice property.
source share