Skip to content

Commit

Permalink
add .vsconfig file (microsoft#4050)
Browse files Browse the repository at this point in the history
* add .vsconfig

Store dependencies in a .vsconfig file, which is picked up by Visual
Studio when opening the solution file. This is easier than manually
selecting the correct options in the installer.

Change Setup-DevEnv.ps1 to use the .vsconfig file from the repo and
remove the buildtools installation, since those seem to be duplicates.

* enable common options during git installation
  • Loading branch information
lmb authored Nov 29, 2024
1 parent 3ba6c7e commit 3e78cf6
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 21 deletions.
40 changes: 40 additions & 0 deletions .vsconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"version": "1.0",
"components": [
"Microsoft.VisualStudio.Component.CoreEditor",
"Microsoft.VisualStudio.Workload.CoreEditor",
"Microsoft.VisualStudio.Component.Roslyn.Compiler",
"Microsoft.Component.MSBuild",
"Microsoft.VisualStudio.Component.TextTemplating",
"Microsoft.VisualStudio.Component.NuGet",
"Microsoft.VisualStudio.Component.Debugger.JustInTime",
"Microsoft.VisualStudio.Component.IntelliCode",
"Microsoft.VisualStudio.Component.VC.CoreIde",
"Microsoft.VisualStudio.Component.Windows10SDK",
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
"Microsoft.VisualStudio.Component.Graphics.Tools",
"Microsoft.VisualStudio.Component.VC.DiagnosticTools",
"Microsoft.VisualStudio.Component.Windows11SDK.22621",
"Microsoft.VisualStudio.Component.VC.ATL",
"Microsoft.VisualStudio.Component.SecurityIssueAnalysis",
"Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
"Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core",
"Microsoft.VisualStudio.Component.Windows11Sdk.WindowsPerformanceToolkit",
"Microsoft.VisualStudio.Component.CppBuildInsights",
"Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions.CMake",
"Microsoft.VisualStudio.Component.VC.CMake.Project",
"Microsoft.VisualStudio.Component.VC.TestAdapterForBoostTest",
"Microsoft.VisualStudio.Component.VC.TestAdapterForGoogleTest",
"Microsoft.VisualStudio.Component.VC.ASAN",
"Microsoft.VisualStudio.Component.Vcpkg",
"Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset",
"Microsoft.VisualStudio.Component.VC.Llvm.Clang",
"Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Llvm.Clang",
"Microsoft.VisualStudio.Workload.NativeDesktop",
"Microsoft.VisualStudio.Component.VC.Runtimes.x86.x64.Spectre",
"Component.Microsoft.Windows.DriverKit"
],
"extensions": [
"https://marketplace.visualstudio.com/items?itemName=WixToolset.WixToolsetVisualStudio2022Extension"
]
}
18 changes: 2 additions & 16 deletions docs/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,8 @@ The following must be installed in order to build this project:
- [Download Visual Studio Professional 2022](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Professional&rel=17)
- [Download Visual Studio Enterprise 2022](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Enterprise&rel=17)

during the installation, select the following feature from the *Visual Studio Installer*:

- `"Desktop development with C++"` (ensure that the "*C++ Address Sanitizer*" component is installed)

including the following components, which must be selected from the "*Individual components*" tab in the *Visual Studio Installer*:

- `"MSVC v143 - VS 2022 C++ x64/x86 Spectre-mitigated libs (latest)"`
- `"C++ Clang Compiler for Windows"`

1. [Visual Studio Build Tools 2022](https://aka.ms/vs/17/release/vs_buildtools.exe) (version **17.4.2 or later**).
1. [The WiX Toolset v3.14.1 build tools](https://github.com/wixtoolset/wix3/releases)
> Note: The *WiX Toolset* has a dependency on the **.NET 3.5 Framework**: you can either enable from the Start menu -> "*Turn Windows features on or off*" and then select "*.NET Framework 3.5 (includes .NET 2.0 and 3.0)*" (recommended), *or*
install it directly from [here](https://www.microsoft.com/en-us/download/details.aspx?id=21).
1. [WiX Toolset v3 - Visual Studio 2022 Extension](https://marketplace.visualstudio.com/items?itemName=WixToolset.WixToolsetVisualStudio2022Extension).
1. [NuGet Windows x86 Commandline](https://www.nuget.org/downloads) (version **6.3.1 or higher**), which can be installed to a location
such as "C:\Program Files (x86)\NuGet\".
Visual Studio will [prompt you to install](https://learn.microsoft.com/en-us/visualstudio/install/import-export-installation-configurations?view=vs-2019#use-a-configuration-file-to-automatically-install-missing-components) the necessary dependencies when opening the main solution file for the
first time.

You should add the paths to `git.exe`, `cmake.exe` and `nuget.exe` to the Windows PATH environment variable after the software packages
above have been installed.
Expand Down
13 changes: 8 additions & 5 deletions scripts/Setup-DevEnv.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
Invoke-WebRequest 'https://community.chocolatey.org/install.ps1' -OutFile $env:TEMP\install_choco.ps1
if ((get-filehash -Algorithm SHA256 $env:TEMP\install_choco.ps1).Hash -ne '44E045ED5350758616D664C5AF631E7F2CD10165F5BF2BD82CBF3A0BB8F63462') { throw "Wrong file hash for Chocolatey installer"}
&"$env:TEMP\install_choco.ps1"
choco install git --version 2.38.1 -y

choco install git -y --params "'/GitAndUnixToolsOnPath /WindowsTerminal /NoAutoCrlf'"
choco install visualstudio2022community --version 117.4.2.0 -y
choco install visualstudio2022-workload-nativedesktop --version 1.0.0 -y
choco install visualstudio2022buildtools --version 117.4.2.0 -y
vs_installer.exe modify --installpath "$Env:ProgramFiles\Microsoft Visual Studio\2022\Community" --add Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset --quiet

echo "Adding required components to Visual Studio"
Invoke-WebRequest 'https://raw.githubusercontent.com/microsoft/ebpf-for-windows/main/.vsconfig' -OutFile $env:TEMP\ebpf-for-windows.vsconfig
# The out-null seems to be required to make powershell wait
# for the command to exit.
&"C:\Program Files (x86)\Microsoft Visual Studio\Installer\setup.exe" modify --installpath "$env:ProgramFiles\Microsoft Visual Studio\2022\Community" --config "$env:TEMP\ebpf-for-windows.vsconfig" --quiet | out-null

choco install nuget.commandline --version 6.4.0 -y
choco install cmake.portable --version 3.25.1 -y
choco install wixtoolset -y
Start-Process "${Env:ProgramFiles}\Microsoft Visual Studio\2022\Community\Common7\IDE\VSIXInstaller.exe" -ArgumentList @("/q", "/a", "${Env:ProgramFiles}\Windows Kits\10\vsix\vs2022\WDK.vsix") -Wait

0 comments on commit 3e78cf6

Please sign in to comment.