ошибка Error 1 The type or namespace name 'DllImport' could not be found (are you missing a using directive or an assembly refer

Error 1 The type or namespace name 'DllImport' could not be found (are you missing a using directive or an assembly reference?)

в начало файла с кодом добавьте:

using System.Runtime.InteropServices;

и тогда данная ошибка будет устранена.