Data-Oriented-House / PortableBuildTools

Portable VS Build Tools installer
595 stars 19 forks source link

msbuild.exe not included. Can you add such option? #2

Closed anacondaq closed 1 year ago

anacondaq commented 1 year ago

Hi. You have awesome tool. I really enjoy it. But can you please make it more usable by adding msbuild inside the package (for compiling solutions) Example of great project: https://github.com/reksar/vsget You have almost everything except windows SDK & msbuild.exe extracted.

What you get in result? If you check the repo: https://github.com/reksar/vsget and will try to use it, you will realize that msbuild.exe included out the box and you can compile any sln (solution) C++ based without any problems at all.

ftphikari commented 1 year ago

msbuild.exe is kinda weird because you still need to install the full Visual Studio if you want to change the solutions, so this only helps you to compile them, and that's it. I'll see into it and implement it if it's not too hard.

anacondaq commented 1 year ago

@ftphikari i want you to take a look this project: https://github.com/reksar/vsget It can be very cool integrated together to have awesome results of different SDKs and real working portable msbuild tools with C++ & WinSDK

AndhikaWB commented 1 year ago

@anacondaq you can try my tool, it does have msbuild included, though I'm not familiar with it.

anacondaq commented 1 year ago

@AndhikaWB i did, but for some unknown reasons i can't make it fully work. Some errors happened days ago while downloading some stuff.

AndhikaWB commented 1 year ago

@anacondaq If you tested it a few days ago then it's possible that I already pushed some revisions after that. Yesterday, I tested building sample Flutter app (which apparently make use of vswhere, CMake, and MSBuild) and it worked.

Also, based on my observation (using procmon), it seems that MSBuild and/or CMake will also try to read things from registry (e.g. Windows SDK location, VS instances). You will need to create/modify some registry values in order to trick them (I automated it via vs_register.bat but you must run the batch script manually).

The file should look (more or less) like this:

set ROOT=%~dp0
set SDK_VER=10.0.22621

"%SYSTEMROOT%\SysWoW64\regsvr32" "%ROOT%VisualStudio\Setup\x86\Microsoft.VisualStudio.Setup.Configuration.Native.dll"
reg add "HKLM\SOFTWARE\Microsoft\VisualStudio\Setup" /v CachePath /d "%ROOT%VisualStudio\Packages" /f
reg add "HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0" /v InstallationFolder /d "%ROOT%Windows Kits\10\\" /f /reg:32
reg add "HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0" /v ProductName /d "Microsoft Windows SDK for Windows %SDK_VER%" /f /reg:32
reg add "HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0" /v ProductVersion /d "%SDK_VER%" /f /reg:32
reg add "HKLM\SOFTWARE\Microsoft\Windows Kits\Installed Roots" /v KitsRoot10 /d "%ROOT%Windows Kits\10\\" /f /reg:32

Combined with my comment here should also be able to trick vswhere (barely).

If you need more help send your error log and create an issue on my repo instead. I feel bad hijacking this issue :sweat_smile: , but I hope my findings will be helpful to both of you.

ftphikari commented 1 year ago

Today I'm stepping down as a maintainer of this project, so the update is not going to happen. At least by my hands... if some of you want to do it instead, feel free to ping @SolarScuffle-Bot

Apis035 commented 4 months ago

Hi @SolarScuffle-Bot, will this be implemented eventually? There are several projects that I am using uses msbuild to build (one of which is Pluto). I would like to keep using PortableBuildTools in the future than the official Build Tools installer as this is much lighter and easier to configure.

SolarScuffle-Bot commented 4 months ago

@ftphikari says: Why would somebody want to use msbuild if they are not installing VS? As soon as you want something slightly more complicated than just building a repo from github, msbuild is useless without the IDE, since it can only build them, not create new ones. Look at the repo, it has VS solutions, clearly it is meant to be built with VS. I'm sorry, but i don't think msbuild will ever be added, PortableBuildTools are meant for simple native projects using bat files instead of build systems. If you want a better builder - ninja is way better than msbuild, sometimes orders of magnitude.

Apis035 commented 4 months ago

Well, all this time I was building that project with msbuild pluto.sln -p:Configuration=pluto and it works nicely for me without the whole VS IDE.

Maybe could make it an option whether to include msbuild in the installation or not. But anyway, thank you for the response!