+1 vote

I am following a the tutorial from 2d vector from godot docs and i am running the following script through c#:
using Godot;
using System;

public class Node2D : Godot.Node2D
{
// Declare member variables here. Examples:
// private int a = 2;
// private string b = "text";

// Called when the node enters the scene tree for the first time.
public override void _Ready()
{

}

public override void _Process(float delta)
{
var Node2D = (Node2D)GetNode("Node2D");
Node2D.Position=new Vector2(400,300);
}
}
But when i am running the scene or building its giving me the following errors:
FAILED TO BUILD PROJECT SOLUTION
C:\Users\MANDAL.nuget\packages\godot.net.sdk\3.3.0\Sdk\Sdk.props(29,11): The SDK 'Microsoft.NET.Sdk' specified could not be found.

C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.targets(131,5): Unable to find a project to restore!

F:\GODOT PROJECTS\PRACTICE\Practice.csproj(0,0): Skipping restore for project 'F:\GODOT PROJECTS\PRACTICE\Practice.csproj'. The project file may be invalid or missing targets required for restore.

Godot version latest
in Engine by (19 points)

1 Answer

+1 vote

Hi,
The error is not caused by your code, otherwise by the missing build tools. Here you have a link to a installer.

by (353 points)

Greetings,
Thank you for you help... i have installed msbuild and mono both after this... do I have to change the build in mono section of editor settings?(I have dotnet CLI by default and changing it to anything else also giving me errors)...
I have installed mono (and changed the build in settings after a restart )but i am still getting error like this.(in the msbuild window below)

F:\GODOT PROJECTS\VEctro\VEctro.csproj(0,0): The SDK resolver type "DotNetMSBuildSdkResolver" failed to load. The type initializer for 'Microsoft.DotNet.MSBuildSdkResolver.VSSettings' threw an exception.

and in the debugger window getting these errors when build are set to dotnetCLI:
E 0:00:02.272 get_node: (Node not found: "Node2D" (relative to "/root/Node2D").)
<C++ Error> Condition "!node" is true. Returned: __null
<C++ Source> scene/main/node.cpp:1371 @ get_node()
:0 @ Godot.Node Godot.NativeCalls.godot_icall_1_578(IntPtr , IntPtr , IntPtr )()
Node.cs:618 @ Godot.Node Godot.Node.GetNode(Godot.NodePath )()
Node2D.cs:19 @ void Node2D._Process(Single )()
E 0:00:02.307 void Node2D._Process(Single ): System.NullReferenceException: Object reference not set to an instance of an object.
<C++ Error> Unhandled exception
<C++ Source> F:\GODOT PROJECTS\VEctro\Node2D.cs:20 @ void Node2D._Process(Single )()
Node2D.cs:20 @ void Node2D._Process(Single )()

Thank you for helping me as i am very new to this and these errors are really demoralizing as I dont have any clue what is the source of the problem

Thank you once again for you help

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.