我有以下代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MapsApp.DB;
namespace MapsApp
{
public partial class _Default : System.Web.UI.Page
{
[DLLImport("GeoUrbanApp.exe")]
public static extern double CalcFigure(double east, double north, double size);
...
我正在尝试从.exe文件中调用CalcFigure函数。我已经将其添加到引用中,并尝试导入它。但我得到的只有:
The type or namespace name 'DLLImport' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'DLLImportAttribute' could not be found (are you missing a using directive or an assembly reference?)
大多数人在网上找到的解决方案是 "using System.Runtime.InteropServices;" 但我已经有了。