public string[] GetAssemblyReferences (ProjectConfigurationInfo[] configurations)
{
string[] refsArray = null;
BuildEngine.RunSTA (delegate
{
var project = SetupProject (configurations);
// We are using this BuildProject overload and the BuildSettings.None argument as a workaround to
// an xbuild bug which causes references to not be resolved after the project has been built once.
var pi = project.CreateProjectInstance ();
pi.Build ("ResolveAssemblyReferences", null);
var refs = new List<string> ();
foreach (ProjectItemInstance item in pi.GetItems ("ReferencePath"))
refs.Add (UnescapeString (item.EvaluatedInclude));
refsArray = refs.ToArray ();
});
return refsArray;
}