Skip to content
This repository was archived by the owner on Apr 20, 2023. It is now read-only.

Commit e30fe29

Browse files
author
Peter Huene
committed
Fix project type GUIDs when adding projects to solution files.
This commit ensures the correct property (`ProjectTypeGuids`) is respected when adding a project to a solution file. Additionally, we now error if a project type GUID cannot be determined rather than incorrectly mapping to the C# project type. Enabled previously disabled tests that were waiting on upstream changes from MSBuild and F#. Fixes #5131. Fixes #7742.
1 parent 9cc2b7c commit e30fe29

File tree

28 files changed

+130
-189
lines changed

28 files changed

+130
-189
lines changed

TestAssets/TestProjects/SlnFileWithNoProjectReferencesAndFSharpProject/FSharpProject/App.config

Lines changed: 0 additions & 6 deletions
This file was deleted.

TestAssets/TestProjects/SlnFileWithNoProjectReferencesAndFSharpProject/FSharpProject/AssemblyInfo.fs

Lines changed: 0 additions & 41 deletions
This file was deleted.
Lines changed: 6 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,12 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="15.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')" />
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
43
<PropertyGroup>
5-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7-
<SchemaVersion>2.0</SchemaVersion>
8-
<ProjectGuid>52161bb2-18bf-4304-87e7-8d7f0c98ccf3</ProjectGuid>
94
<OutputType>Exe</OutputType>
10-
<RootNamespace>FSharpProject</RootNamespace>
11-
<AssemblyName>FSharpProject</AssemblyName>
12-
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
13-
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14-
<TargetFSharpCoreVersion>4.4.1.0</TargetFSharpCoreVersion>
15-
<Name>FSharpProject</Name>
5+
<TargetFramework>netcoreapp2.1</TargetFramework>
166
</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\$(Configuration)\</OutputPath>
23-
<DefineConstants>DEBUG;TRACE</DefineConstants>
24-
<WarningLevel>3</WarningLevel>
25-
<PlatformTarget>AnyCPU</PlatformTarget>
26-
<DocumentationFile>bin\$(Configuration)\$(AssemblyName).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\$(Configuration)\</OutputPath>
34-
<DefineConstants>TRACE</DefineConstants>
35-
<WarningLevel>3</WarningLevel>
36-
<PlatformTarget>AnyCPU</PlatformTarget>
37-
<DocumentationFile>bin\$(Configuration)\$(AssemblyName).XML</DocumentationFile>
38-
<Prefer32Bit>true</Prefer32Bit>
39-
</PropertyGroup>
40-
<PropertyGroup>
41-
<MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
42-
</PropertyGroup>
43-
<Choose>
44-
<When Condition="'$(VisualStudioVersion)' == '11.0'">
45-
<PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets')">
46-
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
47-
</PropertyGroup>
48-
</When>
49-
<Otherwise>
50-
<PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets')">
51-
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath>
52-
</PropertyGroup>
53-
</Otherwise>
54-
</Choose>
55-
<Import Project="$(FSharpTargetsPath)" />
7+
568
<ItemGroup>
57-
<Compile Include="AssemblyInfo.fs" />
589
<Compile Include="Program.fs" />
59-
<None Include="App.config" />
60-
<Content Include="packages.config" />
61-
</ItemGroup>
62-
<ItemGroup>
63-
<Reference Include="mscorlib" />
64-
<Reference Include="FSharp.Core, Version=$(TargetFSharpCoreVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
65-
<Private>True</Private>
66-
</Reference>
67-
<Reference Include="System" />
68-
<Reference Include="System.Core" />
69-
<Reference Include="System.Numerics" />
70-
<Reference Include="System.ValueTuple">
71-
<HintPath>..\packages\System.ValueTuple.4.0.0-rc3-24212-01\lib\netstandard1.1\System.ValueTuple.dll</HintPath>
72-
</Reference>
7310
</ItemGroup>
74-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
75-
Other similar extension points exist, see Microsoft.Common.targets.
76-
<Target Name="BeforeBuild">
77-
</Target>
78-
<Target Name="AfterBuild">
79-
</Target>
80-
-->
81-
</Project>
11+
12+
</Project>

TestAssets/TestProjects/SlnFileWithNoProjectReferencesAndFSharpProject/FSharpProject/packages.config

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.26006.2
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Global
7+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8+
Debug|Any CPU = Debug|Any CPU
9+
Debug|x64 = Debug|x64
10+
Debug|x86 = Debug|x86
11+
Release|Any CPU = Release|Any CPU
12+
Release|x64 = Release|x64
13+
Release|x86 = Release|x86
14+
EndGlobalSection
15+
GlobalSection(SolutionProperties) = preSolution
16+
HideSolutionNode = FALSE
17+
EndGlobalSection
18+
EndGlobal
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
</Project>
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
4-
<ProjectTypeGuid>{20E2F8CC-55AA-4705-B10F-7ABA6F107ECE};{130159A9-F047-44B3-88CF-0CF7F02ED50F}</ProjectTypeGuid>
4+
<ProjectTypeGuids>{20E2F8CC-55AA-4705-B10F-7ABA6F107ECE};{130159A9-F047-44B3-88CF-0CF7F02ED50F}</ProjectTypeGuids>
55
</PropertyGroup>
66
</Project>
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
4-
<ProjectTypeGuid>{130159A9-F047-44B3-88CF-0CF7F02ED50F}</ProjectTypeGuid>
4+
<ProjectTypeGuids>{130159A9-F047-44B3-88CF-0CF7F02ED50F}</ProjectTypeGuids>
55
</PropertyGroup>
66
</Project>

src/Microsoft.DotNet.Cli.Sln.Internal/ProjectTypeGuids.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ namespace Microsoft.DotNet.Cli.Sln.Internal
66
public static class ProjectTypeGuids
77
{
88
public const string CSharpProjectTypeGuid = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}";
9+
public const string FSharpProjectTypeGuid = "{F2A71F9B-5D33-465A-A702-920D77279786}";
10+
public const string VBProjectTypeGuid = "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}";
911
public const string SolutionFolderGuid = "{2150E333-8FDC-42A3-9474-1A3956D46DE8}";
1012
}
1113
}

src/dotnet/CommonLocalizableStrings.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119119
</resheader>
120120
<data name="UnsupportedProjectType" xml:space="preserve">
121-
<value>Unsupported project type. Please check with your sdk provider.</value>
121+
<value>Project '{0}' has an unknown project type and cannot be added to the solution file. Please contact your SDK provider for support.</value>
122122
</data>
123123
<data name="ProjectAlreadyHasAreference" xml:space="preserve">
124124
<value>Project already has a reference to `{0}`.</value>

0 commit comments

Comments
 (0)