1

So i have simple application, just a few lines:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.DirectX.DirectInput;
namespace asdasd
{
 public partial class Form1 : Form
 {
 public Device joystick;
 public Form1()
 {
 InitializeComponent();
 }
 private void Form1_Load(object sender, EventArgs e)
 {
 foreach (
 DeviceInstance di in
 Manager.GetDevices(
 DeviceClass.GameControl,
 EnumDevicesFlags.AttachedOnly))
 {
 joystick = new Device(di.InstanceGuid);
 break;
 }
 if (joystick == null)
 {
 throw new Exception("No joystick found.");
 }
 }
 }
}

and i try to get the active joystick on my computer, but i get error:

The error

i have the assembly Microsoft.DirectX.DirectInput and i have directX SDK 2010 installed.

Can someone tell me where is the problem?

asked Jul 6, 2011 at 20:58

2 Answers 2

1

Try adding this to the config file:

http://devonenote.com/2010/08/mixed-mode-assembly-error-after-upgrading-to-dotnet-4-0/

(if configuration already exists, just merge these in) And, maybe it's not the right place, but just take a look at XNA... Things are usually much easier with that.

I couldn't paste the XML directly here, it doesn't show up.

answered Jul 6, 2011 at 21:05
Sign up to request clarification or add additional context in comments.

Comments

0

The DirectX assemblies are built against .NET v1.1 Microsoft stopped actively developing them before .NET v2.0 was released.

They cannot be used in projects targeting other than .NET v1.1. XNA is the "blessed" path forward for managed access to Direct X features. I don't know all if it's features, but SlimDX appears to give a more Direct X feeling API for C# than XNA, though I have not used it, I've heard a lot about it.

You might find better responses for chosing an upgrade path over at gamedev.stackexchange.com though.

answered Jul 6, 2011 at 21:05

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.