slynch8 / 10x

10x IDE/Editor
189 stars 34 forks source link

[Request] 10x build could resolve VS macros like $(SolutionDir) so opening a .sln always works in a plug-and-play manner when building from 10x #1797

Open AxelCaroPiraknights opened 1 year ago

AxelCaroPiraknights commented 1 year ago

This stems from the following behavior, building an unreal 5 game sln from 10x.

The folder hierarchy looks like this:

C:\PK\Diabolical\trunk\DiabolicalEngine\UE5.sln
C:\PK\Diabolical\trunk\DiabolicalGame\Diabolical.sln

In VS, the build command is: "..\..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll" -Target="DiabolicalEditor Win64 Development -Project=\"C:\PK\Diabolical\trunk\DiabolicalGame\Diabolical.uproject\""

In 10x, the build output says:

C:\PK\Diabolical\trunk\DiabolicalEngine\Engine\Build\BatchFiles\Build.bat -Target="DiabolicalEditor Win64 Development -Project=\"$(SolutionDir)Diabolical.uproject\"" -Target="ShaderCompileWorker Win64 Development -Quiet" -WaitMutex -FromMsBuild
Using bundled DotNet SDK version: 6.0.302
Running UnrealBuildTool: dotnet "..\..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll" -Target="DiabolicalEditor Win64 Development -Project=\"$(SolutionDir)Diabolical.uproject\"" -Target="ShaderCompileWorker Win64 Development -Quiet" -WaitMutex -FromMsBuild
Log file: C:\PK\Diabolical\trunk\DiabolicalEngine\Engine\Programs\UnrealBuildTool\Log.txt
Unable to find project 'C:\PK\Diabolical\trunk\DiabolicalEngine\Engine\Source\$(SolutionDir)Diabolical.uproject'.

This seems like the $(SolutionDir) is confusing 10x and it decides to build as is from the Engine folder. Maybe.

slynch8 commented 1 year ago

I've checked this and $(SolutionDir) is resolved in the 10x build command. So I can only assume that your VS build environment isn't getting setup for some reason. Can you check your log file and see if there are any warnings.

Also, 10x will use the same build command that is in VS. So I tihnk you may be looking at the wrong project for your UnrealBoolTool.dll example above. See the NMake entry for your startup project:

image

michal-z commented 1 year ago

I have the same issue.

I have found below lines in the log file:

13/06/2023 22:12:16: MSBuildVars Error: Could not load file or assembly 'Microsoft.Build, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
13/06/2023 22:12:16: [msbuildvars] Failed getting vars using VisualStudioLink, using msbuild command line instead

EDIT

After installing MSBuild component from Visual Studio Installer problem is gone.

slynch8 commented 1 year ago

works with VS2019 but not VS2022

slynch8 commented 1 year ago

I've checked this and it is working for me. Here are the details of my setup in case anything is different:

D:\UnrealEngine-ue5-main\UE5.sln D:\LyraStarterGame\LyraStarterGame.sln

BuildConfiguration file changed to target VS2022: D:\UnrealEngine-ue5-main\Engine\Saved\UnrealBuildTool\BuildConfiguration.xml

<?xml version="1.0" encoding="utf-8" ?>
<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">
  <ProjectFileGenerator>
    <Format>VisualStudio2022</Format>
  </ProjectFileGenerator>
</Configuration>

Right click on D:\LyraStarterGame\LyraStarterGame.uproject and Generate Visual Studio Project Files

Opening sln in VS2022, the nmake command shows this (with the SolutionDir macro) image

Building in 10x does resolve SolutionDir image

can you double check you have your VisualStudioEnvBat setting set to this: image

AxelCaroPiraknights commented 1 year ago

I have everything exactly as you do, and still it doesn't work. However, because reasons, I tried to install Visual Studio Build Tools 2019 for C++ development, and now it magically works. So something must have been missing, but 10x didn't provide any log about this so I'm not sure the software noticed that something was missing. Also, how does it make sense that installing 2019 elements solves an issue when my VisualStudioEnvBat is setup for 2022? So it's all voodo magic. I'll try uninstalling some 2019 components until I find the one that is actually required, and will try to install the 2022 version of that, because I don't like having a build environment with inconsistencies like that. Will post details here if I find something.

AxelCaroPiraknights commented 1 year ago

Alright, so I need to have Visual Studio Build Tools 2019 installed with the C++ Desktop Development module. Then the $(SolutionDir) will resolve correctly and the build command of the game target from the game sln will work when summoned from 10x.

If I have only the one for 2022 installed, then it fails like before. I give you the components installed for 2019 and 2022 for reference, if it's any use. Sorry they are in french, but since it's mostly numbers I'm sure it won't be a problem. image image 2022_only 2022_and_2019

slynch8 commented 1 year ago

Thanks, that's given me an idea. I may just need to update to the latest msbuild .net library. I'll give that a try.

slynch8 commented 12 months ago

I updated the msbuild library to the latest in build (1.0.77), is anyone in a position to test this? (I can't easily test this due to no internet)