Merge branch 'rel/1.0.0' into make-migration-backup-folder-peer-of-project

This commit is contained in:
Jon Sequeira 2016-12-20 15:24:33 -08:00 committed by GitHub
commit 35e3625d4b
45 changed files with 690 additions and 64 deletions

View file

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace TestApp
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello from main");
Console.WriteLine(TestLibrary.Lib.GetMessage());
Console.WriteLine(subdir.Helper.GetMessage());
}
}
}

View file

@ -0,0 +1,28 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "TestApp", "TestApp.xproj", "{411BC0C0-497A-45C2-B6F7-0B428A6A9AEF}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "TestLibrary", "..\TestLibrary\TestLibrary.xproj", "{B2E306B6-B490-46AC-A421-AA3B7D38EDF0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{411BC0C0-497A-45C2-B6F7-0B428A6A9AEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{411BC0C0-497A-45C2-B6F7-0B428A6A9AEF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{411BC0C0-497A-45C2-B6F7-0B428A6A9AEF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{411BC0C0-497A-45C2-B6F7-0B428A6A9AEF}.Release|Any CPU.Build.0 = Release|Any CPU
{B2E306B6-B490-46AC-A421-AA3B7D38EDF0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B2E306B6-B490-46AC-A421-AA3B7D38EDF0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B2E306B6-B490-46AC-A421-AA3B7D38EDF0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B2E306B6-B490-46AC-A421-AA3B7D38EDF0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>0138cb8f-4aa9-4029-a21e-c07c30f425ba</ProjectGuid>
<RootNamespace>TestApp</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="src\subdir\subdir.csproj" />
</ItemGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

View file

@ -0,0 +1,27 @@
{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.1"
},
"TestLibrary": {
"target": "project",
"version": "1.0.0-*"
},
"subdir": {
"target": "project",
"version": "1.0.0-*"
}
},
"frameworks": {
"netcoreapp1.0": {
"imports": "dnxcore50"
}
}
}

View file

@ -0,0 +1,15 @@
// 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 subdir
{
public static class Helper
{
public static string GetMessage()
{
return "This string came from the subdir test library!";
}
}
}

View file

@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<PropertyGroup>
<TargetFramework>netstandard1.5</TargetFramework>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<AssemblyName>subdir</AssemblyName>
<PackageId>subdir</PackageId>
<ProjectGuid>F8F96F4A-F10C-4C54-867C-A9EFF55494C8</ProjectGuid>
</PropertyGroup>
<ItemGroup>
<Compile Include="**\*.cs" />
<EmbeddedResource Include="**\*.resx" Exclude="@(EmbeddedResource)" />
<EmbeddedResource Include="compiler\resources\**\*" Exclude="@(EmbeddedResource)" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="NETStandard.Library">
<Version>1.6.0</Version>
</PackageReference>
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
</Project>

View file

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace TestLibrary
{
public static class Lib
{
public static string GetMessage()
{
return "Hello from TestLibrary.Lib";
}
}
}

View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>dc0b35d0-8a36-4b52-8a11-b86739f055d2</ProjectGuid>
<RootNamespace>TestLibrary</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

View file

@ -0,0 +1,13 @@
{
"version": "1.0.0-*",
"dependencies": {
"NETStandard.Library": "1.6.0"
},
"frameworks": {
"netstandard1.6": {
"imports": "dnxcore50"
}
}
}

View file

@ -11,6 +11,7 @@ namespace TestApp
public static int Main(string[] args)
{
Console.WriteLine(TestLibrary.Helper.GetMessage());
Console.WriteLine(subdir.Helper.GetMessage());
return 100;
}
}

View file

@ -7,12 +7,19 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "TestApp", "TestApp.xproj",
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "TestLibrary", "..\TestLibrary\TestLibrary.xproj", "{DC0B35D0-8A36-4B52-8A11-B86739F055D2}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "subdir", "src\subdir\subdir.xproj", "{F8F96F4A-F10C-4C54-867C-A9EFF55494C8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0138CB8F-4AA9-4029-A21E-C07C30F425BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0138CB8F-4AA9-4029-A21E-C07C30F425BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0138CB8F-4AA9-4029-A21E-C07C30F425BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DC0B35D0-8A36-4B52-8A11-B86739F055D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DC0B35D0-8A36-4B52-8A11-B86739F055D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0138CB8F-4AA9-4029-A21E-C07C30F425BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0138CB8F-4AA9-4029-A21E-C07C30F425BA}.Release|Any CPU.Build.0 = Release|Any CPU
{DC0B35D0-8A36-4B52-8A11-B86739F055D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DC0B35D0-8A36-4B52-8A11-B86739F055D2}.Release|Any CPU.Build.0 = Release|Any CPU

View file

@ -15,4 +15,4 @@
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
</Project>

View file

@ -9,6 +9,10 @@
"target": "project",
"version": "1.0.0-*"
},
"subdir": {
"target": "project",
"version": "1.0.0-*"
},
"Microsoft.NETCore.App": "1.0.1"
},
"frameworks": {

View file

@ -0,0 +1,15 @@
// 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 subdir
{
public static class Helper
{
public static string GetMessage()
{
return "This string came from the subdir test library!";
}
}
}

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.23107" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.23107</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>F8F96F4A-F10C-4C54-867C-A9EFF55494C8</ProjectGuid>
<RootNamespace>TestAppWithContents</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\..\artifacts\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

View file

@ -15,4 +15,4 @@
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
</Project>

View file

@ -0,0 +1,16 @@
{
"version": "1.0.0-*",
"buildOptions": {
"nowarn": [
"CS1591"
],
"additionalArguments": [
"-highentropyva+"
]
},"dependencies": {
"NETStandard.Library": "1.6.0"
},
"frameworks": {
"netstandard1.5": {}
}
}

View file

@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<PropertyGroup>
<TargetFramework>netstandard1.4</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="**\*.cs" />
<EmbeddedResource Include="**\*.resx" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="NETStandard.Library" Version="1.6" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,18 @@
// 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.Diagnostics;
namespace TestApp
{
public class Program
{
public static int Main(string[] args)
{
Console.WriteLine(TestLibrary.Helper.GetMessage());
Console.WriteLine(subdir.Helper.GetMessage());
return 100;
}
}
}

View file

@ -0,0 +1,30 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "TestApp", "TestApp.xproj", "{0138CB8F-4AA9-4029-A21E-C07C30F425BA}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "TestLibrary", "..\TestLibrary\TestLibrary.xproj", "{DC0B35D0-8A36-4B52-8A11-B86739F055D2}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "subdir", "src\subdir\subdir.xproj", "{F8F96F4A-F10C-4C54-867C-A9EFF55494C8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0138CB8F-4AA9-4029-A21E-C07C30F425BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0138CB8F-4AA9-4029-A21E-C07C30F425BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DC0B35D0-8A36-4B52-8A11-B86739F055D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DC0B35D0-8A36-4B52-8A11-B86739F055D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0138CB8F-4AA9-4029-A21E-C07C30F425BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0138CB8F-4AA9-4029-A21E-C07C30F425BA}.Release|Any CPU.Build.0 = Release|Any CPU
{DC0B35D0-8A36-4B52-8A11-B86739F055D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DC0B35D0-8A36-4B52-8A11-B86739F055D2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.23107" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.23107</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>0138cb8f-4aa9-4029-a21e-c07c30f425ba</ProjectGuid>
<RootNamespace>TestAppWithContents</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\..\artifacts\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

View file

@ -0,0 +1,34 @@
{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"dependencies": {
"TestLibrary": {
"target": "project",
"version": "1.0.0-*"
},
"subdir": {
"target": "project",
"version": "1.0.0-*"
},
"Microsoft.NETCore.App": "1.0.1"
},
"frameworks": {
"netcoreapp1.0": {}
},
"runtimes": {
"win7-x64": {},
"win7-x86": {},
"osx.10.10-x64": {},
"osx.10.11-x64": {},
"ubuntu.14.04-x64": {},
"ubuntu.16.04-x64": {},
"centos.7-x64": {},
"rhel.7.2-x64": {},
"debian.8-x64": {},
"fedora.23-x64": {},
"opensuse.13.2-x64": {}
}
}

View file

@ -0,0 +1,15 @@
// 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 subdir
{
public static class Helper
{
public static string GetMessage()
{
return "This string came from the subdir test library!";
}
}
}

View file

@ -0,0 +1,16 @@
{
"version": "1.0.0-*",
"buildOptions": {
"nowarn": [
"CS1591"
],
"additionalArguments": [
"-highentropyva+"
]
},"dependencies": {
"NETStandard.Library": "1.6.0"
},
"frameworks": {
"netstandard1.5": {}
}
}

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.23107" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.23107</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>F8F96F4A-F10C-4C54-867C-A9EFF55494C8</ProjectGuid>
<RootNamespace>TestAppWithContents</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\..\artifacts\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

View file

@ -0,0 +1,15 @@
// 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 TestLibrary
{
public static class Helper
{
public static string GetMessage()
{
return "This string came from the test library!";
}
}
}

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.23107" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.23107</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>dc0b35d0-8a36-4b52-8a11-b86739f055d2</ProjectGuid>
<RootNamespace>TestAppWithContents</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\..\artifacts\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

View file

@ -0,0 +1,16 @@
{
"version": "1.0.0-*",
"buildOptions": {
"nowarn": [
"CS1591"
],
"additionalArguments": [
"-highentropyva+"
]
},"dependencies": {
"NETStandard.Library": "1.6.0"
},
"frameworks": {
"netstandard1.5": {}
}
}

View file

@ -17,6 +17,10 @@
<Compile Include="**\*.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="../Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Sdk">
<Version>$(CLI_NETSDK_Version)</Version>

View file

@ -31,10 +31,10 @@ using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.IO;
using System.Collections;
using System.Text.RegularExpressions;
using System.Globalization;
using System.Reflection;
using Microsoft.DotNet.Cli.Sln.Internal.FileManipulation;
using Microsoft.DotNet.Tools.Common;
namespace Microsoft.DotNet.Cli.Sln.Internal
{
@ -254,7 +254,20 @@ namespace Microsoft.DotNet.Cli.Sln.Internal
public string Id { get; set; }
public string TypeGuid { get; set; }
public string Name { get; set; }
public string FilePath { get; set; }
private string _filePath;
public string FilePath
{
get
{
return _filePath;
}
set
{
_filePath = PathUtility.GetPathWithDirectorySeparator(value);
}
}
public int Line { get; private set; }
internal bool Processed { get; set; }
@ -337,7 +350,7 @@ namespace Microsoft.DotNet.Cli.Sln.Internal
writer.Write("\") = \"");
writer.Write(Name);
writer.Write("\", \"");
writer.Write(FilePath);
writer.Write(PathUtility.GetPathWithBackSlashes(FilePath));
writer.Write("\", \"");
writer.Write(Id);
writer.WriteLine("\"");

View file

@ -326,7 +326,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration
continue;
}
foreach (var projectDirectory in directory.EnumerateDirectories())
foreach (var projectDirectory in
Enumerable.Repeat(directory, 1).Union(directory.GetDirectories()))
{
// Create the path to the project.json file.
var projectFilePath = Path.Combine(projectDirectory.FullName, "project.json");

View file

@ -134,7 +134,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration
var projectName = migrationRuleInputs.DefaultProjectContext.GetProjectName();
try
{
{
if (IsMigrated(migrationSettings, migrationRuleInputs))
{
MigrationTrace.Instance.WriteLine(String.Format(LocalizableStrings.SkipMigrationAlreadyMigrated, nameof(ProjectMigrator), migrationSettings.ProjectDirectory));
@ -156,9 +156,34 @@ namespace Microsoft.DotNet.ProjectJsonMigration
return new ProjectMigrationReport(migrationSettings.ProjectDirectory, projectName, error, null);
}
List<string> csprojDependencies = null;
if (migrationRuleInputs.ProjectXproj != null)
{
var projectDependencyFinder = new ProjectDependencyFinder();
var dependencies = projectDependencyFinder.ResolveXProjProjectDependencies(
migrationRuleInputs.ProjectXproj);
if (dependencies.Any())
{
csprojDependencies = dependencies
.SelectMany(r => r.Includes().Select(p => PathUtility.GetPathWithDirectorySeparator(p)))
.ToList();
}
else
{
csprojDependencies = new List<string>();
}
}
var outputProject = Path.Combine(migrationSettings.OutputDirectory, projectName + ".csproj");
return new ProjectMigrationReport(migrationSettings.ProjectDirectory, projectName, outputProject, null);
return new ProjectMigrationReport(
migrationSettings.ProjectDirectory,
projectName,
outputProject,
null,
null,
csprojDependencies);
}
private MigrationRuleInputs ComputeMigrationRuleInputs(MigrationSettings migrationSettings)

View file

@ -17,6 +17,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration
public List<string> Warnings { get; }
public List<string> PreExistingCsprojDependencies { get; }
public bool Skipped { get; }
public bool Failed => Errors.Any();
@ -24,22 +26,38 @@ namespace Microsoft.DotNet.ProjectJsonMigration
public bool Succeeded => !Errors.Any();
public ProjectMigrationReport(string projectDirectory, string projectName, bool skipped)
: this(projectDirectory, projectName, null, null, null, skipped: skipped) { }
: this(projectDirectory, projectName, null, null, null, null, skipped: skipped) { }
public ProjectMigrationReport(string projectDirectory, string projectName, List<MigrationError> errors, List<string> warnings)
: this(projectDirectory, projectName, null, errors, warnings) { }
public ProjectMigrationReport(
string projectDirectory,
string projectName,
List<MigrationError> errors,
List<string> warnings)
: this(projectDirectory, projectName, null, errors, warnings, null) { }
public ProjectMigrationReport(string projectDirectory, string projectName, string outputMSBuildProject, List<string> warnings)
: this(projectDirectory, projectName, outputMSBuildProject, null, warnings) { }
public ProjectMigrationReport(
string projectDirectory,
string projectName,
string outputMSBuildProject,
List<string> warnings)
: this(projectDirectory, projectName, outputMSBuildProject, null, warnings, null) { }
private ProjectMigrationReport(string projectDirectory, string projectName, string outputMSBuildProject, List<MigrationError> errors, List<string> warnings, bool skipped=false)
public ProjectMigrationReport(
string projectDirectory,
string projectName,
string outputMSBuildProject,
List<MigrationError> errors,
List<string> warnings,
List<string> preExistingCsprojDependencies,
bool skipped = false)
{
ProjectDirectory = projectDirectory;
ProjectName = projectName;
OutputMSBuildProject = outputMSBuildProject;
Errors = errors ?? new List<MigrationError>();
Warnings = warnings ?? new List<string>();
Skipped=skipped;
PreExistingCsprojDependencies = preExistingCsprojDependencies ?? new List<string>();
Skipped =skipped;
}
}
}

View file

@ -62,7 +62,7 @@ namespace Microsoft.DotNet.Tools.Add.ProjectToSolution
private void AddProject(SlnFile slnFile, string projectPath)
{
var projectPathNormalized = PathUtility.GetPathWithBackSlashes(projectPath);
var projectPathNormalized = PathUtility.GetPathWithDirectorySeparator(projectPath);
if (slnFile.Projects.Any((p) =>
string.Equals(p.FilePath, projectPathNormalized, StringComparison.OrdinalIgnoreCase)))

View file

@ -8,6 +8,7 @@ using System.Linq;
using System.Text;
using Microsoft.Build.Construction;
using Microsoft.Build.Evaluation;
using Microsoft.DotNet.Cli;
using Microsoft.DotNet.Cli.Sln.Internal;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.ProjectJsonMigration;
@ -108,24 +109,59 @@ namespace Microsoft.DotNet.Tools.Migrate
return;
}
foreach (var project in _slnFile.Projects)
List<string> csprojFilesToAdd = new List<string>();
var slnPathWithTrailingSlash = PathUtility.EnsureTrailingSlash(_slnFile.BaseDirectory);
foreach (var report in migrationReport.ProjectMigrationReports)
{
var projectDirectory = Path.Combine(
_slnFile.BaseDirectory,
Path.GetDirectoryName(project.FilePath));
var reportPathWithTrailingSlash = PathUtility.EnsureTrailingSlash(report.ProjectDirectory);
var reportRelPath = Path.Combine(
PathUtility.GetRelativePath(slnPathWithTrailingSlash, reportPathWithTrailingSlash),
report.ProjectName + ".xproj");
var csprojFiles = new DirectoryInfo(projectDirectory)
.EnumerateFiles()
.Where(f => f.Extension == ".csproj");
var projects = _slnFile.Projects.Where(p => p.FilePath == reportRelPath);
if (csprojFiles.Count() == 1)
var migratedProjectName = report.ProjectName + ".csproj";
if (projects.Count() == 1)
{
project.FilePath = Path.Combine(Path.GetDirectoryName(project.FilePath), csprojFiles.First().Name);
project.TypeGuid = ProjectTypeGuids.CSharpProjectTypeGuid;
var slnProject = projects.Single();
slnProject.FilePath = Path.Combine(
Path.GetDirectoryName(slnProject.FilePath),
migratedProjectName);
slnProject.TypeGuid = ProjectTypeGuids.CSharpProjectTypeGuid;
}
else
{
csprojFilesToAdd.Add(Path.Combine(report.ProjectDirectory, migratedProjectName));
}
foreach (var preExisting in report.PreExistingCsprojDependencies)
{
csprojFilesToAdd.Add(Path.Combine(report.ProjectDirectory, preExisting));
}
}
_slnFile.Write();
foreach (var csprojFile in csprojFilesToAdd)
{
AddProject(_slnFile.FullPath, csprojFile);
}
}
private void AddProject(string slnPath, string csprojPath)
{
List<string> args = new List<string>()
{
"add",
slnPath,
"project",
csprojPath,
};
var dotnetPath = Path.Combine(AppContext.BaseDirectory, "dotnet.dll");
var addCommand = new ForwardingApp(dotnetPath, args);
addCommand.Execute();
}
private void MoveProjectJsonArtifactsToBackup(MigrationReport migrationReport)

View file

@ -59,7 +59,7 @@ namespace Microsoft.DotNet.Tools.Remove.ProjectFromSolution
private bool RemoveProject(SlnFile slnFile, string projectPath)
{
var projectPathNormalized = PathUtility.GetPathWithBackSlashes(projectPath);
var projectPathNormalized = PathUtility.GetPathWithDirectorySeparator(projectPath);
var projectsToRemove = slnFile.Projects.Where((p) =>
string.Equals(p.FilePath, projectPathNormalized, StringComparison.OrdinalIgnoreCase)).ToList();

View file

@ -185,12 +185,12 @@ Additional Arguments:
.FullName;
var projectToAdd = "Lib/Lib.csproj";
var normalizedProjectPath = @"Lib\Lib.csproj";
var projectPath = Path.Combine("Lib", "Lib.csproj");
var cmd = new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput($"add App.sln project {projectToAdd}");
cmd.Should().Pass();
cmd.StdOut.Should().Be($"Project `{Path.Combine("Lib", "Lib.csproj")}` added to the solution.");
cmd.StdOut.Should().Be($"Project `{projectPath}` added to the solution.");
cmd.StdErr.Should().BeEmpty();
var slnFile = SlnFile.Read(Path.Combine(projectDirectory, "App.sln"));
@ -200,7 +200,7 @@ Additional Arguments:
matchingProjects.Count.Should().Be(1);
var slnProject = matchingProjects[0];
slnProject.FilePath.Should().Be(normalizedProjectPath);
slnProject.FilePath.Should().Be(projectPath);
slnProject.TypeGuid.Should().Be(ProjectTypeGuids.CPSProjectTypeGuid);
if (!string.IsNullOrEmpty(projectGuid))
{

View file

@ -163,10 +163,10 @@ Options:
[Fact]
public void WhenProjectReferencesArePresentInTheSolutionItListsThem()
{
const string OutputText = @"Project reference(s)
string OutputText = $@"Project reference(s)
--------------------
App\App.csproj
Lib\Lib.csproj";
{Path.Combine("App", "App.csproj")}
{Path.Combine("Lib", "Lib.csproj")}";
var projectDirectory = TestAssets
.Get("TestAppWithSlnAndExistingCsprojReferences")

View file

@ -0,0 +1,84 @@
// 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 FluentAssertions;
using Microsoft.DotNet.Cli.Sln.Internal;
using Microsoft.DotNet.TestFramework;
using Microsoft.DotNet.Tools.Test.Utilities;
using System.IO;
using System.Linq;
using Xunit;
namespace Microsoft.DotNet.Migration.Tests
{
public class GivenThatIWantToMigrateSolutions : TestBase
{
[Fact]
public void ItMigratesAndBuildsSln()
{
MigrateAndBuild(
"NonRestoredTestProjects",
"PJAppWithSlnAndXprojRefs",
ProjectTypeGuids.CSharpProjectTypeGuid);
}
[Fact]
public void WhenDirectoryAlreadyContainsCsprojFileItMigratesAndBuildsSln()
{
MigrateAndBuild(
"NonRestoredTestProjects",
"PJAppWithSlnAndXprojRefsAndUnrelatedCsproj",
ProjectTypeGuids.CSharpProjectTypeGuid);
}
[Fact]
public void WhenXprojReferencesCsprojAndSlnDoesNotItMigratesAndBuildsSln()
{
MigrateAndBuild(
"NonRestoredTestProjects",
"PJAppWithSlnAndXprojRefThatRefsCsprojWhereSlnDoesNotRefCsproj",
ProjectTypeGuids.CPSProjectTypeGuid);
}
private void MigrateAndBuild(string groupName, string projectName, string subdirProjectTypeGuid)
{
var projectDirectory = TestAssets
.Get(groupName, projectName)
.CreateInstance()
.WithSourceFiles()
.Root;
var solutionRelPath = Path.Combine("TestApp", "TestApp.sln");
new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.Execute($"migrate \"{solutionRelPath}\"")
.Should().Pass();
new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.Execute($"restore \"{Path.Combine("TestApp", "TestApp.csproj")}\"")
.Should().Pass();
new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.Execute($"build \"{solutionRelPath}\"")
.Should().Pass();
SlnFile slnFile = SlnFile.Read(Path.Combine(projectDirectory.FullName, solutionRelPath));
slnFile.Projects.Count.Should().Be(3);
var slnProject = slnFile.Projects.Where((p) => p.Name == "TestApp").Single();
slnProject.TypeGuid.Should().Be(ProjectTypeGuids.CSharpProjectTypeGuid);
slnProject.FilePath.Should().Be("TestApp.csproj");
slnProject = slnFile.Projects.Where((p) => p.Name == "TestLibrary").Single();
slnProject.TypeGuid.Should().Be(ProjectTypeGuids.CSharpProjectTypeGuid);
slnProject.FilePath.Should().Be(Path.Combine("..", "TestLibrary", "TestLibrary.csproj"));
slnProject = slnFile.Projects.Where((p) => p.Name == "subdir").Single();
slnProject.TypeGuid.Should().Be(subdirProjectTypeGuid);
slnProject.FilePath.Should().Be(Path.Combine("src", "subdir", "subdir.csproj"));
}
}
}

View file

@ -1,4 +1,7 @@
using Microsoft.Build.Construction;
// 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 Microsoft.Build.Construction;
using Microsoft.DotNet.TestFramework;
using Microsoft.DotNet.Tools.Test.Utilities;
using System;
@ -494,24 +497,6 @@ namespace Microsoft.DotNet.Migration.Tests
File.ReadAllText(migrationOutputFile).Should().Contain("MIGRATE1018");
}
[Fact]
public void ItMigratesSln()
{
var rootDirectory = TestAssetsManager.CreateTestInstance(
"TestAppWithSlnAndMultipleProjects").Path;
var testAppProjectDirectory = Path.Combine(rootDirectory, "TestApp");
var testLibProjectDirectory = Path.Combine(rootDirectory, "TestLibrary");
string slnPath = Path.Combine(testAppProjectDirectory, "TestApp.sln");
CleanBinObj(testAppProjectDirectory);
CleanBinObj(testLibProjectDirectory);
MigrateProject(slnPath);
Restore(testAppProjectDirectory, "TestApp.csproj");
BuildMSBuild(testAppProjectDirectory, "TestApp.sln", "Release");
}
private void VerifyAutoInjectedDesktopReferences(string projectDirectory, string projectName, bool shouldBePresent)
{
if (projectName != null)

View file

@ -204,16 +204,15 @@ Additional Arguments:
slnFile.Projects.Count.Should().Be(2);
var projectToRemove = Path.Combine("Lib", "Lib.csproj");
var projectToRemoveNormalized = @"Lib\Lib.csproj";
var cmd = new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput($"remove project {projectToRemove}");
cmd.Should().Pass();
cmd.StdOut.Should().Be($"Project reference `{projectToRemoveNormalized}` removed.");
cmd.StdOut.Should().Be($"Project reference `{projectToRemove}` removed.");
slnFile = SlnFile.Read(solutionPath);
slnFile.Projects.Count.Should().Be(1);
slnFile.Projects[0].FilePath.Should().Be(@"App\App.csproj");
slnFile.Projects[0].FilePath.Should().Be(Path.Combine("App", "App.csproj"));
}
[Fact]
@ -231,19 +230,18 @@ Additional Arguments:
slnFile.Projects.Count.Should().Be(3);
var projectToRemove = Path.Combine("Lib", "Lib.csproj");
var projectToRemoveNormalized = @"Lib\Lib.csproj";
var cmd = new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput($"remove project {projectToRemove}");
cmd.Should().Pass();
string outputText = $@"Project reference `{projectToRemoveNormalized}` removed.
Project reference `{projectToRemoveNormalized}` removed.";
string outputText = $@"Project reference `{projectToRemove}` removed.
Project reference `{projectToRemove}` removed.";
cmd.StdOut.Should().Be(outputText);
slnFile = SlnFile.Read(solutionPath);
slnFile.Projects.Count.Should().Be(1);
slnFile.Projects[0].FilePath.Should().Be(@"App\App.csproj");
slnFile.Projects[0].FilePath.Should().Be(Path.Combine("App", "App.csproj"));
}
[Fact]
@ -261,20 +259,19 @@ Project reference `{projectToRemoveNormalized}` removed.";
slnFile.Projects.Count.Should().Be(2);
var projectToRemove = Path.Combine("Lib", "Lib.csproj");
var projectToRemoveNormalized = @"Lib\Lib.csproj";
var cmd = new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput($"remove project idontexist.csproj {projectToRemove} idontexisteither.csproj");
cmd.Should().Pass();
string outputText = $@"Project reference `idontexist.csproj` could not be found.
Project reference `{projectToRemoveNormalized}` removed.
Project reference `{projectToRemove}` removed.
Project reference `idontexisteither.csproj` could not be found.";
cmd.StdOut.Should().Be(outputText);
slnFile = SlnFile.Read(solutionPath);
slnFile.Projects.Count.Should().Be(1);
slnFile.Projects[0].FilePath.Should().Be(@"App\App.csproj");
slnFile.Projects[0].FilePath.Should().Be(Path.Combine("App", "App.csproj"));
}
}
}