From f2acb19cfc4435ef3a35e49aa625e2b20bcdd811 Mon Sep 17 00:00:00 2001 From: 7sharp9 Date: Wed, 8 Apr 2015 16:58:57 +0100 Subject: [PATCH 1/2] Added Fix to allow implicit PCL references to be retrieved Also added project tests for profile 7,78,259 --- src/fsharp/vs/service.fs | 2 +- tests/service/ProjectOptionsTests.fs | 118 +++++++++++++++++++++++++++ 2 files changed, 119 insertions(+), 1 deletion(-) 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..5ec8a02d96 100644 --- a/tests/service/ProjectOptionsTests.fs +++ b/tests/service/ProjectOptionsTests.fs @@ -236,5 +236,123 @@ 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) + references + |> shouldEqual + [|"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) + references + |> shouldEqual + [|"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) + references + |> shouldEqual + [|"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 From 3743cd37c6b3d0523904f6f859a5af3039253e70 Mon Sep 17 00:00:00 2001 From: 7sharp9 Date: Wed, 8 Apr 2015 18:14:56 +0100 Subject: [PATCH 2/2] Switched tests to use a set --- tests/service/ProjectOptionsTests.fs | 161 ++++++++++++++------------- 1 file changed, 82 insertions(+), 79 deletions(-) diff --git a/tests/service/ProjectOptionsTests.fs b/tests/service/ProjectOptionsTests.fs index 5ec8a02d96..b83e12d822 100644 --- a/tests/service/ProjectOptionsTests.fs +++ b/tests/service/ProjectOptionsTests.fs @@ -244,41 +244,42 @@ let ``Project file parsing -- PCL profile7 project``() = let references = options.OtherOptions |> Array.choose (fun o -> if o.StartsWith("-r:") then o.[3..] |> (Path.GetFileName >> Some) else None) + |> Set.ofArray references |> shouldEqual - [|"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"|] + (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" @@ -290,32 +291,33 @@ let ``Project file parsing -- PCL profile78 project``() = let references = options.OtherOptions |> Array.choose (fun o -> if o.StartsWith("-r:") then o.[3..] |> (Path.GetFileName >> Some) else None) + |> Set.ofArray references |> shouldEqual - [|"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"|] + (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" @@ -327,30 +329,31 @@ let ``Project file parsing -- PCL profile259 project``() = let references = options.OtherOptions |> Array.choose (fun o -> if o.StartsWith("-r:") then o.[3..] |> (Path.GetFileName >> Some) else None) + |> Set.ofArray references |> shouldEqual - [|"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"|] + (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"