Cppsharp 程序缺少对 netstandard 的引用
Missing reference to netstandard for Cppsharp program
我正在尝试使用 Visual Studio 2015 开始我的第一个 Cppsharp 项目,遵循入门指南。
我遵循的步骤是:
- 创建新的 C# 控制台项目
- 使用 Nuget 安装 Cppsharp
- 将对 Dll 的引用添加到项目中
- 根据这个旧 post
中的示例创建 C# 源文件
虽然 post 中的示例是旧的,但它似乎仍然与入门指南一致。完整的程序如下。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CppSharp;
namespace CppSharpTest
{
class Program
{
class DllDemoGenerator : ILibrary
{
static void Main(string[] args)
{
ConsoleDriver.Run(new DllDemoGenerator());
}
void Setup(Driver driver)
{
var options = driver.Options;
options.GeneratorKind = LanguageGeneratorKind.CSharp;
options.LibraryName = "DllDemo";
options.Headers.Add("DllDemo.h");
options.Libraries.Add("DllDemo.lib");
}
public void SetupPasses(Driver driver) { }
public void Preprocess(Driver driver, CppSharp.AST.Library lib) { }
public void Postprocess(CppSharp.AST.Library lib) { }
}
}
}
但是,我已经面临错误 See image:
CS0012 C# The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=...'
我找不到添加此引用的方法。我发现一个解决方案建议针对更高的 .NET 版本 (4.7.2),我尝试了这个,但错误仍然存在。
谁能帮忙解决这个问题?
在Github页面上发布了同样的问题,被推荐从VS2015升级
安装 VS2019 消除了这个错误
我正在尝试使用 Visual Studio 2015 开始我的第一个 Cppsharp 项目,遵循入门指南。
我遵循的步骤是:
- 创建新的 C# 控制台项目
- 使用 Nuget 安装 Cppsharp
- 将对 Dll 的引用添加到项目中
- 根据这个旧 post 中的示例创建 C# 源文件
虽然 post 中的示例是旧的,但它似乎仍然与入门指南一致。完整的程序如下。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CppSharp;
namespace CppSharpTest
{
class Program
{
class DllDemoGenerator : ILibrary
{
static void Main(string[] args)
{
ConsoleDriver.Run(new DllDemoGenerator());
}
void Setup(Driver driver)
{
var options = driver.Options;
options.GeneratorKind = LanguageGeneratorKind.CSharp;
options.LibraryName = "DllDemo";
options.Headers.Add("DllDemo.h");
options.Libraries.Add("DllDemo.lib");
}
public void SetupPasses(Driver driver) { }
public void Preprocess(Driver driver, CppSharp.AST.Library lib) { }
public void Postprocess(CppSharp.AST.Library lib) { }
}
}
}
但是,我已经面临错误 See image:
CS0012 C# The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=...'
我找不到添加此引用的方法。我发现一个解决方案建议针对更高的 .NET 版本 (4.7.2),我尝试了这个,但错误仍然存在。
谁能帮忙解决这个问题?
在Github页面上发布了同样的问题,被推荐从VS2015升级
安装 VS2019 消除了这个错误