I am trying to build a project which integrates CUDA CPP with C# stand alone application

I need some help regarding this
If you have any information on how to integrate C# and CUDA, please share with me.
In my first step I tried to write a CPP function which calculates Euclidean Distance

__shared__ float sum = 0;


__global__ void EuclideanDistance(float *a,int *b,int *c)
{
    int i = threadIdx.x;
    //c[i] = a[i] + b[i];
	sum = sum + *(a + i);

}

This shows me error message as
Severity Code Description Project File Line Suppression State
Error MSB3721 The command ““C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin\nvcc.exe” -gencode=arch=compute_35,code=“sm_35,compute_35” --use-local-env -ccbin “C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64” -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\include” -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\include" -G --keep-dir x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static -g -DCODE_ANALYSIS -DWIN32 -DWIN64 -D_DEBUG -D_CONSOLE -D_MBCS -Xcompiler “/EHsc /W3 /nologo /Od /Fdx64\Debug\vc141.pdb /FS /Zi /RTC1 /MDd " -o x64\Debug\kernel.cu.obj “C:\Users\pc\source\repos\firstexp\firstexp\kernel.cu”” exited with code 1. firstexp C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\BuildCustomizations\CUDA 10.0.targets 712

Please share your thoughts on this.
Also if you have any resources for this please share with me.
My current setup is
Windows 10 64 bit
Visual Studio community edition 2017
Nsight 6.0

This particular error isn’t related to C#-integration. It looks like unfortunately you’re not seeing the relevant error message in VS, if you run the build from the command-line you’ll see this error message which should be more helpful:

‘initializer not allowed for shared variable’

Regarding C# integration specifically, there are a few approaches you can take:

  1. Create a C++ .dll that contains your CUDA code, then call the .dll functions from C# via PInvoke ([DllImport]).
  2. Compile the CUDA code to .ptx and then use something like https://kunzmi.github.io/managedCuda to load and run the kernel from C#.
  3. Use a compiler like Hybridizer that lets you write your GPU code in C#. See https://devblogs.nvidia.com/hybridizer-csharp for more details on this approach.