Skip to content

Commit fff7e57

Browse files
committed
Merge pull request #523 from rneatherway/cracking/quote-project-file
Project cracking: spaces in file paths
2 parents b690a1d + 0462bc3 commit fff7e57

File tree

3 files changed

+87
-1
lines changed

3 files changed

+87
-1
lines changed

src/fsharp/FSharp.Compiler.Service.ProjectCracker/ProjectCracker.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type ProjectCracker =
2828
UnresolvedReferences = None }
2929

3030
let arguments = new StringBuilder()
31-
arguments.Append(projectFileName) |> ignore
31+
arguments.Append('"').Append(projectFileName).Append('"') |> ignore
3232
arguments.Append(' ').Append(enableLogging.ToString()) |> ignore
3333
for k, v in properties do
3434
arguments.Append(' ').Append(k).Append(' ').Append(v) |> ignore

tests/service/ProjectOptionsTests.fs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,5 +398,14 @@ let ``Project file parsing -- project file contains project reference to out-of-
398398
// Check the reference is to a debug DLL
399399
references |> should contain ("TestTP.dll", "Debug")
400400

401+
[<Test>]
402+
let ``Project file parsing -- space in file name``() =
403+
let p = ProjectCracker.GetProjectOptionsFromProjectFile(__SOURCE_DIRECTORY__ + @"/data/Space in name.fsproj")
404+
405+
p.OtherOptions
406+
|> getCompiledFilenames
407+
|> set
408+
|> should equal (set [ "Test2File1.fs"; "Test2File2.fs" ])
409+
401410
#endif
402411

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
6+
<ProductVersion>8.0.30703</ProductVersion>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>{116cc2f9-f987-4b3d-915a-34cac04a73db}</ProjectGuid>
9+
<OutputType>Exe</OutputType>
10+
<RootNamespace>Test2</RootNamespace>
11+
<AssemblyName>Test2</AssemblyName>
12+
<Name>Test2</Name>
13+
<UsePartialTypes>False</UsePartialTypes>
14+
<TargetFSharpCoreVersion>4.3.0.0</TargetFSharpCoreVersion>
15+
<MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
16+
</PropertyGroup>
17+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
18+
<DebugSymbols>True</DebugSymbols>
19+
<DebugType>full</DebugType>
20+
<Optimize>False</Optimize>
21+
<Tailcalls>False</Tailcalls>
22+
<OutputPath>Test2\bin\Debug\</OutputPath>
23+
<DefineConstants>DEBUG;TRACE</DefineConstants>
24+
<WarningLevel>3</WarningLevel>
25+
<PlatformTarget>x86</PlatformTarget>
26+
<DocumentationFile>bin\Debug\Test2.xml</DocumentationFile>
27+
</PropertyGroup>
28+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
29+
<DebugType>pdbonly</DebugType>
30+
<Optimize>True</Optimize>
31+
<Tailcalls>True</Tailcalls>
32+
<OutputPath>Test2\bin\Release\</OutputPath>
33+
<DefineConstants>TRACE</DefineConstants>
34+
<WarningLevel>3</WarningLevel>
35+
<PlatformTarget>x86</PlatformTarget>
36+
<DocumentationFile>bin\Release\Test2.xml</DocumentationFile>
37+
<DebugSymbols>False</DebugSymbols>
38+
</PropertyGroup>
39+
<ItemGroup>
40+
<Reference Include="FSharp.Core, Version=$(TargetFSharpCoreVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
41+
<Private>True</Private>
42+
</Reference>
43+
<Reference Include="mscorlib" />
44+
<Reference Include="System" />
45+
<Reference Include="System.Core" />
46+
</ItemGroup>
47+
<ItemGroup>
48+
<Compile Include="Test2File2.fs" />
49+
<Compile Include="Test2File1.fs" />
50+
</ItemGroup>
51+
<ItemGroup>
52+
<ProjectReference Include="Test1.fsproj">
53+
<Project>{116cc2f9-f987-4b3d-915a-34cac04a73da}</Project>
54+
<Name>Test1</Name>
55+
</ProjectReference>
56+
</ItemGroup>
57+
<Choose>
58+
<When Condition="'$(VisualStudioVersion)' == '11.0'">
59+
<PropertyGroup>
60+
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
61+
</PropertyGroup>
62+
</When>
63+
<Otherwise>
64+
<PropertyGroup>
65+
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath>
66+
</PropertyGroup>
67+
</Otherwise>
68+
</Choose>
69+
<Import Project="$(FSharpTargetsPath)" Condition="Exists('$(FSharpTargetsPath)')" />
70+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
71+
Other similar extension points exist, see Microsoft.Common.targets.
72+
<Target Name="BeforeBuild">
73+
</Target>
74+
<Target Name="AfterBuild">
75+
</Target>
76+
-->
77+
</Project>

0 commit comments

Comments
 (0)