Godot Version
4.2.1 Mono
Question
I am trying to integrate MarkovJunior into a project to see if it’s usable and I’m probably doing something wrong with the import.
Currently I have downloaded and extracted the dll of the release into my root folder and import it via adding
<ItemGroup>
<Reference Include="MarkovJunior">
<HintPath>MarkovJunior.dll</HintPath>
</Reference>
</ItemGroup>
to the .csproj file.
When I then try using MarkovJunior
in a simple Main.cs file I get The type or namespace name 'MarkovJunior' could not be found (are you missing a using directive or an assembly reference?)CS0246
.
I’m very likely not importing things properly, so what is the correct way to import a library like this?
Full .csproj and Main.cs files below.
csproj
<Project Sdk="Godot.NET.Sdk/4.2.1">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'android' ">net7.0</TargetFramework>
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'ios' ">net8.0</TargetFramework>
<EnableDynamicLoading>true</EnableDynamicLoading>
</PropertyGroup>
<ItemGroup>
<Reference Include="MarkovJunior">
<HintPath>MarkovJunior.dll</HintPath>
</Reference>
</ItemGroup>
</Project>
Main.cs
using Godot;
using System;
using MarkovJunior;
public partial class Main : Node
{
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
GD.Print("Hi");
}
}
Moreus
January 12, 2024, 11:51pm
2
<Reference Include="MarkovJunior.dll" />
I tested.i did project file Temp.dll
namespace Temp;
public class MathFunctions
{
public static int Add(int a, int b)
{
return a + b;
}
}
added to my Godot Project
<Project Sdk="Godot.NET.Sdk/4.2.1">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<EnableDynamicLoading>true</EnableDynamicLoading>
<RootNamespace>GodotBUGhunting</RootNamespace>
</PropertyGroup>
<ItemGroup>
<Reference Include="Temp.dll" />
</ItemGroup>
</Project>
GD.Print(Temp.MathFunctions.Add(5, 5));
and is working
Doesn’t seem to be working.
.csproj
<Project Sdk="Godot.NET.Sdk/4.2.1">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'android' ">net7.0</TargetFramework>
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'ios' ">net8.0</TargetFramework>
<EnableDynamicLoading>true</EnableDynamicLoading>
</PropertyGroup>
<ItemGroup>
<Reference Include="MarkovJunior.dll"/>
</ItemGroup>
</Project>
Might have something do with the library itself?
Moreus
January 15, 2024, 2:29pm
4
Maybe You needed check documentation for MarkovJunior. and check how to build.
There isn’t much there I’m afraid
Build steps
MarkovJunior interpreter is a console application that depends only on the standard library. Get .NET Core for Windows, Linux or macOS and run
dotnet run --configuration Release MarkovJunior.csproj
Alternatively, download and run the latest release for Windows.
Doing that and copying the .dll generated that way gives the same errors.
Moreus
January 16, 2024, 4:43pm
6
I’ve examined some *.cs files, and it seems like they don’t utilize any namespaces. Therefore, the usage of using MarkovJunior;
appears to be incorrect. Additionally, I’ve noticed that they use names like ‘node.’ In this case, you should use Godot.Node
instead of just Node
Moreus
January 17, 2024, 8:50am
7
You can use a DLL as an external component.