Adjust for null _environment.ReferencePath

This commit is contained in:
Jérôme Laban 2019-02-17 20:42:18 -05:00
Родитель ebbe89e140
Коммит 3f4b56dc30
1 изменённых файлов: 13 добавлений и 7 удалений

Просмотреть файл

@ -65,9 +65,12 @@ namespace Uno.SourceGeneration.Host
Microsoft.CodeAnalysis.Host.Mef.MefHostServices.DefaultHost.ToString();
// Pre-load known references
foreach (var reference in _environment.ReferencePath)
if (_environment.ReferencePath != null)
{
_metadataResolver.ResolveReference(Path.GetFileName(reference), Path.GetDirectoryName(reference), new MetadataReferenceProperties());
foreach (var reference in _environment.ReferencePath)
{
_metadataResolver.ResolveReference(Path.GetFileName(reference), Path.GetDirectoryName(reference), new MetadataReferenceProperties());
}
}
}
@ -272,13 +275,16 @@ namespace Uno.SourceGeneration.Host
var solution = ws2.CurrentSolution.AddProject(pi);
var project = solution.GetProject(pi.Id);
foreach(var reference in _environment.ReferencePath)
if (_environment.ReferencePath != null)
{
var metadataRefs = _metadataResolver.ResolveReference(Path.GetFileName(reference), Path.GetDirectoryName(reference), new MetadataReferenceProperties());
foreach (var metadataRef in metadataRefs)
foreach (var reference in _environment.ReferencePath)
{
project = project.AddMetadataReference(metadataRef);
var metadataRefs = _metadataResolver.ResolveReference(Path.GetFileName(reference), Path.GetDirectoryName(reference), new MetadataReferenceProperties());
foreach (var metadataRef in metadataRefs)
{
project = project.AddMetadataReference(metadataRef);
}
}
}