Generate VS project files - System.ArgumentNullException

Hi,
after adding new source files to a plugin within my project, I’m trying to update my project files by using the “Generate Visual Studio project files” option that I get by right clicking the .uproject file. However, it fails with the following error:

Running C:/Users/Invor/Documents/GitHub/UnrealEngine/Engine/Binaries/DotNET/UnrealBuildTool.exe  -projectfiles -project="C:/Users/Invor/Documents/Unreal Projects/MyProject2/MyProject2.uproject" -game -engine -progress -2015
UnrealBuildTool Exception: System.ArgumentNullException: Value cannot be null.
Parameter name: path1
   at System.IO.Path.Combine(String path1, String path2)
   at UnrealBuildTool.VCProjectFileGenerator.ConfigureProjectFileGeneration(String[] Arguments, Boolean& IncludeAllPlatforms) in c:\Users\Invor\Documents\GitHub\UnrealEngine\Engine\Source\Programs\UnrealBuildTool\System\VCProjectFileGenerator.cs:line 236
   at UnrealBuildTool.ProjectFileGenerator.GenerateProjectFiles(String[] Arguments, Boolean& bSuccess) in c:\Users\Invor\Documents\GitHub\UnrealEngine\Engine\Source\Programs\UnrealBuildTool\System\ProjectFileGenerator.cs:line 295
   at UnrealBuildTool.UnrealBuildTool.GenerateProjectFiles(ProjectFileGenerator Generator, String[] Arguments) in c:\Users\Invor\Documents\GitHub\UnrealEngine\Engine\Source\Programs\UnrealBuildTool\System\UnrealBuildTool.cs:line 1457
   at UnrealBuildTool.UnrealBuildTool.DoPostStartupStuffThatCanAccessConfigs(String[] Arguments) in c:\Users\Invor\Documents\GitHub\UnrealEngine\Engine\Source\Programs\UnrealBuildTool\System\UnrealBuildTool.cs:line 1261

So far I had no luck in searching the forums and answerhub for any hints on this particular error. I noticed that the command line options used with UnrealBuildTool.exe contain “-2015” which I thought refers to the Visual Studio version. This seems a bit odd since I’m using VS2013 and don’t even have VS2015 installed.

As a workaround I’m updating my project files via the “Refresh Visual Studio Project” option in the Editor which seems to work, but is a bit tiresome.

Any help is appreciated.

Your answer is here in the DesktopPlatformWindows.cpp file , I think you have build your unreal engine with vs2015 and then uninstalled it and installed vs2013. You have to rebuild your unreal engine.

bool FDesktopPlatformWindows::RunUnrealBuildTool(const FText& Description, const FString& RootDir, const FString& Arguments, FFeedbackContext* Warn)
{
	// Get the path to UBT
	FString UnrealBuildToolPath = RootDir / TEXT("Engine/Binaries/DotNET/UnrealBuildTool.exe");
	if(IFileManager::Get().FileSize(*UnrealBuildToolPath) < 0)
	{
		Warn->Logf(ELogVerbosity::Error, TEXT("Couldn't find UnrealBuildTool at '%s'"), *UnrealBuildToolPath);
		return false;
	}

	// Pass through VS015 support
	FString FinalArguments = Arguments;
#if _MSC_VER >= 1900
	FinalArguments.Append(TEXT(" -2015"));
#elif _MSC_VER >= 1800
	FinalArguments.Append(TEXT(" -2013"));
#else
	FinalArguments.Append(TEXT(" -2012"));
#endif

	// Write the output
	Warn->Logf(TEXT("Running %s %s"), *UnrealBuildToolPath, *FinalArguments);

	// Spawn UBT
	int32 ExitCode = 0;
	return FFeedbackContextMarkup::PipeProcessOutput(Description, UnrealBuildToolPath, FinalArguments, Warn, &ExitCode) && ExitCode == 0;
}

SalehR is correct. If you’re using a Binary version of the engine however, please keep in mind that all versions 4.10 and higher require Visual Studio 2015 by default. To use Visual Studio 2013, you’ll need to build the engine from source. You can find more information on that subject here:

Unfortunately I never had Visual Studio 2015 installed on this system and I already tried rebuilding the engine from source but it didn’t help. However I do have the Visual Studio 2015 Redistributables installed…maybe this is messing things up.
I guess I will try switching to Visual Studio 2015 and rebuild the engine once again.

Yes!
Unfortunately, I’ve Unreal Engine 4.10 and Visual Studio 2015. It didn’t worked.