diff --git a/src/fsharp/vs/service.fs b/src/fsharp/vs/service.fs index 9f7d17e54f..c108148a4b 100755 --- a/src/fsharp/vs/service.fs +++ b/src/fsharp/vs/service.fs @@ -2383,7 +2383,7 @@ type FSharpProjectFileInfo (fsprojFileName:string, ?properties, ?enableLogging) ] let references = - [ for i in project.GetEvaluatedItemsByName("ResolvedFiles") do + [ for i in project.GetEvaluatedItemsByName("ReferencePath") do yield i.FinalItemSpec for fsproj in projectReferences do match (try let p' = projectFromFile fsproj diff --git a/tests/service/ProjectOptionsTests.fs b/tests/service/ProjectOptionsTests.fs index 98888213e2..b83e12d822 100644 --- a/tests/service/ProjectOptionsTests.fs +++ b/tests/service/ProjectOptionsTests.fs @@ -236,5 +236,126 @@ let ``Project file parsing -- multi language project``() = checkOption options.OtherOptions "ConsoleApplication2.exe" checkOption options.OtherOptions "ConsoleApplication3.exe" +[] +let ``Project file parsing -- PCL profile7 project``() = + let f = normalizePath (__SOURCE_DIRECTORY__ + @"../../projects/Sample_VS2013_FSharp_Portable_Library_net45/Sample_VS2013_FSharp_Portable_Library_net45.fsproj") + + let options = checker.GetProjectOptionsFromProjectFile(f) + let references = + options.OtherOptions + |> Array.choose (fun o -> if o.StartsWith("-r:") then o.[3..] |> (Path.GetFileName >> Some) else None) + |> Set.ofArray + references + |> shouldEqual + (set [|"FSharp.Core.dll"; "Microsoft.CSharp.dll"; "Microsoft.VisualBasic.dll"; + "System.Collections.Concurrent.dll"; "System.Collections.dll"; + "System.ComponentModel.Annotations.dll"; + "System.ComponentModel.DataAnnotations.dll"; + "System.ComponentModel.EventBasedAsync.dll"; "System.ComponentModel.dll"; + "System.Core.dll"; "System.Diagnostics.Contracts.dll"; + "System.Diagnostics.Debug.dll"; "System.Diagnostics.Tools.dll"; + "System.Diagnostics.Tracing.dll"; "System.Dynamic.Runtime.dll"; + "System.Globalization.dll"; "System.IO.Compression.dll"; "System.IO.dll"; + "System.Linq.Expressions.dll"; "System.Linq.Parallel.dll"; + "System.Linq.Queryable.dll"; "System.Linq.dll"; "System.Net.Http.dll"; + "System.Net.NetworkInformation.dll"; "System.Net.Primitives.dll"; + "System.Net.Requests.dll"; "System.Net.dll"; "System.Numerics.dll"; + "System.ObjectModel.dll"; "System.Reflection.Context.dll"; + "System.Reflection.Extensions.dll"; "System.Reflection.Primitives.dll"; + "System.Reflection.dll"; "System.Resources.ResourceManager.dll"; + "System.Runtime.Extensions.dll"; + "System.Runtime.InteropServices.WindowsRuntime.dll"; + "System.Runtime.InteropServices.dll"; "System.Runtime.Numerics.dll"; + "System.Runtime.Serialization.Json.dll"; + "System.Runtime.Serialization.Primitives.dll"; + "System.Runtime.Serialization.Xml.dll"; "System.Runtime.Serialization.dll"; + "System.Runtime.dll"; "System.Security.Principal.dll"; + "System.ServiceModel.Duplex.dll"; "System.ServiceModel.Http.dll"; + "System.ServiceModel.NetTcp.dll"; "System.ServiceModel.Primitives.dll"; + "System.ServiceModel.Security.dll"; "System.ServiceModel.Web.dll"; + "System.ServiceModel.dll"; "System.Text.Encoding.Extensions.dll"; + "System.Text.Encoding.dll"; "System.Text.RegularExpressions.dll"; + "System.Threading.Tasks.Parallel.dll"; "System.Threading.Tasks.dll"; + "System.Threading.dll"; "System.Windows.dll"; "System.Xml.Linq.dll"; + "System.Xml.ReaderWriter.dll"; "System.Xml.Serialization.dll"; + "System.Xml.XDocument.dll"; "System.Xml.XmlSerializer.dll"; "System.Xml.dll"; + "System.dll"; "mscorlib.dll"|]) + + checkOption options.OtherOptions "--targetprofile:netcore" + +[] +let ``Project file parsing -- PCL profile78 project``() = + let f = normalizePath (__SOURCE_DIRECTORY__ + @"../../projects/Sample_VS2013_FSharp_Portable_Library_net451_adjusted_to_profile78/Sample_VS2013_FSharp_Portable_Library_net451.fsproj") + + let options = checker.GetProjectOptionsFromProjectFile(f) + let references = + options.OtherOptions + |> Array.choose (fun o -> if o.StartsWith("-r:") then o.[3..] |> (Path.GetFileName >> Some) else None) + |> Set.ofArray + references + |> shouldEqual + (set [|"FSharp.Core.dll"; "Microsoft.CSharp.dll"; "System.Collections.dll"; + "System.ComponentModel.EventBasedAsync.dll"; "System.ComponentModel.dll"; + "System.Core.dll"; "System.Diagnostics.Contracts.dll"; + "System.Diagnostics.Debug.dll"; "System.Diagnostics.Tools.dll"; + "System.Dynamic.Runtime.dll"; "System.Globalization.dll"; "System.IO.dll"; + "System.Linq.Expressions.dll"; "System.Linq.Queryable.dll"; "System.Linq.dll"; + "System.Net.NetworkInformation.dll"; "System.Net.Primitives.dll"; + "System.Net.Requests.dll"; "System.Net.dll"; "System.ObjectModel.dll"; + "System.Reflection.Extensions.dll"; "System.Reflection.Primitives.dll"; + "System.Reflection.dll"; "System.Resources.ResourceManager.dll"; + "System.Runtime.Extensions.dll"; + "System.Runtime.InteropServices.WindowsRuntime.dll"; + "System.Runtime.Serialization.Json.dll"; + "System.Runtime.Serialization.Primitives.dll"; + "System.Runtime.Serialization.Xml.dll"; "System.Runtime.Serialization.dll"; + "System.Runtime.dll"; "System.Security.Principal.dll"; + "System.ServiceModel.Http.dll"; "System.ServiceModel.Primitives.dll"; + "System.ServiceModel.Security.dll"; "System.ServiceModel.Web.dll"; + "System.ServiceModel.dll"; "System.Text.Encoding.Extensions.dll"; + "System.Text.Encoding.dll"; "System.Text.RegularExpressions.dll"; + "System.Threading.Tasks.dll"; "System.Threading.dll"; "System.Windows.dll"; + "System.Xml.Linq.dll"; "System.Xml.ReaderWriter.dll"; + "System.Xml.Serialization.dll"; "System.Xml.XDocument.dll"; + "System.Xml.XmlSerializer.dll"; "System.Xml.dll"; "System.dll"; "mscorlib.dll"|]) + + checkOption options.OtherOptions "--targetprofile:netcore" + +[] +let ``Project file parsing -- PCL profile259 project``() = + let f = normalizePath (__SOURCE_DIRECTORY__ + @"../../projects/Sample_VS2013_FSharp_Portable_Library_net451_adjusted_to_profile259/Sample_VS2013_FSharp_Portable_Library_net451.fsproj") + + let options = checker.GetProjectOptionsFromProjectFile(f) + let references = + options.OtherOptions + |> Array.choose (fun o -> if o.StartsWith("-r:") then o.[3..] |> (Path.GetFileName >> Some) else None) + |> Set.ofArray + references + |> shouldEqual + (set [|"FSharp.Core.dll"; "Microsoft.CSharp.dll"; "System.Collections.dll"; + "System.ComponentModel.EventBasedAsync.dll"; "System.ComponentModel.dll"; + "System.Core.dll"; "System.Diagnostics.Contracts.dll"; + "System.Diagnostics.Debug.dll"; "System.Diagnostics.Tools.dll"; + "System.Dynamic.Runtime.dll"; "System.Globalization.dll"; "System.IO.dll"; + "System.Linq.Expressions.dll"; "System.Linq.Queryable.dll"; "System.Linq.dll"; + "System.Net.NetworkInformation.dll"; "System.Net.Primitives.dll"; + "System.Net.Requests.dll"; "System.Net.dll"; "System.ObjectModel.dll"; + "System.Reflection.Extensions.dll"; "System.Reflection.Primitives.dll"; + "System.Reflection.dll"; "System.Resources.ResourceManager.dll"; + "System.Runtime.Extensions.dll"; + "System.Runtime.InteropServices.WindowsRuntime.dll"; + "System.Runtime.Serialization.Json.dll"; + "System.Runtime.Serialization.Primitives.dll"; + "System.Runtime.Serialization.Xml.dll"; "System.Runtime.Serialization.dll"; + "System.Runtime.dll"; "System.Security.Principal.dll"; + "System.ServiceModel.Web.dll"; "System.Text.Encoding.Extensions.dll"; + "System.Text.Encoding.dll"; "System.Text.RegularExpressions.dll"; + "System.Threading.Tasks.dll"; "System.Threading.dll"; "System.Windows.dll"; + "System.Xml.Linq.dll"; "System.Xml.ReaderWriter.dll"; + "System.Xml.Serialization.dll"; "System.Xml.XDocument.dll"; + "System.Xml.XmlSerializer.dll"; "System.Xml.dll"; "System.dll"; "mscorlib.dll"|]) + + checkOption options.OtherOptions "--targetprofile:netcore" + #endif