UEFI application template for Visual Studio using edk2 and MSVC.
Build UEFI applications directly from Visual Studio without needing the edk2 build system for your own code.
- Visual Studio 2022 with C++ workload
- edk2 compiled at
C:\edk2(RELEASE, X64, VS2022) - edk2 libraries copied to
C:\edk2\build_lib - QEMU + OVMF for testing (optional)
For the full edk2 setup guide, refer to the original project.
- Open
efi-msvc-edk2.slnin Visual Studio. - Set configuration to Release | x64.
- Build the solution.
- Output:
x64\Release\efi-msvc-edk2.efi
mkdir C:\uefi_disk\EFI\BOOT
copy x64\Release\efi-msvc-edk2.efi C:\uefi_disk\EFI\BOOT\
qemu-system-x86_64 -bios "C:\edk2\Build\OvmfX64\RELEASE_VS2022\FV\OVMF.fd" -net none -hda fat:rw:C:\uefi_diskIn the UEFI Shell:
fs0:
efi-msvc-edk2.efi
To use additional edk2 libraries (e.g. UefiShellLib, UefiHiiServicesLib):
- Add the
.libto Linker > Additional Dependencies in project settings. - Add the library constructor to
ProcessLibraryConstructorListinefi/AutoGen.c. - Add any missing PCD definitions and GUIDs to the AutoGen files.
efi-msvc-edk2/
├── efi-msvc-edk2.sln
├── efi-msvc-edk2.vcxproj
├── efi-msvc-edk2.vcxproj.filters
├── efi-msvc-edk2.vcxproj.user
├── efi/
│ ├── AutoGen.c
│ ├── AutoGen.h
│ └── ShellStrDefs.h
└── src/
└── main.c
Based on and inspired by edk2-visualstudio by 0xGREG, which itself was inspired by Alex Ionescu's VisualUefi.
MIT