Cuda unknown error when using supportedRuntime v2.0.50727 but works while using supportedRuntime v4.

I have a Tesla K20c Graphics card. I’m using Cuda 5.5, compute_35, sm_35.

I have a C# Windows Form Application that I want to incorporate Cuda into. It communicates with a mixed unmanaged C++ dll that accesses methods in my .cu files through a referenced class. I created a method that simply returns the number of cuda enabled devices as an int using cudaGetDeviceCount.

I have an app.config file in my windows form project. When the app. config file reads

<?xml version="1.0"?> the dll returns a value of 0 for the number of Cuda enabled devices. When I check what went wrong using cudaGetLastError() it says unknown error.

If I change the app.config to

<?xml version="1.0"?> the dll correctly returns a value of 2. It also correctly does all the other CUDA methods I want it to do.

My windows form application and my class library (.dll) are both x64 bit applications using .NET framework 3.5. I need to incorporate my windows form application into a larger, much more complex application that only works with supportedRuntime version=“v2.0.50727”.

How do I get my application to work with supportedRuntime version=“v2.0.50727”? Why does the suppportedRuntime version even make a difference?