Merge branch 'release/2.1.3xx' into merges/release/2.1.2xx-to-release/2.1.3xx

This commit is contained in:
Livar 2018-03-27 16:45:20 -07:00 committed by GitHub
commit ae08395451
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
67 changed files with 752 additions and 277 deletions

View file

@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), testAsset.props))\testAsset.props" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
</Project>

View file

@ -0,0 +1,16 @@
// 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;
namespace MSBuildTestApp
{
public class Program
{
public static void Main(string[] args)
{
var message = Environment.GetEnvironmentVariable("ASPNETCORE_URLS");
Console.WriteLine(message);
}
}
}

View file

@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:49850/",
"sslPort": 0
}
},
"profiles": {
"First": {
"commandName": "Project",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_URLS": "http://localhost:12345/"
},
"applicationUrl": "http://localhost:67890/"
},
"Second": {
"commandName": "Project",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:54321/"
}
}
}

View file

@ -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>

View file

@ -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
()

View file

@ -1,81 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<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')" />
<Project Sdk="Microsoft.NET.Sdk">
<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>
<RootNamespace>FSharpProject</RootNamespace>
<AssemblyName>FSharpProject</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFSharpCoreVersion>4.4.1.0</TargetFSharpCoreVersion>
<Name>FSharpProject</Name>
<TargetFramework>netcoreapp2.1</TargetFramework>
</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>
<Compile Include="AssemblyInfo.fs" />
<Compile Include="Program.fs" />
<None Include="App.config" />
<Content Include="packages.config" />
</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>

View file

@ -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>

View file

@ -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

View file

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<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>
</Project>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectTypeGuid>{130159A9-F047-44B3-88CF-0CF7F02ED50F}</ProjectTypeGuid>
<ProjectTypeGuids>{130159A9-F047-44B3-88CF-0CF7F02ED50F}</ProjectTypeGuids>
</PropertyGroup>
</Project>

View file

@ -1,6 +1,7 @@
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<BundledDotnetTools Include="dotnet-dev-certs" Version="$(AspNetCoreVersion)" />
<BundledDotnetTools Include="dotnet-ef" Version="$(AspNetCoreVersion)" ObsoletesCliTool="Microsoft.EntityFrameworkCore.Tools.DotNet" />
<BundledDotnetTools Include="dotnet-sql-cache" Version="$(AspNetCoreVersion)" ObsoletesCliTool="Microsoft.Extensions.Caching.SqlConfig.Tools" />
<BundledDotnetTools Include="dotnet-user-secrets" Version="$(AspNetCoreVersion)" ObsoletesCliTool="Microsoft.Extensions.SecretManager.Tools" />
<BundledDotnetTools Include="dotnet-watch" Version="$(AspNetCoreVersion)" ObsoletesCliTool="Microsoft.DotNet.Watcher.Tools" />

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MicrosoftAspNetCoreAppPackageVersion>2.1.0-preview2-30338</MicrosoftAspNetCoreAppPackageVersion>
<MicrosoftNETCoreAppPackageVersion>2.1.0-preview2-26313-01</MicrosoftNETCoreAppPackageVersion>
<MicrosoftAspNetCoreAppPackageVersion>2.1.0-preview2-30475</MicrosoftAspNetCoreAppPackageVersion>
<MicrosoftNETCoreAppPackageVersion>2.1.0-preview2-26314-02</MicrosoftNETCoreAppPackageVersion>
<MicrosoftNETCoreDotNetHostResolverPackageVersion>$(MicrosoftNETCoreAppPackageVersion)</MicrosoftNETCoreDotNetHostResolverPackageVersion>
<MicrosoftBuildPackageVersion>15.7.0-preview-000066</MicrosoftBuildPackageVersion>
<MicrosoftBuildPackageVersion>15.7.0-preview-000124</MicrosoftBuildPackageVersion>
<MicrosoftBuildFrameworkPackageVersion>$(MicrosoftBuildPackageVersion)</MicrosoftBuildFrameworkPackageVersion>
<MicrosoftBuildRuntimePackageVersion>$(MicrosoftBuildPackageVersion)</MicrosoftBuildRuntimePackageVersion>
<MicrosoftBuildLocalizationPackageVersion>$(MicrosoftBuildPackageVersion)</MicrosoftBuildLocalizationPackageVersion>
@ -28,14 +28,14 @@
<MicrosoftTemplateEngineCliLocalizationPackageVersion>$(MicrosoftTemplateEngineCliPackageVersion)</MicrosoftTemplateEngineCliLocalizationPackageVersion>
<MicrosoftTemplateEngineOrchestratorRunnableProjectsPackageVersion>$(MicrosoftTemplateEngineCliPackageVersion)</MicrosoftTemplateEngineOrchestratorRunnableProjectsPackageVersion>
<MicrosoftTemplateEngineUtilsPackageVersion>$(MicrosoftTemplateEngineCliPackageVersion)</MicrosoftTemplateEngineUtilsPackageVersion>
<MicrosoftDotNetPlatformAbstractionsPackageVersion>2.1.0-preview2-26313-01</MicrosoftDotNetPlatformAbstractionsPackageVersion>
<MicrosoftExtensionsDependencyModelPackageVersion>2.1.0-preview2-26313-01</MicrosoftExtensionsDependencyModelPackageVersion>
<MicrosoftDotNetPlatformAbstractionsPackageVersion>2.1.0-preview2-26314-02</MicrosoftDotNetPlatformAbstractionsPackageVersion>
<MicrosoftExtensionsDependencyModelPackageVersion>2.1.0-preview2-26314-02</MicrosoftExtensionsDependencyModelPackageVersion>
<MicrosoftDotNetCliCommandLinePackageVersion>0.1.1-alpha-174</MicrosoftDotNetCliCommandLinePackageVersion>
<MicrosoftDotNetProjectJsonMigrationPackageVersion>1.2.1-alpha-002133</MicrosoftDotNetProjectJsonMigrationPackageVersion>
<MicrosoftDotNetToolsMigrateCommandPackageVersion>$(MicrosoftDotNetProjectJsonMigrationPackageVersion)</MicrosoftDotNetToolsMigrateCommandPackageVersion>
<MicrosoftDotNetArchivePackageVersion>0.2.0-beta-62628-01</MicrosoftDotNetArchivePackageVersion>
<MicrosoftDiaSymReaderNativePackageVersion>1.6.0-beta2-25304</MicrosoftDiaSymReaderNativePackageVersion>
<NuGetBuildTasksPackageVersion>4.7.0-preview1.4982</NuGetBuildTasksPackageVersion>
<NuGetBuildTasksPackageVersion>4.7.0-preview3.5039</NuGetBuildTasksPackageVersion>
<NuGetBuildTasksPackPackageVersion>$(NuGetBuildTasksPackageVersion)</NuGetBuildTasksPackPackageVersion>
<NuGetCommonPackageVersion>$(NuGetBuildTasksPackageVersion)</NuGetCommonPackageVersion>
<NuGetCommandLineXPlatPackageVersion>$(NuGetBuildTasksPackageVersion)</NuGetCommandLineXPlatPackageVersion>

View file

@ -20,7 +20,7 @@
<![CDATA[
<add key="BlobFeed" value="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" />
<add key="templating" value="https://dotnet.myget.org/F/templating/api/v3/index.json" />
<add key="aspnetcore-dev" value="https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json" />
<add key="aspnetcore-release" value="https://dotnet.myget.org/F/aspnetcore-release/api/v3/index.json" />
<add key="websdkfeed" value="https://dotnet.myget.org/F/dotnet-web/api/v3/index.json" />
<add key="roslyn" value="https://dotnet.myget.org/f/roslyn/api/v3/index.json" />
<add key="symreader-native" value="https://dotnet.myget.org/f/symreader-native/api/v3/index.json" />

View file

@ -79,6 +79,10 @@ get_legacy_os_name_from_platform() {
echo "fedora.23"
return 0
;;
"fedora.27")
echo "fedora.27"
return 0
;;
"fedora.24")
echo "fedora.24"
return 0
@ -91,6 +95,10 @@ get_legacy_os_name_from_platform() {
echo "opensuse.42.1"
return 0
;;
"opensuse.42.3")
echo "opensuse.42.3"
return 0
;;
"rhel.7"*)
echo "rhel"
return 0
@ -107,6 +115,10 @@ get_legacy_os_name_from_platform() {
echo "ubuntu.16.10"
return 0
;;
"ubuntu.18.04")
echo "ubuntu.18.04"
return 0
;;
"alpine.3.4.3")
echo "alpine"
return 0

View file

@ -6,6 +6,8 @@ namespace Microsoft.DotNet.Cli.Sln.Internal
public static class ProjectTypeGuids
{
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}";
}
}

View file

@ -118,7 +118,7 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<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 name="ProjectAlreadyHasAreference" xml:space="preserve">
<value>Project already has a reference to `{0}`.</value>
@ -628,4 +628,13 @@ setx PATH "%PATH%;{0}"
<data name="ToolSettingsInvalidLeadingDotCommandName" xml:space="preserve">
<value>The command name '{0}' cannot begin with a leading dot (.).</value>
</data>
<data name="FormatVersionIsHigher" xml:space="preserve">
<value>Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</value>
</data>
<data name="FormatVersionIsMalformed" xml:space="preserve">
<value>Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</value>
</data>
<data name="FormatVersionIsMissing" xml:space="preserve">
<value>Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</value>
</data>
</root>

View file

@ -20,31 +20,9 @@ namespace Microsoft.DotNet.Tools.Common
return projectGuid.ToString("B").ToUpper();
}
public static string GetProjectTypeGuid(this ProjectInstance projectInstance)
public static string GetDefaultProjectTypeGuid(this ProjectInstance projectInstance)
{
string projectTypeGuid = null;
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;
return projectInstance.GetPropertyValue("DefaultProjectTypeGuid");
}
public static IEnumerable<string> GetPlatforms(this ProjectInstance projectInstance)

View 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));
}
}
}

View file

@ -37,10 +37,12 @@ namespace Microsoft.DotNet.Tools.Common
}
else
{
ProjectRootElement rootElement = null;
ProjectInstance projectInstance = null;
try
{
projectInstance = new ProjectInstance(fullProjectPath);
rootElement = ProjectRootElement.Open(fullProjectPath);
projectInstance = new ProjectInstance(rootElement);
}
catch (InvalidProjectFileException e)
{
@ -54,11 +56,20 @@ namespace Microsoft.DotNet.Tools.Common
var slnProject = new SlnProject
{
Id = projectInstance.GetProjectId(),
TypeGuid = projectInstance.GetProjectTypeGuid(),
TypeGuid = rootElement.GetProjectTypeGuid() ?? projectInstance.GetDefaultProjectTypeGuid(),
Name = Path.GetFileNameWithoutExtension(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
// 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

View file

@ -18,6 +18,8 @@ namespace Microsoft.DotNet.ToolPackage
IReadOnlyList<CommandSettings> Commands { get; }
IEnumerable<string> Warnings { get; }
void Uninstall();
}
}

View file

@ -2,6 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.DotNet.Tools;
@ -12,7 +13,8 @@ namespace Microsoft.DotNet.ToolPackage
{
public ToolConfiguration(
string commandName,
string toolAssemblyEntryPoint)
string toolAssemblyEntryPoint,
IEnumerable<string> warnings = null)
{
if (string.IsNullOrWhiteSpace(commandName))
{
@ -32,6 +34,7 @@ namespace Microsoft.DotNet.ToolPackage
CommandName = commandName;
ToolAssemblyEntryPoint = toolAssemblyEntryPoint;
Warnings = warnings ?? new List<string>();
}
private void EnsureNoInvalidFilenameCharacters(string commandName)
@ -60,5 +63,6 @@ namespace Microsoft.DotNet.ToolPackage
public string CommandName { get; }
public string ToolAssemblyEntryPoint { get; }
public IEnumerable<string> Warnings { get; }
}
}

View file

@ -9,5 +9,8 @@ namespace Microsoft.DotNet.ToolPackage.ToolConfigurationDeserialization
{
[XmlArrayItem("Command", IsNullable = false)]
public DotNetCliToolCommand[] Commands { get; set; }
[XmlAttribute(AttributeName = "Version")]
public string Version { get; set; }
}
}

View file

@ -2,6 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml;
using System.Xml.Serialization;
@ -12,6 +13,10 @@ namespace Microsoft.DotNet.ToolPackage
{
internal static class ToolConfigurationDeserializer
{
// The supported tool configuration schema version.
// This should match the schema version in the GenerateToolsSettingsFile task from the SDK.
private const int SupportedVersion = 1;
public static ToolConfiguration Deserialize(string pathToXml)
{
var serializer = new XmlSerializer(typeof(DotNetCliTool));
@ -43,6 +48,8 @@ namespace Microsoft.DotNet.ToolPackage
ex);
}
List<string> warnings = GenerateWarningAccordingToVersionAttribute(dotNetCliTool);
if (dotNetCliTool.Commands.Length != 1)
{
throw new ToolConfigurationException(CommonLocalizableStrings.ToolSettingsMoreThanOneCommand);
@ -59,7 +66,33 @@ namespace Microsoft.DotNet.ToolPackage
return new ToolConfiguration(
dotNetCliTool.Commands[0].Name,
dotNetCliTool.Commands[0].EntryPoint);
dotNetCliTool.Commands[0].EntryPoint,
warnings);
}
private static List<string> GenerateWarningAccordingToVersionAttribute(DotNetCliTool dotNetCliTool)
{
List<string> warnings = new List<string>();
if (string.IsNullOrWhiteSpace(dotNetCliTool.Version))
{
warnings.Add(CommonLocalizableStrings.FormatVersionIsMissing);
}
else
{
if (!int.TryParse(dotNetCliTool.Version, out int version))
{
warnings.Add(CommonLocalizableStrings.FormatVersionIsMalformed);
}
else
{
if (version > SupportedVersion)
{
warnings.Add(CommonLocalizableStrings.FormatVersionIsHigher);
}
}
}
return warnings;
}
}
}

View file

@ -13,23 +13,7 @@ namespace Microsoft.DotNet.ToolPackage
// This is named "ToolPackageInstance" because "ToolPackage" would conflict with the namespace
internal class ToolPackageInstance : IToolPackage
{
private IToolPackageStore _store;
private Lazy<IReadOnlyList<CommandSettings>> _commands;
public ToolPackageInstance(
IToolPackageStore store,
PackageId id,
NuGetVersion version,
DirectoryPath packageDirectory)
{
_store = store ?? throw new ArgumentNullException(nameof(store));
_commands = new Lazy<IReadOnlyList<CommandSettings>>(GetCommands);
Id = id;
Version = version ?? throw new ArgumentNullException(nameof(version));
PackageDirectory = packageDirectory;
}
public IEnumerable<string> Warnings => _toolConfiguration.Value.Warnings;
public PackageId Id { get; private set; }
public NuGetVersion Version { get; private set; }
@ -44,13 +28,36 @@ namespace Microsoft.DotNet.ToolPackage
}
}
private const string AssetsFileName = "project.assets.json";
private const string ToolSettingsFileName = "DotnetToolSettings.xml";
private IToolPackageStore _store;
private Lazy<IReadOnlyList<CommandSettings>> _commands;
private Lazy<ToolConfiguration> _toolConfiguration;
public ToolPackageInstance(
IToolPackageStore store,
PackageId id,
NuGetVersion version,
DirectoryPath packageDirectory)
{
_store = store ?? throw new ArgumentNullException(nameof(store));
_commands = new Lazy<IReadOnlyList<CommandSettings>>(GetCommands);
Id = id;
Version = version ?? throw new ArgumentNullException(nameof(version));
PackageDirectory = packageDirectory;
_toolConfiguration = new Lazy<ToolConfiguration>(GetToolConfiguration);
}
public void Uninstall()
{
var rootDirectory = PackageDirectory.GetParentPath();
string tempPackageDirectory = null;
TransactionalAction.Run(
action: () => {
action: () =>
{
try
{
if (Directory.Exists(PackageDirectory.Value))
@ -78,13 +85,15 @@ namespace Microsoft.DotNet.ToolPackage
ex);
}
},
commit: () => {
commit: () =>
{
if (tempPackageDirectory != null)
{
Directory.Delete(tempPackageDirectory, true);
}
},
rollback: () => {
rollback: () =>
{
if (tempPackageDirectory != null)
{
Directory.CreateDirectory(rootDirectory.Value);
@ -95,31 +104,13 @@ namespace Microsoft.DotNet.ToolPackage
private IReadOnlyList<CommandSettings> GetCommands()
{
const string AssetsFileName = "project.assets.json";
const string ToolSettingsFileName = "DotnetToolSettings.xml";
try
{
var commands = new List<CommandSettings>();
var lockFile = new LockFileFormat().Read(PackageDirectory.WithFile(AssetsFileName).Value);
var library = FindLibraryInLockFile(lockFile);
var dotnetToolSettings = FindItemInTargetLibrary(library, ToolSettingsFileName);
if (dotnetToolSettings == null)
{
throw new ToolConfigurationException(
CommonLocalizableStrings.MissingToolSettingsFile);
}
var toolConfigurationPath =
PackageDirectory
.WithSubDirectories(
Id.ToString(),
library.Version.ToNormalizedString())
.WithFile(dotnetToolSettings.Path);
var configuration = ToolConfigurationDeserializer.Deserialize(toolConfigurationPath.Value);
ToolConfiguration configuration = _toolConfiguration.Value;
var entryPointFromLockFile = FindItemInTargetLibrary(library, configuration.ToolAssemblyEntryPoint);
if (entryPointFromLockFile == null)
{
@ -152,6 +143,44 @@ namespace Microsoft.DotNet.ToolPackage
}
}
private ToolConfiguration GetToolConfiguration()
{
try
{
var lockFile = new LockFileFormat().Read(PackageDirectory.WithFile(AssetsFileName).Value);
var library = FindLibraryInLockFile(lockFile);
return DeserializeToolConfiguration(ToolSettingsFileName, library);
}
catch (Exception ex) when (ex is UnauthorizedAccessException || ex is IOException)
{
throw new ToolConfigurationException(
string.Format(
CommonLocalizableStrings.FailedToRetrieveToolConfiguration,
ex.Message),
ex);
}
}
private ToolConfiguration DeserializeToolConfiguration(string ToolSettingsFileName, LockFileTargetLibrary library)
{
var dotnetToolSettings = FindItemInTargetLibrary(library, ToolSettingsFileName);
if (dotnetToolSettings == null)
{
throw new ToolConfigurationException(
CommonLocalizableStrings.MissingToolSettingsFile);
}
var toolConfigurationPath =
PackageDirectory
.WithSubDirectories(
Id.ToString(),
library.Version.ToNormalizedString())
.WithFile(dotnetToolSettings.Path);
var configuration = ToolConfigurationDeserializer.Deserialize(toolConfigurationPath.Value);
return configuration;
}
private LockFileTargetLibrary FindLibraryInLockFile(LockFile lockFile)
{
return lockFile
@ -166,5 +195,6 @@ namespace Microsoft.DotNet.ToolPackage
?.ToolsAssemblies
?.SingleOrDefault(t => LockFileMatcher.MatchesFile(t, targetRelativeFilePath));
}
}
}

View file

@ -15,6 +15,11 @@ namespace Microsoft.DotNet.Tools.Run.LaunchSettings
{
var config = model.ToObject<ProjectLaunchSettingsModel>();
if (!string.IsNullOrEmpty(config.ApplicationUrl))
{
command.EnvironmentVariable("ASPNETCORE_URLS", config.ApplicationUrl);
}
//For now, ignore everything but the environment variables section
foreach (var entry in config.EnvironmentVariables)
@ -24,11 +29,6 @@ namespace Microsoft.DotNet.Tools.Run.LaunchSettings
command.EnvironmentVariable(entry.Key, value);
}
if (!string.IsNullOrEmpty(config.ApplicationUrl))
{
command.EnvironmentVariable("ASPNETCORE_URLS", config.ApplicationUrl);
}
return new LaunchSettingsApplyResult(true, null, config.LaunchUrl);
}

View file

@ -32,6 +32,7 @@ namespace Microsoft.DotNet.Tools.Test
{
"/t:VSTest",
"/v:quiet",
"/nodereuse:false", // workaround for https://github.com/Microsoft/vstest/issues/1503
"/nologo"
};
@ -95,7 +96,23 @@ namespace Microsoft.DotNet.Tools.Test
return e.ExitCode;
}
return cmd.Execute();
// Workaround for https://github.com/Microsoft/vstest/issues/1503
const string NodeWindowEnvironmentName = "MSBUILDENSURESTDOUTFORTASKPROCESSES";
string previousNodeWindowSetting = Environment.GetEnvironmentVariable(NodeWindowEnvironmentName);
int result = -1;
try
{
Environment.SetEnvironmentVariable(NodeWindowEnvironmentName, "1");
result = cmd.Execute();
}
finally
{
Environment.SetEnvironmentVariable(NodeWindowEnvironmentName, previousNodeWindowSetting);
}
return result;
}
private static string GetSemiColonEscapedString(string arg)

View file

@ -161,7 +161,9 @@ Tool '{1}' (version '{2}') was successfully installed.</value>
<value>The settings file in the tool's NuGet package is invalid: {0}</value>
</data>
<data name="ToolInstallationFailed" xml:space="preserve">
<value>Tool '{0}' failed to install.</value>
<value>Tool '{0}' failed to install. You may need to specify the version using
dotnet tool install -g t-rex --version &lt;version&gt;</value>
</data>
<data name="ToolInstallationFailedContactAuthor" xml:space="preserve">
<value>Tool '{0}' failed to install. Please contact the tool author for assistance.</value>
@ -187,4 +189,4 @@ Tool '{1}' (version '{2}') was successfully installed.</value>
<data name="ToolPathDescription" xml:space="preserve">
<value>Location where the tool will be installed.</value>
</data>
</root>
</root>

View file

@ -148,6 +148,11 @@ namespace Microsoft.DotNet.Tools.Tool.Install
scope.Complete();
}
foreach (string w in package.Warnings)
{
_reporter.WriteLine(w.Yellow());
}
if (_global)
{
_environmentPathInstruction.PrintAddPathInstructionIfPathDoesNotExist();

View file

@ -60,8 +60,10 @@ Nástroj {1} (verze {2}) byl úspěšně nainstalován.</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailed">
<source>Tool '{0}' failed to install.</source>
<target state="translated">Nástroj {0} se nepodařilo nainstalovat.</target>
<source>Tool '{0}' failed to install. You may need to specify the version using
dotnet tool install -g t-rex --version &lt;version&gt;</source>
<target state="needs-review-translation">Nástroj {0} se nepodařilo nainstalovat.</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailedContactAuthor">

View file

@ -60,8 +60,10 @@ Das Tool "{1}" (Version "{2}") wurde erfolgreich installiert.</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailed">
<source>Tool '{0}' failed to install.</source>
<target state="translated">Fehler bei der Installation des Tools "{0}".</target>
<source>Tool '{0}' failed to install. You may need to specify the version using
dotnet tool install -g t-rex --version &lt;version&gt;</source>
<target state="needs-review-translation">Fehler bei der Installation des Tools "{0}".</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailedContactAuthor">

View file

@ -60,8 +60,10 @@ La herramienta "{1}" (versión "{2}") se instaló correctamente.</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailed">
<source>Tool '{0}' failed to install.</source>
<target state="translated">No se pudo instalar la herramienta “{0}”.</target>
<source>Tool '{0}' failed to install. You may need to specify the version using
dotnet tool install -g t-rex --version &lt;version&gt;</source>
<target state="needs-review-translation">No se pudo instalar la herramienta “{0}”.</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailedContactAuthor">

View file

@ -60,8 +60,10 @@ L'outil '{1}' (version '{2}') a été installé.</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailed">
<source>Tool '{0}' failed to install.</source>
<target state="translated">Impossible d'installer l'outil '{0}'.</target>
<source>Tool '{0}' failed to install. You may need to specify the version using
dotnet tool install -g t-rex --version &lt;version&gt;</source>
<target state="needs-review-translation">Impossible d'installer l'outil '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailedContactAuthor">

View file

@ -60,8 +60,10 @@ Lo strumento '{1}' (versione '{2}') è stato installato.</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailed">
<source>Tool '{0}' failed to install.</source>
<target state="translated">Non è stato possibile installare lo strumento '{0}'.</target>
<source>Tool '{0}' failed to install. You may need to specify the version using
dotnet tool install -g t-rex --version &lt;version&gt;</source>
<target state="needs-review-translation">Non è stato possibile installare lo strumento '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailedContactAuthor">

View file

@ -60,8 +60,10 @@ Tool '{1}' (version '{2}') was successfully installed.</source>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailed">
<source>Tool '{0}' failed to install.</source>
<target state="translated">ツール '{0}' をインストールできませんでした。</target>
<source>Tool '{0}' failed to install. You may need to specify the version using
dotnet tool install -g t-rex --version &lt;version&gt;</source>
<target state="needs-review-translation">ツール '{0}' をインストールできませんでした。</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailedContactAuthor">

View file

@ -60,8 +60,10 @@ Tool '{1}' (version '{2}') was successfully installed.</source>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailed">
<source>Tool '{0}' failed to install.</source>
<target state="translated">'{0}' 도구를 설치하지 못했습니다.</target>
<source>Tool '{0}' failed to install. You may need to specify the version using
dotnet tool install -g t-rex --version &lt;version&gt;</source>
<target state="needs-review-translation">'{0}' 도구를 설치하지 못했습니다.</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailedContactAuthor">

View file

@ -60,8 +60,10 @@ Pomyślnie zainstalowano narzędzie „{1}” (wersja: „{2}”).</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailed">
<source>Tool '{0}' failed to install.</source>
<target state="translated">Zainstalowanie narzędzia „{0}” nie powiodło się.</target>
<source>Tool '{0}' failed to install. You may need to specify the version using
dotnet tool install -g t-rex --version &lt;version&gt;</source>
<target state="needs-review-translation">Zainstalowanie narzędzia „{0}” nie powiodło się.</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailedContactAuthor">

View file

@ -60,8 +60,10 @@ A ferramenta '{1}' (versão '{2}') foi instalada com êxito.</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailed">
<source>Tool '{0}' failed to install.</source>
<target state="translated">Não foi possível instalar a ferramenta '{0}'.</target>
<source>Tool '{0}' failed to install. You may need to specify the version using
dotnet tool install -g t-rex --version &lt;version&gt;</source>
<target state="needs-review-translation">Não foi possível instalar a ferramenta '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailedContactAuthor">

View file

@ -60,8 +60,10 @@ Tool '{1}' (version '{2}') was successfully installed.</source>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailed">
<source>Tool '{0}' failed to install.</source>
<target state="translated">Не удалось установить инструмент "{0}".</target>
<source>Tool '{0}' failed to install. You may need to specify the version using
dotnet tool install -g t-rex --version &lt;version&gt;</source>
<target state="needs-review-translation">Не удалось установить инструмент "{0}".</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailedContactAuthor">

View file

@ -60,8 +60,10 @@ Tool '{1}' (version '{2}') was successfully installed.</source>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailed">
<source>Tool '{0}' failed to install.</source>
<target state="translated">'{0}' aracı yüklenemedi.</target>
<source>Tool '{0}' failed to install. You may need to specify the version using
dotnet tool install -g t-rex --version &lt;version&gt;</source>
<target state="needs-review-translation">'{0}' aracı yüklenemedi.</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailedContactAuthor">

View file

@ -60,8 +60,10 @@ Tool '{1}' (version '{2}') was successfully installed.</source>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailed">
<source>Tool '{0}' failed to install.</source>
<target state="translated">工具“{0}”安装失败。</target>
<source>Tool '{0}' failed to install. You may need to specify the version using
dotnet tool install -g t-rex --version &lt;version&gt;</source>
<target state="needs-review-translation">工具“{0}”安装失败。</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailedContactAuthor">

View file

@ -60,8 +60,10 @@ Tool '{1}' (version '{2}') was successfully installed.</source>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailed">
<source>Tool '{0}' failed to install.</source>
<target state="translated">工具 '{0}' 無法安裝。</target>
<source>Tool '{0}' failed to install. You may need to specify the version using
dotnet tool install -g t-rex --version &lt;version&gt;</source>
<target state="needs-review-translation">工具 '{0}' 無法安裝。</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailedContactAuthor">

View file

@ -600,8 +600,8 @@
<note />
</trans-unit>
<trans-unit id="UnsupportedProjectType">
<source>Unsupported project type. Please check with your sdk provider.</source>
<target state="translated">Nepodporovaný typ projektu. Ověřte to prosím u poskytovatele sady SDK.</target>
<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="needs-review-translation">Nepodporovaný typ projektu. Ověřte to prosím u poskytovatele sady SDK.</target>
<note />
</trans-unit>
<trans-unit id="InvalidSolutionFormatString">
@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}"
<target state="needs-review-translation">Příkaz {0} obsahuje úvodní tečku.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsHigher">
<source>Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</source>
<target state="new">Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMalformed">
<source>Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMissing">
<source>Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>

View file

@ -600,8 +600,8 @@
<note />
</trans-unit>
<trans-unit id="UnsupportedProjectType">
<source>Unsupported project type. Please check with your sdk provider.</source>
<target state="translated">Nicht unterstützter Projekttyp. Wenden Sie sich an Ihren SDK-Anbieter.</target>
<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="needs-review-translation">Nicht unterstützter Projekttyp. Wenden Sie sich an Ihren SDK-Anbieter.</target>
<note />
</trans-unit>
<trans-unit id="InvalidSolutionFormatString">
@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}"
<target state="needs-review-translation">Der Befehl "{0}" weist einen vorangestellten Punkt auf.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsHigher">
<source>Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</source>
<target state="new">Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMalformed">
<source>Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMissing">
<source>Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>

View file

@ -600,8 +600,8 @@
<note />
</trans-unit>
<trans-unit id="UnsupportedProjectType">
<source>Unsupported project type. Please check with your sdk provider.</source>
<target state="translated">Tipo de proyecto no admitido. Consulte a su proveedor de SDK.</target>
<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="needs-review-translation">Tipo de proyecto no admitido. Consulte a su proveedor de SDK.</target>
<note />
</trans-unit>
<trans-unit id="InvalidSolutionFormatString">
@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}"
<target state="needs-review-translation">El comando "{0}" tiene un punto al principio.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsHigher">
<source>Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</source>
<target state="new">Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMalformed">
<source>Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMissing">
<source>Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>

View file

@ -600,8 +600,8 @@
<note />
</trans-unit>
<trans-unit id="UnsupportedProjectType">
<source>Unsupported project type. Please check with your sdk provider.</source>
<target state="translated">Type de projet non pris en charge. Consultez le fournisseur de votre SDK.</target>
<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="needs-review-translation">Type de projet non pris en charge. Consultez le fournisseur de votre SDK.</target>
<note />
</trans-unit>
<trans-unit id="InvalidSolutionFormatString">
@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}"
<target state="needs-review-translation">La commande '{0}' commence par un point.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsHigher">
<source>Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</source>
<target state="new">Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMalformed">
<source>Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMissing">
<source>Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>

View file

@ -600,8 +600,8 @@
<note />
</trans-unit>
<trans-unit id="UnsupportedProjectType">
<source>Unsupported project type. Please check with your sdk provider.</source>
<target state="translated">Tipo di progetto non supportato. Verificare con il provider SDK.</target>
<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="needs-review-translation">Tipo di progetto non supportato. Verificare con il provider SDK.</target>
<note />
</trans-unit>
<trans-unit id="InvalidSolutionFormatString">
@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}"
<target state="needs-review-translation">Il comando '{0}' presenta un punto iniziale.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsHigher">
<source>Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</source>
<target state="new">Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMalformed">
<source>Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMissing">
<source>Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>

View file

@ -600,8 +600,8 @@
<note />
</trans-unit>
<trans-unit id="UnsupportedProjectType">
<source>Unsupported project type. Please check with your sdk provider.</source>
<target state="translated">サポートされていないプロジェクトの種類です。SDK プロバイダーに確認してください。</target>
<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="needs-review-translation">サポートされていないプロジェクトの種類です。SDK プロバイダーに確認してください。</target>
<note />
</trans-unit>
<trans-unit id="InvalidSolutionFormatString">
@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}"
<target state="needs-review-translation">コマンド '{0}' の先頭にドットがあります。</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsHigher">
<source>Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</source>
<target state="new">Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMalformed">
<source>Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMissing">
<source>Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>

View file

@ -600,8 +600,8 @@
<note />
</trans-unit>
<trans-unit id="UnsupportedProjectType">
<source>Unsupported project type. Please check with your sdk provider.</source>
<target state="translated">지원되지 않는 프로젝트 형식입니다. SDK 공급자를 확인하세요.</target>
<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="needs-review-translation">지원되지 않는 프로젝트 형식입니다. SDK 공급자를 확인하세요.</target>
<note />
</trans-unit>
<trans-unit id="InvalidSolutionFormatString">
@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}"
<target state="needs-review-translation">명령 '{0}' 앞에 점이 있습니다.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsHigher">
<source>Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</source>
<target state="new">Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMalformed">
<source>Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMissing">
<source>Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>

View file

@ -600,8 +600,8 @@
<note />
</trans-unit>
<trans-unit id="UnsupportedProjectType">
<source>Unsupported project type. Please check with your sdk provider.</source>
<target state="translated">Nieobsługiwany typ projektu. Skontaktuj się z dostawcą zestawu SDK.</target>
<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="needs-review-translation">Nieobsługiwany typ projektu. Skontaktuj się z dostawcą zestawu SDK.</target>
<note />
</trans-unit>
<trans-unit id="InvalidSolutionFormatString">
@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}"
<target state="needs-review-translation">Polecenie „{0}” zawiera kropkę na początku.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsHigher">
<source>Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</source>
<target state="new">Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMalformed">
<source>Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMissing">
<source>Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>

View file

@ -600,8 +600,8 @@
<note />
</trans-unit>
<trans-unit id="UnsupportedProjectType">
<source>Unsupported project type. Please check with your sdk provider.</source>
<target state="translated">Tipo de projeto sem suporte. Verifique com seu provedor de SDK.</target>
<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="needs-review-translation">Tipo de projeto sem suporte. Verifique com seu provedor de SDK.</target>
<note />
</trans-unit>
<trans-unit id="InvalidSolutionFormatString">
@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}"
<target state="needs-review-translation">O comando '{0}' tem um ponto à esquerda.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsHigher">
<source>Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</source>
<target state="new">Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMalformed">
<source>Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMissing">
<source>Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>

View file

@ -600,8 +600,8 @@
<note />
</trans-unit>
<trans-unit id="UnsupportedProjectType">
<source>Unsupported project type. Please check with your sdk provider.</source>
<target state="translated">Тип проекта не поддерживается. Обратитесь к поставщику пакета SDK.</target>
<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="needs-review-translation">Тип проекта не поддерживается. Обратитесь к поставщику пакета SDK.</target>
<note />
</trans-unit>
<trans-unit id="InvalidSolutionFormatString">
@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}"
<target state="needs-review-translation">В начале команды "{0}" стоит точка.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsHigher">
<source>Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</source>
<target state="new">Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMalformed">
<source>Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMissing">
<source>Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>

View file

@ -600,8 +600,8 @@
<note />
</trans-unit>
<trans-unit id="UnsupportedProjectType">
<source>Unsupported project type. Please check with your sdk provider.</source>
<target state="translated">Proje türü desteklenmiyor. Lütfen SDK sağlayıcınıza başvurun.</target>
<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="needs-review-translation">Proje türü desteklenmiyor. Lütfen SDK sağlayıcınıza başvurun.</target>
<note />
</trans-unit>
<trans-unit id="InvalidSolutionFormatString">
@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}"
<target state="needs-review-translation">'{0}' komutunun başında nokta var.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsHigher">
<source>Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</source>
<target state="new">Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMalformed">
<source>Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMissing">
<source>Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>

View file

@ -600,8 +600,8 @@
<note />
</trans-unit>
<trans-unit id="UnsupportedProjectType">
<source>Unsupported project type. Please check with your sdk provider.</source>
<target state="translated">不支持的项目类型。请联系 SDK 提供商。</target>
<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="needs-review-translation">不支持的项目类型。请联系 SDK 提供商。</target>
<note />
</trans-unit>
<trans-unit id="InvalidSolutionFormatString">
@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}"
<target state="needs-review-translation">命令“{0}”有一个前导点。</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsHigher">
<source>Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</source>
<target state="new">Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMalformed">
<source>Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMissing">
<source>Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>

View file

@ -600,8 +600,8 @@
<note />
</trans-unit>
<trans-unit id="UnsupportedProjectType">
<source>Unsupported project type. Please check with your sdk provider.</source>
<target state="translated">不支援的專案類型。請與 SDK 提供者連絡。</target>
<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="needs-review-translation">不支援的專案類型。請與 SDK 提供者連絡。</target>
<note />
</trans-unit>
<trans-unit id="InvalidSolutionFormatString">
@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}"
<target state="needs-review-translation">命令 '{0}' 的開頭有一個點 (.)。</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsHigher">
<source>Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</source>
<target state="new">Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMalformed">
<source>Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMissing">
<source>Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<DotNetCliTool>
<DotNetCliTool Version="1" >
<Commands>
<Command Name="sayhello" EntryPoint="console.dll" Runner="dotnet" />
</Commands>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<DotNetCliTool Version="2">
<Commands>
<Command Name="sayhello" EntryPoint="console.dll" Runner="dotnet" />
</Commands>
</DotNetCliTool>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<DotNetCliTool>
<Commands>
<Command Name="sayhello" EntryPoint="console.dll" Runner="dotnet" />
</Commands>
</DotNetCliTool>

View file

@ -34,6 +34,12 @@
<None Update="DotnetToolSettingsGolden.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="DotnetToolSettingsMissingVersion.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="DotnetToolSettingsMajorHigherVersion.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Compile Remove="SampleGlobalTool/**" />
<Content Remove="SampleGlobalTool/**" />

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<DotNetCliTool>
<?xml version="1.0" encoding="utf-8" ?>
<DotNetCliTool Version="1" >
<Commands>
<Command Name="demo" EntryPoint="consoledemo.dll" Runner="dotnet" />
</Commands>

View file

@ -41,6 +41,30 @@ namespace Microsoft.DotNet.ToolPackage.Tests
.Contain(CommonLocalizableStrings.ToolSettingsMissingCommandName);
}
[Fact]
public void GivenMissingVersionItHasWarningReflectIt()
{
ToolConfiguration toolConfiguration = ToolConfigurationDeserializer.Deserialize("DotnetToolSettingsMissingVersion.xml");
toolConfiguration.Warnings.First().Should().Be(CommonLocalizableStrings.FormatVersionIsMissing);
}
[Fact]
public void GivenMajorHigherVersionItHasWarningReflectIt()
{
ToolConfiguration toolConfiguration = ToolConfigurationDeserializer.Deserialize("DotnetToolSettingsMajorHigherVersion.xml");
toolConfiguration.Warnings.First().Should().Be(CommonLocalizableStrings.FormatVersionIsHigher);
}
[Fact]
public void GivenMinorHigherVersionItHasNoWarning()
{
ToolConfiguration toolConfiguration = ToolConfigurationDeserializer.Deserialize("DotnetToolSettingsGolden.xml");
toolConfiguration.Warnings.Should().BeEmpty();
}
[Fact]
public void GivenInvalidCharAsFileNameItThrows()
{

View file

@ -22,17 +22,20 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks
private readonly IProjectRestorer _projectRestorer;
private readonly IFileSystem _fileSystem;
private readonly Action _installCallback;
private readonly Dictionary<PackageId, IEnumerable<string>> _warningsMap;
public ToolPackageInstallerMock(
IFileSystem fileSystem,
IToolPackageStore store,
IProjectRestorer projectRestorer,
Action installCallback = null)
Action installCallback = null,
Dictionary<PackageId, IEnumerable<string>> warningsMap = null)
{
_fileSystem = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem));
_store = store ?? throw new ArgumentNullException(nameof(store));
_projectRestorer = projectRestorer ?? throw new ArgumentNullException(nameof(projectRestorer));
_installCallback = installCallback;
_warningsMap = warningsMap ?? new Dictionary<PackageId, IEnumerable<string>>();
}
public IToolPackage InstallPackage(PackageId packageId,
@ -86,7 +89,10 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks
_fileSystem.Directory.Move(stageDirectory.Value, packageDirectory.Value);
rollbackDirectory = packageDirectory.Value;
return new ToolPackageMock(_fileSystem, packageId, version, packageDirectory);
IEnumerable<string> warnings = null;
_warningsMap.TryGetValue(packageId, out warnings);
return new ToolPackageMock(_fileSystem, packageId, version, packageDirectory, warnings: warnings);
},
rollback: () => {
if (rollbackDirectory != null && _fileSystem.Directory.Exists(rollbackDirectory))

View file

@ -17,13 +17,15 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks
private IFileSystem _fileSystem;
private Lazy<IReadOnlyList<CommandSettings>> _commands;
private Action _uninstallCallback;
private IEnumerable<string> _warnings;
public ToolPackageMock(
IFileSystem fileSystem,
PackageId id,
NuGetVersion version,
DirectoryPath packageDirectory,
Action uninstallCallback = null)
Action uninstallCallback = null,
IEnumerable<string> warnings = null)
{
_fileSystem = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem));
Id = id;
@ -31,6 +33,7 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks
PackageDirectory = packageDirectory;
_commands = new Lazy<IReadOnlyList<CommandSettings>>(GetCommands);
_uninstallCallback = uninstallCallback;
_warnings = warnings ?? new List<string>();
}
public PackageId Id { get; private set; }
@ -47,6 +50,8 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks
}
}
public IEnumerable<string> Warnings => _warnings;
public void Uninstall()
{
var rootDirectory = PackageDirectory.GetParentPath();

View file

@ -64,9 +64,7 @@ namespace Microsoft.DotNet.Migration.Tests
slnProject.FilePath.Should().Be(Path.Combine("..", "TestLibrary", "TestLibrary.csproj"));
slnProject = nonSolutionFolderProjects.Where((p) => p.Name == "subdir").Single();
//ISSUE: https://github.com/dotnet/sdk/issues/522
//Once we have that change migrate will always burn in the C# guid
//slnProject.TypeGuid.Should().Be(ProjectTypeGuids.CSharpProjectTypeGuid);
slnProject.TypeGuid.Should().Be(ProjectTypeGuids.CSharpProjectTypeGuid);
slnProject.FilePath.Should().Be(Path.Combine("src", "subdir", "subdir.csproj"));
}
}

View file

@ -364,6 +364,66 @@ namespace Microsoft.DotNet.Cli.Run.Tests
cmd.StdErr.Should().BeEmpty();
}
[Fact]
public void ItPrefersTheValueOfAppUrlFromEnvVarOverTheProp()
{
var testAppName = "AppWithApplicationUrlInLaunchSettings";
var testInstance = TestAssets.Get(testAppName)
.CreateInstance()
.WithSourceFiles();
var testProjectDirectory = testInstance.Root.FullName;
new RestoreCommand()
.WithWorkingDirectory(testProjectDirectory)
.Execute("/p:SkipInvalidConfigurations=true")
.Should().Pass();
new BuildCommand()
.WithWorkingDirectory(testProjectDirectory)
.Execute()
.Should().Pass();
var cmd = new RunCommand()
.WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput("--launch-profile First");
cmd.Should().Pass()
.And.HaveStdOutContaining("http://localhost:12345/");
cmd.StdErr.Should().BeEmpty();
}
[Fact]
public void ItUsesTheValueOfAppUrlIfTheEnvVarIsNotSet()
{
var testAppName = "AppWithApplicationUrlInLaunchSettings";
var testInstance = TestAssets.Get(testAppName)
.CreateInstance()
.WithSourceFiles();
var testProjectDirectory = testInstance.Root.FullName;
new RestoreCommand()
.WithWorkingDirectory(testProjectDirectory)
.Execute("/p:SkipInvalidConfigurations=true")
.Should().Pass();
new BuildCommand()
.WithWorkingDirectory(testProjectDirectory)
.Execute()
.Should().Pass();
var cmd = new RunCommand()
.WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput("--launch-profile Second");
cmd.Should().Pass()
.And.HaveStdOutContaining("http://localhost:54321/");
cmd.StdErr.Should().BeEmpty();
}
[Fact]
public void ItGivesAnErrorWhenTheLaunchProfileNotFound()
{

View file

@ -867,10 +867,9 @@ EndGlobal
}
[Theory]
//ISSUE: https://github.com/dotnet/sdk/issues/522
//[InlineData("SlnFileWithNoProjectReferencesAndCSharpProject", "CSharpProject", "CSharpProject.csproj", ProjectTypeGuids.CSharpProjectTypeGuid)]
//[InlineData("SlnFileWithNoProjectReferencesAndFSharpProject", "FSharpProject", "FSharpProject.fsproj", "{F2A71F9B-5D33-465A-A702-920D77279786}")]
//[InlineData("SlnFileWithNoProjectReferencesAndVBProject", "VBProject", "VBProject.vbproj", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}")]
[InlineData("SlnFileWithNoProjectReferencesAndCSharpProject", "CSharpProject", "CSharpProject.csproj", ProjectTypeGuids.CSharpProjectTypeGuid)]
[InlineData("SlnFileWithNoProjectReferencesAndFSharpProject", "FSharpProject", "FSharpProject.fsproj", ProjectTypeGuids.FSharpProjectTypeGuid)]
[InlineData("SlnFileWithNoProjectReferencesAndVBProject", "VBProject", "VBProject.vbproj", ProjectTypeGuids.VBProjectTypeGuid)]
[InlineData("SlnFileWithNoProjectReferencesAndUnknownProjectWithSingleProjectTypeGuid", "UnknownProject", "UnknownProject.unknownproj", "{130159A9-F047-44B3-88CF-0CF7F02ED50F}")]
[InlineData("SlnFileWithNoProjectReferencesAndUnknownProjectWithMultipleProjectTypeGuids", "UnknownProject", "UnknownProject.unknownproj", "{130159A9-F047-44B3-88CF-0CF7F02ED50F}")]
public void WhenPassedAProjectItAddsCorrectProjectTypeGuid(
@ -891,8 +890,8 @@ EndGlobal
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput($"sln App.sln add {projectToAdd}");
cmd.Should().Pass();
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ProjectAddedToTheSolution, projectToAdd));
cmd.StdErr.Should().BeEmpty();
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ProjectAddedToTheSolution, projectToAdd));
var slnFile = SlnFile.Read(Path.Combine(projectDirectory, "App.sln"));
var nonSolutionFolderProjects = slnFile.Projects.Where(
@ -901,6 +900,35 @@ EndGlobal
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]
private void WhenSlnContainsSolutionFolderWithDifferentCasingItDoesNotCreateDuplicate()
{

View file

@ -137,6 +137,37 @@ namespace Microsoft.DotNet.Tests.Commands
_reporter.Lines.First().Should().Be(EnvironmentPathInstructionMock.MockInstructionText);
}
[Fact]
public void WhenRunWithPackageIdPackageFormatIsNotFullySupportedItShouldShowPathInstruction()
{
const string Warning = "WARNING";
var injectedWarnings = new Dictionary<PackageId, IEnumerable<string>>()
{
[new PackageId(PackageId)] = new List<string>() { Warning }
};
var toolPackageInstaller = new ToolPackageInstallerMock(
fileSystem: _fileSystem,
store: _toolPackageStore,
projectRestorer: new ProjectRestorerMock(
fileSystem: _fileSystem,
reporter: _reporter),
warningsMap: injectedWarnings);
var installToolCommand = new ToolInstallCommand(
_appliedCommand,
_parseResult,
(_) => (_toolPackageStore, toolPackageInstaller),
_createShellShimRepository,
_environmentPathInstructionMock,
_reporter);
installToolCommand.Execute().Should().Be(0);
_reporter.Lines.First().Should().Be(Warning.Yellow());
_reporter.Lines.Skip(1).First().Should().Be(EnvironmentPathInstructionMock.MockInstructionText);
}
[Fact]
public void GivenFailedPackageInstallWhenRunWithPackageIdItShouldFail()
{