Repository: godot
Issue: C# Godot project with MSTest - Error: Generator 'ScriptPathAttributeGenerator' failed to generate source.
Labels: bug,topic:dotnet

### Tested versions

- reproducible in v4.2.1.stable.mono.official [b09f793f5]

VStudio version:
```
Microsoft Visual Studio Community 2022
Version 17.8.5
VisualStudio.17.Release/17.8.5+34511.84
Microsoft .NET Framework
Version 4.8.09032

Installed Version: Community

ASP.NET and Web Tools   17.8.358.6298
ASP.NET and Web Tools

Azure App Service Tools v3.0.0   17.8.358.6298
Azure App Service Tools v3.0.0

C# Tools   4.8.0-7.23572.1+7b75981cf3bd520b86ec4ed00ec156c8bc48e4eb
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

NuGet Package Manager   6.8.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

TypeScript Tools   17.0.20920.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   4.8.0-7.23572.1+7b75981cf3bd520b86ec4ed00ec156c8bc48e4eb
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools   17.8.0-beta.23475.2+10f956e631a1efc0f7f5e49c626c494cd32b1f50
Microsoft Visual F# Tools

Visual Studio IntelliCode   2.2
AI-assisted development for Visual Studio.
```

### System information

Godot v4.2.1.stable.mono - Windows 10.0.22631 - Vulkan (Mobile) - dedicated NVIDIA GeForce RTX 2070 SUPER (NVIDIA; 31.0.15.4617) - AMD Ryzen 7 3800XT 8-Core Processor (16 Threads)

### Issue description

When adding an MSTest project to a C# solution/project created by Godot, the following error message is written to the output window when compiling the test project:

`Generator 'ScriptPathAttributeGenerator' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'InvalidOperationException' with message 'Property 'GodotProjectDir' is null or empty.'`

I've seen this in projects with actual content but not seen any actual issues coming from it.

Full output:
```
Build started at 21:10...
1>------ Build started: Project: PubSub, Configuration: Debug Any CPU ------
1>PubSub -> D:\code\godot-pub-sub\PubSub\.godot\mono\temp\bin\Debug\PubSub.dll
2>------ Build started: Project: Test, Configuration: Debug Any CPU ------
2>CSC : warning CS8785: Generator 'ScriptPathAttributeGenerator' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'InvalidOperationException' with message 'Property 'GodotProjectDir' is null or empty.'.
2>Test -> D:\code\godot-pub-sub\Test\bin\Debug\net8.0\Test.dll
2>Done building project "Test.csproj".
========== Build: 2 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 21:10 and took 02,718 seconds ==========
```

### Steps to reproduce

Simply compile the attached solution.

### Minimal reproduction project (MRP)


[repro.zip](https://github.com/godotengine/godot/files/14103724/repro.zip)