From 3d89fb1d7c1f64b91f556ff4ec6565a5681eacf4 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Wed, 4 Oct 2017 02:24:04 +0100 Subject: [PATCH] fix-resource --- .../EditorService/EditorService.fsproj | 1 - fcs/samples/FscExe/FscExe.fsproj | 1 - .../FSharp.Build/FSharpEmbedResXSource.fs | 6 +- ...mple_VS2012_FSharp_ConsoleApp_net45.fsproj | 69 ------------------- 4 files changed, 2 insertions(+), 75 deletions(-) diff --git a/fcs/samples/EditorService/EditorService.fsproj b/fcs/samples/EditorService/EditorService.fsproj index 71df0f34d2c..1631ce2e86d 100644 --- a/fcs/samples/EditorService/EditorService.fsproj +++ b/fcs/samples/EditorService/EditorService.fsproj @@ -61,5 +61,4 @@ - \ No newline at end of file diff --git a/fcs/samples/FscExe/FscExe.fsproj b/fcs/samples/FscExe/FscExe.fsproj index 624f692136a..8849576d1ea 100644 --- a/fcs/samples/FscExe/FscExe.fsproj +++ b/fcs/samples/FscExe/FscExe.fsproj @@ -74,5 +74,4 @@ - \ No newline at end of file diff --git a/src/fsharp/FSharp.Build/FSharpEmbedResXSource.fs b/src/fsharp/FSharp.Build/FSharpEmbedResXSource.fs index 54045b642f0..1954d8f56cd 100644 --- a/src/fsharp/FSharp.Build/FSharpEmbedResXSource.fs +++ b/src/fsharp/FSharp.Build/FSharpEmbedResXSource.fs @@ -77,9 +77,7 @@ module internal {1} = | (true, true) -> sprintf " []\n let %s = \"%s\"" identifier name | (true, false) -> sprintf " let %s = \"%s\"" identifier name // the [] attribute can't be used for FSharp.Core | (false, _) -> - let isStringResource = match node.Attribute(xname "type") with - | null -> true - | _ -> false + let isStringResource = node.Attribute(xname "type") |> isNull match (isStringResource, generateGetObject) with | (true, _) -> sprintf " let %s() = GetString(\"%s\")" identifier name | (false, true) -> sprintf " let %s() = GetObject(\"%s\")" identifier name @@ -134,7 +132,7 @@ module internal {1} = if getBooleanMetadata "GenerateSource" false item then let moduleName = match item.GetMetadata("GeneratedModuleName") with - | null -> Path.GetFileNameWithoutExtension(item.ItemSpec) + | null | "" -> Path.GetFileNameWithoutExtension(item.ItemSpec) | value -> value let generateLegacy = getBooleanMetadata "GenerateLegacyCode" false item let generateLiteral = getBooleanMetadata "GenerateLiterals" true item diff --git a/tests/projects/Sample_VS2012_FSharp_ConsoleApp_net45_with_resource/Sample_VS2012_FSharp_ConsoleApp_net45/Sample_VS2012_FSharp_ConsoleApp_net45.fsproj b/tests/projects/Sample_VS2012_FSharp_ConsoleApp_net45_with_resource/Sample_VS2012_FSharp_ConsoleApp_net45/Sample_VS2012_FSharp_ConsoleApp_net45.fsproj index af8a37021ce..7cbff76e35d 100644 --- a/tests/projects/Sample_VS2012_FSharp_ConsoleApp_net45_with_resource/Sample_VS2012_FSharp_ConsoleApp_net45/Sample_VS2012_FSharp_ConsoleApp_net45.fsproj +++ b/tests/projects/Sample_VS2012_FSharp_ConsoleApp_net45_with_resource/Sample_VS2012_FSharp_ConsoleApp_net45/Sample_VS2012_FSharp_ConsoleApp_net45.fsproj @@ -1,73 +1,5 @@  - - - Debug - AnyCPU - 2.0 - b5b8c6fd-d77d-46e6-a9c5-5d78200668cc - Exe - Sample_VS2012_FSharp_ConsoleApp_net45 - Sample_VS2012_FSharp_ConsoleApp_net45 - v4.5 - Sample_VS2012_FSharp_ConsoleApp_net45 - 10.0.0 - False - - - True - full - False - False - bin\Debug\ - DEBUG;TRACE - 3 - AnyCPU - bin\Debug\Sample_VS2012_FSharp_ConsoleApp_net45.xml - true - - - pdbonly - True - True - bin\Release\ - TRACE - 3 - AnyCPU - bin\Release\Sample_VS2012_FSharp_ConsoleApp_net45.xml - true - False - - - - - - - - - - - - - - 11 - - - - - - - - - PreserveNewest - - Debug @@ -173,6 +105,5 @@ - \ No newline at end of file