Failed to generate Visual Studio project files 4.20

When I try to generate the Visual Studio project files for my project, wich I did before successfully, it now throws this error:

Running E:/Epic Games/UE_4.20/Engine/Binaries/DotNET/UnrealBuildTool.exe -projectfiles -project="…Project.uproject" -game -rocket -progress -log=…Project/Saved/Logs/UnrealVersionSelector-2018.10.22-12.14.15.log
Discovering modules, targets and source code for project…
ERROR: UnrealBuildTool Exception: Unable to instantiate instance of ‘…ProjectTarget’ object type from compiled assembly ‘…ProjectModuleRules’. Unreal Build Tool creates an instance of your module’s ‘Rules’ object in order to find out about your module’s requirements. The CLR exception details may provide more information: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.NullReferenceException: Object reference not set to an instance of an object.
at UnrealBuildTool.TargetRules…ctor(TargetInfo Target) in D:\Build++UE4\Sync\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\Configuration\TargetRules.cs:line 1240
at …ProjectTarget…ctor(TargetInfo Target) in …Project\Source…Project.Target.cs:line 8
— End of inner exception stack trace —
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeConstructorInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at UnrealBuildTool.RulesAssembly.CreateTargetRulesInstance(String TypeName, TargetInfo TargetInfo) in D:\Build++UE4\Sync\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\System\RulesAssembly.cs:line 425

Can anyone help me on how to fix this problem?

I already reinstalled VS 2017 and 4.20, nothing worked.

what is the content of your Build.cs

using UnrealBuildTool;

public class CrowdProject : ModuleRules
{
	public CrowdProject(ReadOnlyTargetRules Target) : base(Target)
	{
		PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
	
		PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });

		PrivateDependencyModuleNames.AddRange(new string[] {  });

		// Uncomment if you are using Slate UI
		// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
		
		// Uncomment if you are using online features
		// PrivateDependencyModuleNames.Add("OnlineSubsystem");

		// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
	}
}

and the Target.cs?

using UnrealBuildTool;
using System.Collections.Generic;

public class CrowdProjectTarget : TargetRules
{
	public CrowdProjectTarget(TargetInfo Target) : base(Target)
	{
		Type = TargetType.Game;

		ExtraModuleNames.AddRange( new string[] { "CrowdProject" } );
	}
}

you are trying to generate the project files from the editor or the context menu?

Context menu

try to use the command line:
"E:\Epic Games\UE_4.20\Engine\Binaries\DotNet\UnrealBuildTool.exe" -projectFiles -project="DRIVE:\Path\To\Project\CrowdProject\CrowdProject.uproject" -game -engine -progress -2017

I get the same Error as before

try removing -progress from the command line

Same error.

But I managed to narrow it down a little bit, if I copy my Config folder in a new project, the same thing happens

well you can try to create a new project and copy the config folder from th new to the old project and see if it fixes things.

I’m gonna copy every config file separately to see wich one it is and then look at the content…
I think I’ll manage from here, if I need anymore help I’ll make another comment.

But thanks for the help anyways

if that doesn’t work you can try to delete the Intermediate and Binaries folders

Ok I found the problem, apparently someone in my team added the newly added Crypto system to our Project, wich lead to me not being able to generate the VS project files or compile with VS in any way.
So if you have Crypto enabled in your Project and you run into a similar or probably any problem, first try disabling it.

Nah, I found it.
Thanks again dude :slight_smile: