Tried to add blueprint function library C++ from editor, now my project is broken

I want to write a custom blueprint function. First i though i had to add source code to the project since I it was a BP project up till now. There was no 'add source code ’ option in the file menu. I right clicked my uproject file and tried: Generate visual studio project files but i got the error: This project does not have any source code. You need to add C++ source files to the project from the editor before you can generate project files.

I resorted to ‘add c++ code’ and chose blueprint functionlibrary. It added the code but got a compile error.
it says
Messages while compiling D:\Projects\NieuwAmsterdam\Intermediate\Build\BuildRules\NieuwAmsterdamModuleRules.dll:
CS0101: The namespace already contains a definition for [GameName]Target.

When i tried the same thing in a blank project there were no problems.
Could it have something to do with the plugins im using in my project? I’m using Truesky.
Even though the blank project also had that plugin enabled…
Please help me because i can’t open up my project anymore.

When i open the project i get the error :
The following modules are missing or built with a different engine version:
UE4Editor-GameName.dll
Would you like to rebuild now?
I press yes but then i get the error:
GameName could not be compiled. Try rebuilding from source manually.
I opened the .sln and tried clean solution but the same error pops up:
CS0101: The namespace already contains a definition for [GameName]Target.

The solution for me was to delete the contents of my intermediate folder. I had packaged the game before maybe that was part of the problem.
In the intermediate folder i had another [Mygame]Target file.
So i deleted the contents then opened the VS solution and rebuild. That worked!