Skip to content

Commit ed57410

Browse files
committed
Merge pull request #330 from 7sharp9/pclfix
Added Fix to allow implicit PCL references to be retrieved from FSharpProjectFileInfo
2 parents e33d597 + 3743cd3 commit ed57410

File tree

2 files changed

+122
-1
lines changed

2 files changed

+122
-1
lines changed

src/fsharp/vs/service.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2383,7 +2383,7 @@ type FSharpProjectFileInfo (fsprojFileName:string, ?properties, ?enableLogging)
23832383
]
23842384

23852385
let references =
2386-
[ for i in project.GetEvaluatedItemsByName("ResolvedFiles") do
2386+
[ for i in project.GetEvaluatedItemsByName("ReferencePath") do
23872387
yield i.FinalItemSpec
23882388
for fsproj in projectReferences do
23892389
match (try let p' = projectFromFile fsproj

tests/service/ProjectOptionsTests.fs

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,5 +236,126 @@ let ``Project file parsing -- multi language project``() =
236236
checkOption options.OtherOptions "ConsoleApplication2.exe"
237237
checkOption options.OtherOptions "ConsoleApplication3.exe"
238238

239+
[<Test>]
240+
let ``Project file parsing -- PCL profile7 project``() =
241+
let f = normalizePath (__SOURCE_DIRECTORY__ + @"../../projects/Sample_VS2013_FSharp_Portable_Library_net45/Sample_VS2013_FSharp_Portable_Library_net45.fsproj")
242+
243+
let options = checker.GetProjectOptionsFromProjectFile(f)
244+
let references =
245+
options.OtherOptions
246+
|> Array.choose (fun o -> if o.StartsWith("-r:") then o.[3..] |> (Path.GetFileName >> Some) else None)
247+
|> Set.ofArray
248+
references
249+
|> shouldEqual
250+
(set [|"FSharp.Core.dll"; "Microsoft.CSharp.dll"; "Microsoft.VisualBasic.dll";
251+
"System.Collections.Concurrent.dll"; "System.Collections.dll";
252+
"System.ComponentModel.Annotations.dll";
253+
"System.ComponentModel.DataAnnotations.dll";
254+
"System.ComponentModel.EventBasedAsync.dll"; "System.ComponentModel.dll";
255+
"System.Core.dll"; "System.Diagnostics.Contracts.dll";
256+
"System.Diagnostics.Debug.dll"; "System.Diagnostics.Tools.dll";
257+
"System.Diagnostics.Tracing.dll"; "System.Dynamic.Runtime.dll";
258+
"System.Globalization.dll"; "System.IO.Compression.dll"; "System.IO.dll";
259+
"System.Linq.Expressions.dll"; "System.Linq.Parallel.dll";
260+
"System.Linq.Queryable.dll"; "System.Linq.dll"; "System.Net.Http.dll";
261+
"System.Net.NetworkInformation.dll"; "System.Net.Primitives.dll";
262+
"System.Net.Requests.dll"; "System.Net.dll"; "System.Numerics.dll";
263+
"System.ObjectModel.dll"; "System.Reflection.Context.dll";
264+
"System.Reflection.Extensions.dll"; "System.Reflection.Primitives.dll";
265+
"System.Reflection.dll"; "System.Resources.ResourceManager.dll";
266+
"System.Runtime.Extensions.dll";
267+
"System.Runtime.InteropServices.WindowsRuntime.dll";
268+
"System.Runtime.InteropServices.dll"; "System.Runtime.Numerics.dll";
269+
"System.Runtime.Serialization.Json.dll";
270+
"System.Runtime.Serialization.Primitives.dll";
271+
"System.Runtime.Serialization.Xml.dll"; "System.Runtime.Serialization.dll";
272+
"System.Runtime.dll"; "System.Security.Principal.dll";
273+
"System.ServiceModel.Duplex.dll"; "System.ServiceModel.Http.dll";
274+
"System.ServiceModel.NetTcp.dll"; "System.ServiceModel.Primitives.dll";
275+
"System.ServiceModel.Security.dll"; "System.ServiceModel.Web.dll";
276+
"System.ServiceModel.dll"; "System.Text.Encoding.Extensions.dll";
277+
"System.Text.Encoding.dll"; "System.Text.RegularExpressions.dll";
278+
"System.Threading.Tasks.Parallel.dll"; "System.Threading.Tasks.dll";
279+
"System.Threading.dll"; "System.Windows.dll"; "System.Xml.Linq.dll";
280+
"System.Xml.ReaderWriter.dll"; "System.Xml.Serialization.dll";
281+
"System.Xml.XDocument.dll"; "System.Xml.XmlSerializer.dll"; "System.Xml.dll";
282+
"System.dll"; "mscorlib.dll"|])
283+
284+
checkOption options.OtherOptions "--targetprofile:netcore"
285+
286+
[<Test>]
287+
let ``Project file parsing -- PCL profile78 project``() =
288+
let f = normalizePath (__SOURCE_DIRECTORY__ + @"../../projects/Sample_VS2013_FSharp_Portable_Library_net451_adjusted_to_profile78/Sample_VS2013_FSharp_Portable_Library_net451.fsproj")
289+
290+
let options = checker.GetProjectOptionsFromProjectFile(f)
291+
let references =
292+
options.OtherOptions
293+
|> Array.choose (fun o -> if o.StartsWith("-r:") then o.[3..] |> (Path.GetFileName >> Some) else None)
294+
|> Set.ofArray
295+
references
296+
|> shouldEqual
297+
(set [|"FSharp.Core.dll"; "Microsoft.CSharp.dll"; "System.Collections.dll";
298+
"System.ComponentModel.EventBasedAsync.dll"; "System.ComponentModel.dll";
299+
"System.Core.dll"; "System.Diagnostics.Contracts.dll";
300+
"System.Diagnostics.Debug.dll"; "System.Diagnostics.Tools.dll";
301+
"System.Dynamic.Runtime.dll"; "System.Globalization.dll"; "System.IO.dll";
302+
"System.Linq.Expressions.dll"; "System.Linq.Queryable.dll"; "System.Linq.dll";
303+
"System.Net.NetworkInformation.dll"; "System.Net.Primitives.dll";
304+
"System.Net.Requests.dll"; "System.Net.dll"; "System.ObjectModel.dll";
305+
"System.Reflection.Extensions.dll"; "System.Reflection.Primitives.dll";
306+
"System.Reflection.dll"; "System.Resources.ResourceManager.dll";
307+
"System.Runtime.Extensions.dll";
308+
"System.Runtime.InteropServices.WindowsRuntime.dll";
309+
"System.Runtime.Serialization.Json.dll";
310+
"System.Runtime.Serialization.Primitives.dll";
311+
"System.Runtime.Serialization.Xml.dll"; "System.Runtime.Serialization.dll";
312+
"System.Runtime.dll"; "System.Security.Principal.dll";
313+
"System.ServiceModel.Http.dll"; "System.ServiceModel.Primitives.dll";
314+
"System.ServiceModel.Security.dll"; "System.ServiceModel.Web.dll";
315+
"System.ServiceModel.dll"; "System.Text.Encoding.Extensions.dll";
316+
"System.Text.Encoding.dll"; "System.Text.RegularExpressions.dll";
317+
"System.Threading.Tasks.dll"; "System.Threading.dll"; "System.Windows.dll";
318+
"System.Xml.Linq.dll"; "System.Xml.ReaderWriter.dll";
319+
"System.Xml.Serialization.dll"; "System.Xml.XDocument.dll";
320+
"System.Xml.XmlSerializer.dll"; "System.Xml.dll"; "System.dll"; "mscorlib.dll"|])
321+
322+
checkOption options.OtherOptions "--targetprofile:netcore"
323+
324+
[<Test>]
325+
let ``Project file parsing -- PCL profile259 project``() =
326+
let f = normalizePath (__SOURCE_DIRECTORY__ + @"../../projects/Sample_VS2013_FSharp_Portable_Library_net451_adjusted_to_profile259/Sample_VS2013_FSharp_Portable_Library_net451.fsproj")
327+
328+
let options = checker.GetProjectOptionsFromProjectFile(f)
329+
let references =
330+
options.OtherOptions
331+
|> Array.choose (fun o -> if o.StartsWith("-r:") then o.[3..] |> (Path.GetFileName >> Some) else None)
332+
|> Set.ofArray
333+
references
334+
|> shouldEqual
335+
(set [|"FSharp.Core.dll"; "Microsoft.CSharp.dll"; "System.Collections.dll";
336+
"System.ComponentModel.EventBasedAsync.dll"; "System.ComponentModel.dll";
337+
"System.Core.dll"; "System.Diagnostics.Contracts.dll";
338+
"System.Diagnostics.Debug.dll"; "System.Diagnostics.Tools.dll";
339+
"System.Dynamic.Runtime.dll"; "System.Globalization.dll"; "System.IO.dll";
340+
"System.Linq.Expressions.dll"; "System.Linq.Queryable.dll"; "System.Linq.dll";
341+
"System.Net.NetworkInformation.dll"; "System.Net.Primitives.dll";
342+
"System.Net.Requests.dll"; "System.Net.dll"; "System.ObjectModel.dll";
343+
"System.Reflection.Extensions.dll"; "System.Reflection.Primitives.dll";
344+
"System.Reflection.dll"; "System.Resources.ResourceManager.dll";
345+
"System.Runtime.Extensions.dll";
346+
"System.Runtime.InteropServices.WindowsRuntime.dll";
347+
"System.Runtime.Serialization.Json.dll";
348+
"System.Runtime.Serialization.Primitives.dll";
349+
"System.Runtime.Serialization.Xml.dll"; "System.Runtime.Serialization.dll";
350+
"System.Runtime.dll"; "System.Security.Principal.dll";
351+
"System.ServiceModel.Web.dll"; "System.Text.Encoding.Extensions.dll";
352+
"System.Text.Encoding.dll"; "System.Text.RegularExpressions.dll";
353+
"System.Threading.Tasks.dll"; "System.Threading.dll"; "System.Windows.dll";
354+
"System.Xml.Linq.dll"; "System.Xml.ReaderWriter.dll";
355+
"System.Xml.Serialization.dll"; "System.Xml.XDocument.dll";
356+
"System.Xml.XmlSerializer.dll"; "System.Xml.dll"; "System.dll"; "mscorlib.dll"|])
357+
358+
checkOption options.OtherOptions "--targetprofile:netcore"
359+
239360
#endif
240361

0 commit comments

Comments
 (0)