Check the two project properties.
At a guess, you will find that the project where it works is set as .NET version V3.5, and the one where it doesn't is set as .NET V3.0 or below.
Linq syntax was introduced at V3.5, so versions earlier than that do not support it.
code is a bit weird: you do realize that the string class has a StartsWith
if (!str.StartsWith("@variable") && !str.Startswith("@composite"))
s = str.Split('.');