Skip to content

Commit d7e6fc8

Browse files
committed
Merge pull request #262 from rneatherway/referenced-csproj-fix
Fix for multilanguage projects in project cracker
2 parents a83190e + b9737f8 commit d7e6fc8

File tree

5 files changed

+243
-1
lines changed

5 files changed

+243
-1
lines changed

src/fsharp/vs/service.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2812,7 +2812,8 @@ type FSharpChecker(projectCacheSize, keepAssemblyContents, keepAllBackgroundReso
28122812
let projectOptions = ic.GetProjectOptionsFromCommandLineArgs(projectFileName, args, ?loadedTimeStamp=loadedTimeStamp)
28132813
let referencedProjectOptions =
28142814
[| for file in parsedProject.ProjectReferences do
2815-
yield file, ic.GetProjectOptionsFromProjectFile(file, ?properties=properties, ?loadedTimeStamp=loadedTimeStamp) |]
2815+
if Path.GetExtension(file) = ".fsproj" then
2816+
yield file, ic.GetProjectOptionsFromProjectFile(file, ?properties=properties, ?loadedTimeStamp=loadedTimeStamp) |]
28162817

28172818
{ projectOptions
28182819
with ReferencedProjects = referencedProjectOptions }

tests/service/ProjectOptionsTests.fs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,5 +224,17 @@ let ``Project file parsing -- project references``() =
224224
fst options.ReferencedProjects.[0] |> should endWith "Test1.fsproj"
225225
snd options.ReferencedProjects.[0] |> should equal (checker.GetProjectOptionsFromProjectFile(f1))
226226

227+
[<Test>]
228+
let ``Project file parsing -- multi language project``() =
229+
let f = normalizePath (__SOURCE_DIRECTORY__ + @"/data/MultiLanguageProject/ConsoleApplication1.fsproj")
230+
231+
let options = checker.GetProjectOptionsFromProjectFile(f)
232+
233+
options.ReferencedProjects |> should haveLength 1
234+
options.ReferencedProjects.[0] |> fst |> should endWith "ConsoleApplication2.fsproj"
235+
236+
checkOption options.OtherOptions "ConsoleApplication2.exe"
237+
checkOption options.OtherOptions "ConsoleApplication3.exe"
238+
227239
#endif
228240

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>252a5848-1864-43fd-8fde-aab146410dee</ProjectGuid>
9+
<OutputType>Exe</OutputType>
10+
<RootNamespace>ConsoleApplication1</RootNamespace>
11+
<AssemblyName>ConsoleApplication1</AssemblyName>
12+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14+
<TargetFSharpCoreVersion>4.3.1.0</TargetFSharpCoreVersion>
15+
<Name>ConsoleApplication1</Name>
16+
</PropertyGroup>
17+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
18+
<DebugSymbols>true</DebugSymbols>
19+
<DebugType>full</DebugType>
20+
<Optimize>false</Optimize>
21+
<Tailcalls>false</Tailcalls>
22+
<OutputPath>bin\Debug\</OutputPath>
23+
<DefineConstants>DEBUG;TRACE</DefineConstants>
24+
<WarningLevel>3</WarningLevel>
25+
<PlatformTarget>AnyCPU</PlatformTarget>
26+
<DocumentationFile>bin\Debug\ConsoleApplication1.XML</DocumentationFile>
27+
<Prefer32Bit>true</Prefer32Bit>
28+
</PropertyGroup>
29+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
30+
<DebugType>pdbonly</DebugType>
31+
<Optimize>true</Optimize>
32+
<Tailcalls>true</Tailcalls>
33+
<OutputPath>bin\Release\</OutputPath>
34+
<DefineConstants>TRACE</DefineConstants>
35+
<WarningLevel>3</WarningLevel>
36+
<PlatformTarget>AnyCPU</PlatformTarget>
37+
<DocumentationFile>bin\Release\ConsoleApplication1.XML</DocumentationFile>
38+
<Prefer32Bit>true</Prefer32Bit>
39+
</PropertyGroup>
40+
<ItemGroup>
41+
<Reference Include="mscorlib" />
42+
<Reference Include="FSharp.Core, Version=$(TargetFSharpCoreVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
43+
<Private>True</Private>
44+
</Reference>
45+
<Reference Include="System" />
46+
<Reference Include="System.Core" />
47+
<Reference Include="System.Numerics" />
48+
</ItemGroup>
49+
<ItemGroup>
50+
<Compile Include="Program.fs" />
51+
<None Include="App.config" />
52+
</ItemGroup>
53+
<ItemGroup>
54+
<ProjectReference Include="ConsoleApplication2.fsproj">
55+
<Name>ConsoleApplication2</Name>
56+
<Project>{31b31546-8348-4be1-9890-1f17ba70fd21}</Project>
57+
<Private>True</Private>
58+
</ProjectReference>
59+
<ProjectReference Include="ConsoleApplication3.csproj">
60+
<Name>ConsoleApplication3</Name>
61+
<Project>{24795688-ce64-4475-a326-3175f1a40f68}</Project>
62+
<Private>True</Private>
63+
</ProjectReference>
64+
</ItemGroup>
65+
<PropertyGroup>
66+
<MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
67+
</PropertyGroup>
68+
<Choose>
69+
<When Condition="'$(VisualStudioVersion)' == '11.0'">
70+
<PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets')">
71+
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
72+
</PropertyGroup>
73+
</When>
74+
<Otherwise>
75+
<PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets')">
76+
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath>
77+
</PropertyGroup>
78+
</Otherwise>
79+
</Choose>
80+
<Import Project="$(FSharpTargetsPath)" />
81+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
82+
Other similar extension points exist, see Microsoft.Common.targets.
83+
<Target Name="BeforeBuild">
84+
</Target>
85+
<Target Name="AfterBuild">
86+
</Target>
87+
-->
88+
</Project>
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>31b31546-8348-4be1-9890-1f17ba70fd21</ProjectGuid>
9+
<OutputType>Exe</OutputType>
10+
<RootNamespace>ConsoleApplication2</RootNamespace>
11+
<AssemblyName>ConsoleApplication2</AssemblyName>
12+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14+
<TargetFSharpCoreVersion>4.3.1.0</TargetFSharpCoreVersion>
15+
<Name>ConsoleApplication2</Name>
16+
</PropertyGroup>
17+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
18+
<DebugSymbols>true</DebugSymbols>
19+
<DebugType>full</DebugType>
20+
<Optimize>false</Optimize>
21+
<Tailcalls>false</Tailcalls>
22+
<OutputPath>bin\Debug\</OutputPath>
23+
<DefineConstants>DEBUG;TRACE</DefineConstants>
24+
<WarningLevel>3</WarningLevel>
25+
<PlatformTarget>AnyCPU</PlatformTarget>
26+
<DocumentationFile>bin\Debug\ConsoleApplication2.XML</DocumentationFile>
27+
<Prefer32Bit>true</Prefer32Bit>
28+
</PropertyGroup>
29+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
30+
<DebugType>pdbonly</DebugType>
31+
<Optimize>true</Optimize>
32+
<Tailcalls>true</Tailcalls>
33+
<OutputPath>bin\Release\</OutputPath>
34+
<DefineConstants>TRACE</DefineConstants>
35+
<WarningLevel>3</WarningLevel>
36+
<PlatformTarget>AnyCPU</PlatformTarget>
37+
<DocumentationFile>bin\Release\ConsoleApplication2.XML</DocumentationFile>
38+
<Prefer32Bit>true</Prefer32Bit>
39+
</PropertyGroup>
40+
<ItemGroup>
41+
<Reference Include="mscorlib" />
42+
<Reference Include="FSharp.Core, Version=$(TargetFSharpCoreVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
43+
<Private>True</Private>
44+
</Reference>
45+
<Reference Include="System" />
46+
<Reference Include="System.Core" />
47+
<Reference Include="System.Numerics" />
48+
</ItemGroup>
49+
<ItemGroup>
50+
<Compile Include="Program.fs" />
51+
<None Include="App.config" />
52+
</ItemGroup>
53+
<ItemGroup>
54+
<ProjectReference Include="ConsoleApplication3.csproj">
55+
<Name>ConsoleApplication3</Name>
56+
<Project>{24795688-ce64-4475-a326-3175f1a40f68}</Project>
57+
<Private>True</Private>
58+
</ProjectReference>
59+
</ItemGroup>
60+
<PropertyGroup>
61+
<MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
62+
</PropertyGroup>
63+
<Choose>
64+
<When Condition="'$(VisualStudioVersion)' == '11.0'">
65+
<PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets')">
66+
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
67+
</PropertyGroup>
68+
</When>
69+
<Otherwise>
70+
<PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets')">
71+
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath>
72+
</PropertyGroup>
73+
</Otherwise>
74+
</Choose>
75+
<Import Project="$(FSharpTargetsPath)" />
76+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
77+
Other similar extension points exist, see Microsoft.Common.targets.
78+
<Target Name="BeforeBuild">
79+
</Target>
80+
<Target Name="AfterBuild">
81+
</Target>
82+
-->
83+
</Project>
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{24795688-CE64-4475-A326-3175F1A40F68}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>ConsoleApplication3</RootNamespace>
11+
<AssemblyName>ConsoleApplication3</AssemblyName>
12+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
</PropertyGroup>
15+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16+
<PlatformTarget>AnyCPU</PlatformTarget>
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>bin\Debug\</OutputPath>
21+
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
</PropertyGroup>
25+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26+
<PlatformTarget>AnyCPU</PlatformTarget>
27+
<DebugType>pdbonly</DebugType>
28+
<Optimize>true</Optimize>
29+
<OutputPath>bin\Release\</OutputPath>
30+
<DefineConstants>TRACE</DefineConstants>
31+
<ErrorReport>prompt</ErrorReport>
32+
<WarningLevel>4</WarningLevel>
33+
</PropertyGroup>
34+
<ItemGroup>
35+
<Reference Include="System" />
36+
<Reference Include="System.Core" />
37+
<Reference Include="System.Xml.Linq" />
38+
<Reference Include="System.Data.DataSetExtensions" />
39+
<Reference Include="Microsoft.CSharp" />
40+
<Reference Include="System.Data" />
41+
<Reference Include="System.Xml" />
42+
</ItemGroup>
43+
<ItemGroup>
44+
<Compile Include="Program.cs" />
45+
<Compile Include="Properties\AssemblyInfo.cs" />
46+
</ItemGroup>
47+
<ItemGroup>
48+
<None Include="App.config" />
49+
</ItemGroup>
50+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
51+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
52+
Other similar extension points exist, see Microsoft.Common.targets.
53+
<Target Name="BeforeBuild">
54+
</Target>
55+
<Target Name="AfterBuild">
56+
</Target>
57+
-->
58+
</Project>

0 commit comments

Comments
 (0)