Skip to content

Commit

Permalink
Merge pull request #315 from OmniSharp/fix314
Browse files Browse the repository at this point in the history
don't expect AllowUnsafeBlocks and DefineConstants to be in all csproj files
  • Loading branch information
nosami committed Oct 8, 2015
2 parents 8949a79 + 4fa79aa commit 9204b2e
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/OmniSharp/MSBuild/ProjectFile/ProjectFileInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,13 @@ public static ProjectFileInfo Create(MSBuildOptions options, ILogger logger, str
.Select(p => Path.GetFullPath(Path.Combine(projectFileInfo.ProjectDirectory, p.FinalItemSpec)))
.ToList();

var allowUnsafe = properties["AllowUnsafeBlocks"].FinalValue;
var allowUnsafe = properties.GetPropertyValue("AllowUnsafeBlocks");
if (!string.IsNullOrWhiteSpace(allowUnsafe))
{
projectFileInfo.AllowUnsafe = Convert.ToBoolean(allowUnsafe);
}

var defineConstants = properties["DefineConstants"].FinalValue;
var defineConstants = properties.GetPropertyValue("DefineConstants");
if (!string.IsNullOrWhiteSpace(defineConstants))
{
projectFileInfo.DefineConstants = defineConstants.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries).Distinct().ToList();
Expand Down Expand Up @@ -241,4 +241,16 @@ public static ProjectFileInfo Create(MSBuildOptions options, ILogger logger, str
return null;
}
}

#if DNX451
static class DictionaryExt
{
public static string GetPropertyValue(this Dictionary<string, BuildProperty> dict, string key)
{
return dict.ContainsKey(key)
? dict[key].FinalValue
: null;
}
}
#endif
}

0 comments on commit 9204b2e

Please sign in to comment.