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.
This commit is contained in:
parent
9cc2b7cd2f
commit
e30fe29aab
28 changed files with 130 additions and 189 deletions
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<configuration>
|
|
||||||
<startup>
|
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
|
||||||
</startup>
|
|
||||||
</configuration>
|
|
|
@ -1,41 +0,0 @@
|
||||||
namespace FSharpProject.AssemblyInfo
|
|
||||||
|
|
||||||
open System.Reflection
|
|
||||||
open System.Runtime.CompilerServices
|
|
||||||
open System.Runtime.InteropServices
|
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
|
||||||
// set of attributes. Change these attribute values to modify the information
|
|
||||||
// associated with an assembly.
|
|
||||||
[<assembly: AssemblyTitle("FSharpProject")>]
|
|
||||||
[<assembly: AssemblyDescription("")>]
|
|
||||||
[<assembly: AssemblyConfiguration("")>]
|
|
||||||
[<assembly: AssemblyCompany("")>]
|
|
||||||
[<assembly: AssemblyProduct("FSharpProject")>]
|
|
||||||
[<assembly: AssemblyCopyright("Copyright © 2016")>]
|
|
||||||
[<assembly: AssemblyTrademark("")>]
|
|
||||||
[<assembly: AssemblyCulture("")>]
|
|
||||||
|
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
|
||||||
// to COM components. If you need to access a type in this assembly from
|
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
|
||||||
[<assembly: ComVisible(false)>]
|
|
||||||
|
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|
||||||
[<assembly: Guid("52161bb2-18bf-4304-87e7-8d7f0c98ccf3")>]
|
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
|
||||||
//
|
|
||||||
// Major Version
|
|
||||||
// Minor Version
|
|
||||||
// Build Number
|
|
||||||
// Revision
|
|
||||||
//
|
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
|
||||||
// by using the '*' as shown below:
|
|
||||||
// [<assembly: AssemblyVersion("1.0.*")>]
|
|
||||||
[<assembly: AssemblyVersion("1.0.0.0")>]
|
|
||||||
[<assembly: AssemblyFileVersion("1.0.0.0")>]
|
|
||||||
|
|
||||||
do
|
|
||||||
()
|
|
|
@ -1,81 +1,12 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
|
||||||
<ProjectGuid>52161bb2-18bf-4304-87e7-8d7f0c98ccf3</ProjectGuid>
|
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<RootNamespace>FSharpProject</RootNamespace>
|
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||||
<AssemblyName>FSharpProject</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
|
||||||
<TargetFSharpCoreVersion>4.4.1.0</TargetFSharpCoreVersion>
|
|
||||||
<Name>FSharpProject</Name>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<Tailcalls>false</Tailcalls>
|
|
||||||
<OutputPath>bin\$(Configuration)\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<WarningLevel>3</WarningLevel>
|
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
|
||||||
<DocumentationFile>bin\$(Configuration)\$(AssemblyName).XML</DocumentationFile>
|
|
||||||
<Prefer32Bit>true</Prefer32Bit>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<Tailcalls>true</Tailcalls>
|
|
||||||
<OutputPath>bin\$(Configuration)\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<WarningLevel>3</WarningLevel>
|
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
|
||||||
<DocumentationFile>bin\$(Configuration)\$(AssemblyName).XML</DocumentationFile>
|
|
||||||
<Prefer32Bit>true</Prefer32Bit>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Choose>
|
|
||||||
<When Condition="'$(VisualStudioVersion)' == '11.0'">
|
|
||||||
<PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets')">
|
|
||||||
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
</When>
|
|
||||||
<Otherwise>
|
|
||||||
<PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets')">
|
|
||||||
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
</Otherwise>
|
|
||||||
</Choose>
|
|
||||||
<Import Project="$(FSharpTargetsPath)" />
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="AssemblyInfo.fs" />
|
|
||||||
<Compile Include="Program.fs" />
|
<Compile Include="Program.fs" />
|
||||||
<None Include="App.config" />
|
|
||||||
<Content Include="packages.config" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="mscorlib" />
|
|
||||||
<Reference Include="FSharp.Core, Version=$(TargetFSharpCoreVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<Private>True</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System" />
|
|
||||||
<Reference Include="System.Core" />
|
|
||||||
<Reference Include="System.Numerics" />
|
|
||||||
<Reference Include="System.ValueTuple">
|
|
||||||
<HintPath>..\packages\System.ValueTuple.4.0.0-rc3-24212-01\lib\netstandard1.1\System.ValueTuple.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
|
||||||
<Target Name="BeforeBuild">
|
|
||||||
</Target>
|
|
||||||
<Target Name="AfterBuild">
|
|
||||||
</Target>
|
|
||||||
-->
|
|
||||||
</Project>
|
</Project>
|
|
@ -1,4 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<packages>
|
|
||||||
<package id="System.ValueTuple" version="4.0.0-rc3-24212-01" targetFramework="net452" />
|
|
||||||
</packages>
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio 15
|
||||||
|
VisualStudioVersion = 15.0.26006.2
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
|
Debug|x86 = Debug|x86
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
Release|x64 = Release|x64
|
||||||
|
Release|x86 = Release|x86
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
|
@ -0,0 +1,3 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
</Project>
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ProjectTypeGuid>{20E2F8CC-55AA-4705-B10F-7ABA6F107ECE};{130159A9-F047-44B3-88CF-0CF7F02ED50F}</ProjectTypeGuid>
|
<ProjectTypeGuids>{20E2F8CC-55AA-4705-B10F-7ABA6F107ECE};{130159A9-F047-44B3-88CF-0CF7F02ED50F}</ProjectTypeGuids>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ProjectTypeGuid>{130159A9-F047-44B3-88CF-0CF7F02ED50F}</ProjectTypeGuid>
|
<ProjectTypeGuids>{130159A9-F047-44B3-88CF-0CF7F02ED50F}</ProjectTypeGuids>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -6,6 +6,8 @@ namespace Microsoft.DotNet.Cli.Sln.Internal
|
||||||
public static class ProjectTypeGuids
|
public static class ProjectTypeGuids
|
||||||
{
|
{
|
||||||
public const string CSharpProjectTypeGuid = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}";
|
public const string CSharpProjectTypeGuid = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}";
|
||||||
|
public const string FSharpProjectTypeGuid = "{F2A71F9B-5D33-465A-A702-920D77279786}";
|
||||||
|
public const string VBProjectTypeGuid = "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}";
|
||||||
public const string SolutionFolderGuid = "{2150E333-8FDC-42A3-9474-1A3956D46DE8}";
|
public const string SolutionFolderGuid = "{2150E333-8FDC-42A3-9474-1A3956D46DE8}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,7 @@
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<data name="UnsupportedProjectType" xml:space="preserve">
|
<data name="UnsupportedProjectType" xml:space="preserve">
|
||||||
<value>Unsupported project type. Please check with your sdk provider.</value>
|
<value>Project '{0}' has an unknown project type and cannot be added to the solution file. Please contact your SDK provider for support.</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ProjectAlreadyHasAreference" xml:space="preserve">
|
<data name="ProjectAlreadyHasAreference" xml:space="preserve">
|
||||||
<value>Project already has a reference to `{0}`.</value>
|
<value>Project already has a reference to `{0}`.</value>
|
||||||
|
|
|
@ -20,31 +20,9 @@ namespace Microsoft.DotNet.Tools.Common
|
||||||
return projectGuid.ToString("B").ToUpper();
|
return projectGuid.ToString("B").ToUpper();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetProjectTypeGuid(this ProjectInstance projectInstance)
|
public static string GetDefaultProjectTypeGuid(this ProjectInstance projectInstance)
|
||||||
{
|
{
|
||||||
string projectTypeGuid = null;
|
return projectInstance.GetPropertyValue("DefaultProjectTypeGuid");
|
||||||
|
|
||||||
var projectTypeGuidProperty = projectInstance.GetPropertyValue("ProjectTypeGuid");
|
|
||||||
if (!string.IsNullOrEmpty(projectTypeGuidProperty))
|
|
||||||
{
|
|
||||||
projectTypeGuid = projectTypeGuidProperty.Split(';').Last();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
projectTypeGuid = projectInstance.GetPropertyValue("DefaultProjectTypeGuid");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(projectTypeGuid))
|
|
||||||
{
|
|
||||||
//ISSUE: https://github.com/dotnet/sdk/issues/522
|
|
||||||
//The real behavior we want (once DefaultProjectTypeGuid support is in) is to throw
|
|
||||||
//when we cannot find ProjectTypeGuid or DefaultProjectTypeGuid. But for now we
|
|
||||||
//need to default to the C# one.
|
|
||||||
//throw new GracefulException(CommonLocalizableStrings.UnsupportedProjectType);
|
|
||||||
projectTypeGuid = ProjectTypeGuids.CSharpProjectTypeGuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
return projectTypeGuid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IEnumerable<string> GetPlatforms(this ProjectInstance projectInstance)
|
public static IEnumerable<string> GetPlatforms(this ProjectInstance projectInstance)
|
||||||
|
|
23
src/dotnet/ProjectRootElementExtensions.cs
Normal file
23
src/dotnet/ProjectRootElementExtensions.cs
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using Microsoft.Build.Construction;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Tools.Common
|
||||||
|
{
|
||||||
|
public static class ProjectRootElementExtensions
|
||||||
|
{
|
||||||
|
public static string GetProjectTypeGuid(this ProjectRootElement rootElement)
|
||||||
|
{
|
||||||
|
return rootElement
|
||||||
|
.Properties
|
||||||
|
.FirstOrDefault(p => string.Equals(p.Name, "ProjectTypeGuids", StringComparison.OrdinalIgnoreCase))
|
||||||
|
?.Value
|
||||||
|
.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries)
|
||||||
|
.LastOrDefault(g => !string.IsNullOrWhiteSpace(g));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -37,10 +37,12 @@ namespace Microsoft.DotNet.Tools.Common
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
ProjectRootElement rootElement = null;
|
||||||
ProjectInstance projectInstance = null;
|
ProjectInstance projectInstance = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
projectInstance = new ProjectInstance(fullProjectPath);
|
rootElement = ProjectRootElement.Open(fullProjectPath);
|
||||||
|
projectInstance = new ProjectInstance(rootElement);
|
||||||
}
|
}
|
||||||
catch (InvalidProjectFileException e)
|
catch (InvalidProjectFileException e)
|
||||||
{
|
{
|
||||||
|
@ -54,11 +56,20 @@ namespace Microsoft.DotNet.Tools.Common
|
||||||
var slnProject = new SlnProject
|
var slnProject = new SlnProject
|
||||||
{
|
{
|
||||||
Id = projectInstance.GetProjectId(),
|
Id = projectInstance.GetProjectId(),
|
||||||
TypeGuid = projectInstance.GetProjectTypeGuid(),
|
TypeGuid = rootElement.GetProjectTypeGuid() ?? projectInstance.GetDefaultProjectTypeGuid(),
|
||||||
Name = Path.GetFileNameWithoutExtension(relativeProjectPath),
|
Name = Path.GetFileNameWithoutExtension(relativeProjectPath),
|
||||||
FilePath = relativeProjectPath
|
FilePath = relativeProjectPath
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(slnProject.TypeGuid))
|
||||||
|
{
|
||||||
|
Reporter.Error.WriteLine(
|
||||||
|
string.Format(
|
||||||
|
CommonLocalizableStrings.UnsupportedProjectType,
|
||||||
|
projectInstance.FullPath));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// NOTE: The order you create the sections determines the order they are written to the sln
|
// NOTE: The order you create the sections determines the order they are written to the sln
|
||||||
// file. In the case of an empty sln file, in order to make sure the solution configurations
|
// file. In the case of an empty sln file, in order to make sure the solution configurations
|
||||||
// section comes first we need to add it first. This doesn't affect correctness but does
|
// section comes first we need to add it first. This doesn't affect correctness but does
|
||||||
|
|
|
@ -600,8 +600,8 @@
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="UnsupportedProjectType">
|
<trans-unit id="UnsupportedProjectType">
|
||||||
<source>Unsupported project type. Please check with your sdk provider.</source>
|
<source>Project '{0}' has an unknown project type and cannot be added to the solution file. Please contact your SDK provider for support.</source>
|
||||||
<target state="translated">Nepodporovaný typ projektu. Ověřte to prosím u poskytovatele sady SDK.</target>
|
<target state="needs-review-translation">Nepodporovaný typ projektu. Ověřte to prosím u poskytovatele sady SDK.</target>
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="InvalidSolutionFormatString">
|
<trans-unit id="InvalidSolutionFormatString">
|
||||||
|
|
|
@ -600,8 +600,8 @@
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="UnsupportedProjectType">
|
<trans-unit id="UnsupportedProjectType">
|
||||||
<source>Unsupported project type. Please check with your sdk provider.</source>
|
<source>Project '{0}' has an unknown project type and cannot be added to the solution file. Please contact your SDK provider for support.</source>
|
||||||
<target state="translated">Nicht unterstützter Projekttyp. Wenden Sie sich an Ihren SDK-Anbieter.</target>
|
<target state="needs-review-translation">Nicht unterstützter Projekttyp. Wenden Sie sich an Ihren SDK-Anbieter.</target>
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="InvalidSolutionFormatString">
|
<trans-unit id="InvalidSolutionFormatString">
|
||||||
|
|
|
@ -600,8 +600,8 @@
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="UnsupportedProjectType">
|
<trans-unit id="UnsupportedProjectType">
|
||||||
<source>Unsupported project type. Please check with your sdk provider.</source>
|
<source>Project '{0}' has an unknown project type and cannot be added to the solution file. Please contact your SDK provider for support.</source>
|
||||||
<target state="translated">Tipo de proyecto no admitido. Consulte a su proveedor de SDK.</target>
|
<target state="needs-review-translation">Tipo de proyecto no admitido. Consulte a su proveedor de SDK.</target>
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="InvalidSolutionFormatString">
|
<trans-unit id="InvalidSolutionFormatString">
|
||||||
|
|
|
@ -600,8 +600,8 @@
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="UnsupportedProjectType">
|
<trans-unit id="UnsupportedProjectType">
|
||||||
<source>Unsupported project type. Please check with your sdk provider.</source>
|
<source>Project '{0}' has an unknown project type and cannot be added to the solution file. Please contact your SDK provider for support.</source>
|
||||||
<target state="translated">Type de projet non pris en charge. Consultez le fournisseur de votre SDK.</target>
|
<target state="needs-review-translation">Type de projet non pris en charge. Consultez le fournisseur de votre SDK.</target>
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="InvalidSolutionFormatString">
|
<trans-unit id="InvalidSolutionFormatString">
|
||||||
|
|
|
@ -600,8 +600,8 @@
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="UnsupportedProjectType">
|
<trans-unit id="UnsupportedProjectType">
|
||||||
<source>Unsupported project type. Please check with your sdk provider.</source>
|
<source>Project '{0}' has an unknown project type and cannot be added to the solution file. Please contact your SDK provider for support.</source>
|
||||||
<target state="translated">Tipo di progetto non supportato. Verificare con il provider SDK.</target>
|
<target state="needs-review-translation">Tipo di progetto non supportato. Verificare con il provider SDK.</target>
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="InvalidSolutionFormatString">
|
<trans-unit id="InvalidSolutionFormatString">
|
||||||
|
|
|
@ -600,8 +600,8 @@
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="UnsupportedProjectType">
|
<trans-unit id="UnsupportedProjectType">
|
||||||
<source>Unsupported project type. Please check with your sdk provider.</source>
|
<source>Project '{0}' has an unknown project type and cannot be added to the solution file. Please contact your SDK provider for support.</source>
|
||||||
<target state="translated">サポートされていないプロジェクトの種類です。SDK プロバイダーに確認してください。</target>
|
<target state="needs-review-translation">サポートされていないプロジェクトの種類です。SDK プロバイダーに確認してください。</target>
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="InvalidSolutionFormatString">
|
<trans-unit id="InvalidSolutionFormatString">
|
||||||
|
|
|
@ -600,8 +600,8 @@
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="UnsupportedProjectType">
|
<trans-unit id="UnsupportedProjectType">
|
||||||
<source>Unsupported project type. Please check with your sdk provider.</source>
|
<source>Project '{0}' has an unknown project type and cannot be added to the solution file. Please contact your SDK provider for support.</source>
|
||||||
<target state="translated">지원되지 않는 프로젝트 형식입니다. SDK 공급자를 확인하세요.</target>
|
<target state="needs-review-translation">지원되지 않는 프로젝트 형식입니다. SDK 공급자를 확인하세요.</target>
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="InvalidSolutionFormatString">
|
<trans-unit id="InvalidSolutionFormatString">
|
||||||
|
|
|
@ -600,8 +600,8 @@
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="UnsupportedProjectType">
|
<trans-unit id="UnsupportedProjectType">
|
||||||
<source>Unsupported project type. Please check with your sdk provider.</source>
|
<source>Project '{0}' has an unknown project type and cannot be added to the solution file. Please contact your SDK provider for support.</source>
|
||||||
<target state="translated">Nieobsługiwany typ projektu. Skontaktuj się z dostawcą zestawu SDK.</target>
|
<target state="needs-review-translation">Nieobsługiwany typ projektu. Skontaktuj się z dostawcą zestawu SDK.</target>
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="InvalidSolutionFormatString">
|
<trans-unit id="InvalidSolutionFormatString">
|
||||||
|
|
|
@ -600,8 +600,8 @@
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="UnsupportedProjectType">
|
<trans-unit id="UnsupportedProjectType">
|
||||||
<source>Unsupported project type. Please check with your sdk provider.</source>
|
<source>Project '{0}' has an unknown project type and cannot be added to the solution file. Please contact your SDK provider for support.</source>
|
||||||
<target state="translated">Tipo de projeto sem suporte. Verifique com seu provedor de SDK.</target>
|
<target state="needs-review-translation">Tipo de projeto sem suporte. Verifique com seu provedor de SDK.</target>
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="InvalidSolutionFormatString">
|
<trans-unit id="InvalidSolutionFormatString">
|
||||||
|
|
|
@ -600,8 +600,8 @@
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="UnsupportedProjectType">
|
<trans-unit id="UnsupportedProjectType">
|
||||||
<source>Unsupported project type. Please check with your sdk provider.</source>
|
<source>Project '{0}' has an unknown project type and cannot be added to the solution file. Please contact your SDK provider for support.</source>
|
||||||
<target state="translated">Тип проекта не поддерживается. Обратитесь к поставщику пакета SDK.</target>
|
<target state="needs-review-translation">Тип проекта не поддерживается. Обратитесь к поставщику пакета SDK.</target>
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="InvalidSolutionFormatString">
|
<trans-unit id="InvalidSolutionFormatString">
|
||||||
|
|
|
@ -600,8 +600,8 @@
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="UnsupportedProjectType">
|
<trans-unit id="UnsupportedProjectType">
|
||||||
<source>Unsupported project type. Please check with your sdk provider.</source>
|
<source>Project '{0}' has an unknown project type and cannot be added to the solution file. Please contact your SDK provider for support.</source>
|
||||||
<target state="translated">Proje türü desteklenmiyor. Lütfen SDK sağlayıcınıza başvurun.</target>
|
<target state="needs-review-translation">Proje türü desteklenmiyor. Lütfen SDK sağlayıcınıza başvurun.</target>
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="InvalidSolutionFormatString">
|
<trans-unit id="InvalidSolutionFormatString">
|
||||||
|
|
|
@ -600,8 +600,8 @@
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="UnsupportedProjectType">
|
<trans-unit id="UnsupportedProjectType">
|
||||||
<source>Unsupported project type. Please check with your sdk provider.</source>
|
<source>Project '{0}' has an unknown project type and cannot be added to the solution file. Please contact your SDK provider for support.</source>
|
||||||
<target state="translated">不支持的项目类型。请联系 SDK 提供商。</target>
|
<target state="needs-review-translation">不支持的项目类型。请联系 SDK 提供商。</target>
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="InvalidSolutionFormatString">
|
<trans-unit id="InvalidSolutionFormatString">
|
||||||
|
|
|
@ -600,8 +600,8 @@
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="UnsupportedProjectType">
|
<trans-unit id="UnsupportedProjectType">
|
||||||
<source>Unsupported project type. Please check with your sdk provider.</source>
|
<source>Project '{0}' has an unknown project type and cannot be added to the solution file. Please contact your SDK provider for support.</source>
|
||||||
<target state="translated">不支援的專案類型。請與 SDK 提供者連絡。</target>
|
<target state="needs-review-translation">不支援的專案類型。請與 SDK 提供者連絡。</target>
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="InvalidSolutionFormatString">
|
<trans-unit id="InvalidSolutionFormatString">
|
||||||
|
|
|
@ -64,9 +64,7 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
slnProject.FilePath.Should().Be(Path.Combine("..", "TestLibrary", "TestLibrary.csproj"));
|
slnProject.FilePath.Should().Be(Path.Combine("..", "TestLibrary", "TestLibrary.csproj"));
|
||||||
|
|
||||||
slnProject = nonSolutionFolderProjects.Where((p) => p.Name == "subdir").Single();
|
slnProject = nonSolutionFolderProjects.Where((p) => p.Name == "subdir").Single();
|
||||||
//ISSUE: https://github.com/dotnet/sdk/issues/522
|
slnProject.TypeGuid.Should().Be(ProjectTypeGuids.CSharpProjectTypeGuid);
|
||||||
//Once we have that change migrate will always burn in the C# guid
|
|
||||||
//slnProject.TypeGuid.Should().Be(ProjectTypeGuids.CSharpProjectTypeGuid);
|
|
||||||
slnProject.FilePath.Should().Be(Path.Combine("src", "subdir", "subdir.csproj"));
|
slnProject.FilePath.Should().Be(Path.Combine("src", "subdir", "subdir.csproj"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -867,10 +867,9 @@ EndGlobal
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
//ISSUE: https://github.com/dotnet/sdk/issues/522
|
[InlineData("SlnFileWithNoProjectReferencesAndCSharpProject", "CSharpProject", "CSharpProject.csproj", ProjectTypeGuids.CSharpProjectTypeGuid)]
|
||||||
//[InlineData("SlnFileWithNoProjectReferencesAndCSharpProject", "CSharpProject", "CSharpProject.csproj", ProjectTypeGuids.CSharpProjectTypeGuid)]
|
[InlineData("SlnFileWithNoProjectReferencesAndFSharpProject", "FSharpProject", "FSharpProject.fsproj", ProjectTypeGuids.FSharpProjectTypeGuid)]
|
||||||
//[InlineData("SlnFileWithNoProjectReferencesAndFSharpProject", "FSharpProject", "FSharpProject.fsproj", "{F2A71F9B-5D33-465A-A702-920D77279786}")]
|
[InlineData("SlnFileWithNoProjectReferencesAndVBProject", "VBProject", "VBProject.vbproj", ProjectTypeGuids.VBProjectTypeGuid)]
|
||||||
//[InlineData("SlnFileWithNoProjectReferencesAndVBProject", "VBProject", "VBProject.vbproj", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}")]
|
|
||||||
[InlineData("SlnFileWithNoProjectReferencesAndUnknownProjectWithSingleProjectTypeGuid", "UnknownProject", "UnknownProject.unknownproj", "{130159A9-F047-44B3-88CF-0CF7F02ED50F}")]
|
[InlineData("SlnFileWithNoProjectReferencesAndUnknownProjectWithSingleProjectTypeGuid", "UnknownProject", "UnknownProject.unknownproj", "{130159A9-F047-44B3-88CF-0CF7F02ED50F}")]
|
||||||
[InlineData("SlnFileWithNoProjectReferencesAndUnknownProjectWithMultipleProjectTypeGuids", "UnknownProject", "UnknownProject.unknownproj", "{130159A9-F047-44B3-88CF-0CF7F02ED50F}")]
|
[InlineData("SlnFileWithNoProjectReferencesAndUnknownProjectWithMultipleProjectTypeGuids", "UnknownProject", "UnknownProject.unknownproj", "{130159A9-F047-44B3-88CF-0CF7F02ED50F}")]
|
||||||
public void WhenPassedAProjectItAddsCorrectProjectTypeGuid(
|
public void WhenPassedAProjectItAddsCorrectProjectTypeGuid(
|
||||||
|
@ -891,8 +890,8 @@ EndGlobal
|
||||||
.WithWorkingDirectory(projectDirectory)
|
.WithWorkingDirectory(projectDirectory)
|
||||||
.ExecuteWithCapturedOutput($"sln App.sln add {projectToAdd}");
|
.ExecuteWithCapturedOutput($"sln App.sln add {projectToAdd}");
|
||||||
cmd.Should().Pass();
|
cmd.Should().Pass();
|
||||||
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ProjectAddedToTheSolution, projectToAdd));
|
|
||||||
cmd.StdErr.Should().BeEmpty();
|
cmd.StdErr.Should().BeEmpty();
|
||||||
|
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ProjectAddedToTheSolution, projectToAdd));
|
||||||
|
|
||||||
var slnFile = SlnFile.Read(Path.Combine(projectDirectory, "App.sln"));
|
var slnFile = SlnFile.Read(Path.Combine(projectDirectory, "App.sln"));
|
||||||
var nonSolutionFolderProjects = slnFile.Projects.Where(
|
var nonSolutionFolderProjects = slnFile.Projects.Where(
|
||||||
|
@ -901,6 +900,35 @@ EndGlobal
|
||||||
nonSolutionFolderProjects.Single().TypeGuid.Should().Be(expectedTypeGuid);
|
nonSolutionFolderProjects.Single().TypeGuid.Should().Be(expectedTypeGuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void WhenPassedAProjectWithoutATypeGuidItErrors()
|
||||||
|
{
|
||||||
|
var solutionDirectory = TestAssets
|
||||||
|
.Get("SlnFileWithNoProjectReferencesAndUnknownProjectType")
|
||||||
|
.CreateInstance()
|
||||||
|
.WithSourceFiles()
|
||||||
|
.Root
|
||||||
|
.FullName;
|
||||||
|
|
||||||
|
var solutionPath = Path.Combine(solutionDirectory, "App.sln");
|
||||||
|
var contentBefore = File.ReadAllText(solutionPath);
|
||||||
|
|
||||||
|
var projectToAdd = Path.Combine("UnknownProject", "UnknownProject.unknownproj");
|
||||||
|
var cmd = new DotnetCommand()
|
||||||
|
.WithWorkingDirectory(solutionDirectory)
|
||||||
|
.ExecuteWithCapturedOutput($"sln add {projectToAdd}");
|
||||||
|
cmd.Should().Pass();
|
||||||
|
cmd.StdErr.Should().Be(
|
||||||
|
string.Format(
|
||||||
|
CommonLocalizableStrings.UnsupportedProjectType,
|
||||||
|
Path.Combine(solutionDirectory, projectToAdd)));
|
||||||
|
cmd.StdOut.Should().BeEmpty();
|
||||||
|
|
||||||
|
File.ReadAllText(solutionPath)
|
||||||
|
.Should()
|
||||||
|
.BeVisuallyEquivalentTo(contentBefore);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
private void WhenSlnContainsSolutionFolderWithDifferentCasingItDoesNotCreateDuplicate()
|
private void WhenSlnContainsSolutionFolderWithDifferentCasingItDoesNotCreateDuplicate()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue