Please copy the system.memory.dll file to this folder C:\Users\xxxx\source\repos\project Setup.
I had also got the same error in building a service. I manually copied the missing dlls . It worked for me.
Thanks