CnCNet / xna-cncnet-client

XNA / MonoGame based client for playing classic Command & Conquer games both online and offline with a CnCNet game spawner.
Other
223 stars 86 forks source link

VS issue with building, and can't start after compiling - file not found #501

Closed cool-ej closed 4 months ago

cool-ej commented 6 months ago

I've got a couple of issues trying to get things built and running, possibly related. I'm not a C# coder so I apologise in advance if these are silly questions or I've missed something.

When trying to bring the code up in Visual Studio (version 17.8), Visual Studio won't build the project (fails on Ares XNA) because it is choosing .NET 8 instead of 7 (both are installed and listed if I run dotnet --list-sdks). If I uninstall 8, I can build the project through the build scripts provided but I can't use Visual Studio to code as I think it requires .NET 8?- I get an error "Based on your solution, you might need to install extra components for a full development experience. Install " If I click install, it wants to install ".NET Desktop Development" which just reinstalls .NET 8 and then I can't build through the build scripts or VS. If I don't click install, the files are unloaded and I can't edit/build/run. What's the fix for that? Can it target .NET 7 and not look at 8 somehow?

When I use the build scripts and only have version 7, the Build-All.ps1 succeeds for everything. However when I copy the files to the game folder and try to run the launcher it won't start. Event viewer gives two errors:

Application: clientdx.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.IO.FileNotFoundException at DTAClient.PreStartup.Initialize(DTAClient.StartupParams) at DTAClient.Program.Main(System.String[])

Then another error:

Faulting application name: clientdx.exe, version: 2.8.0.0, time stamp: 0x6546d58c Faulting module name: KERNELBASE.dll, version: 10.0.22621.2792, time stamp: 0x3091b6fb Exception code: 0xe0434352 Fault offset: 0x000000000006567c Faulting process id: 0x0xFA0 Faulting application start time: 0x0x1DA3C3B3818DF1C Faulting application path: C:\Program Files (x86)\Red Alert 2\Game\Resources\clientdx.exe Faulting module path: C:\Windows\System32\KERNELBASE.dll Report Id: 0ffb6722-bd0a-4871-af1d-782811c0ce54 Faulting package full name: Faulting package-relative application ID:

No error messages pop up so am not sure what file is missing.

I found the instructions to build and get all of this running a bit difficult to understand - how the different projects slot together - all the different builds. There's files I see that don't seem to get built. It'd be great if someone could expand on what's already written. Hell, I'd pay for a video tutorial from a fresh Windows install to the making a change in this repo.

Also big thanks for all the work on the whole CnCNet platform - I've sunk a lot of hours into games on here (and a lot trying to build this thing!).

SadPencil commented 6 months ago

Hi. Don't worry. Your help is on the way.

Based on your solution, you might need to install extra components for a full development experience.

I've also encountered this issue. To get rid of this error message, you may uninstall Visual Studio Community 2022 and install it again. You should be able to keep .NET 8 SDK along with .NET 7 SDK then.

Also, note that .NET 7/8 builds do not have such files as clientdx.exe. Only .NET 4 builds have such files, while in develop branch there is no .NET 4 support.

Since we're now working on .NET 8/4.8 migrations, I recommend you switch to branch revert-to-net-framework. This can be done by command git checkout revert-to-net-framework inside the source folder. After switching to this branch, you should be able to run Build-All.ps1 and get clientdx.exe with all other necessary files without problems. You can also open the project in Visual Studio after finishing the re-installation I've mentioned before.

Let me know if you have further questions.

frg2089 commented 4 months ago

Creating a global.json should take care of that!

like this:

{
  "sdk": {
    "rollForward": "major",
    "version": "7.0.400"
  }
}