Switched to VS 2017, now VS can't resolve UE4 imports

I opened my project on a new computer, where I have VS 2017 instead of VS 2015 (the project files are on a cloud drive), and all the imports specific to UE4 are redlined with errors like “cannot open source file ObjectMacros.h”. Also, building the solution failed with the following output:

1>------ Build started: Project: UE4, Configuration: BuiltWithUnrealBuildTool Win32 ------
2>------ Build started: Project: TestProject, Configuration: Development_Editor x64 ------
2>"F:\Program Files (x86)\Epic Games\UE_4.16\Engine\Build\BatchFiles\Build.bat" TestProjectEditor Win64 Development "C:\Users\coleg\OneDrive\Workspaces\Unreal Projects\TestProject 4.16\TestProject.uproject" -waitmutex
2>'"F:\Program Files (x86)\Epic Games\UE_4.16\Engine\Build\BatchFiles\Build.bat"' is not recognized as an internal or external command,
2>operable program or batch file.
2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets(44,5): error MSB3073: The command ""F:\Program Files (x86)\Epic Games\UE_4.16\Engine\Build\BatchFiles\Build.bat" TestProjectEditor Win64 Development "C:\Users\<nope>\OneDrive\Workspaces\Unreal Projects\TestProject 4.16\TestProject.uproject" -waitmutex" exited with code 9009.
2>Done building project "TestProject.vcxproj" -- FAILED.
1>Done building project "UE4.vcxproj" -- FAILED.
========== Build: 0 succeeded, 2 failed, 0 up-to-date, 0 skipped ==========

How do I get Visual Studio 2017 to recognize my UE4 code?