Merge branch 'rel/1.0.0' into localization

This commit is contained in:
Livar 2017-01-18 10:03:18 -08:00 committed by GitHub
commit 073daaf450
8 changed files with 96 additions and 12 deletions

View file

@ -0,0 +1,12 @@
using System;
namespace App.Tests
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}

View file

@ -0,0 +1,19 @@
{
"frameworks": {
"netcoreapp1.0": {
"imports": [
"portable-net451+win8",
"dnxcore50"
],
"buildOptions": {
"define": [ "ASYNC", "COREFX", "XUNIT2", "SQLITE" ]
},
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
}
}
}
}
}

View file

@ -0,0 +1,31 @@
{
"frameworks": {
"net40": {
"frameworkAssemblies": {
"System.Configuration": "4.0.0.0",
"System.Data": "4.0.0.0",
"System.Data.Linq": "4.0.0.0",
"System.Xml": "4.0.0.0"
},
"dependencies": {
"EntityFramework": "6.1.3",
"Microsoft.SqlServer.Types": "11.0.2"
}
},
"net45": {
"buildOptions": {
"define": [ "ASYNC" ]
},
"frameworkAssemblies": {
"System.Configuration": "4.0.0.0",
"System.Data": "4.0.0.0",
"System.Data.Linq": "4.0.0.0",
"System.Xml": "4.0.0.0"
},
"dependencies": {
"EntityFramework": "6.1.3",
"Microsoft.SqlServer.Types": "11.0.2"
}
}
}
}

View file

@ -0,0 +1,6 @@
{
"projects": [
"App",
"App.Tests"
]
}

View file

@ -316,24 +316,25 @@ namespace Microsoft.DotNet.ProjectJsonMigration
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");
// We INTENTIONALLY do not do an exists check here because it requires disk I/O
// Instead, we'll do an exists check when we try to resolve
// Check if we've already added this, just in case it was pre-loaded into the cache
var project = new ProjectDependency(
projectDirectory.Name,
projectFilePath);
projects.Add(project);
AddIfProjectExists(projects, projectDirectory);
}
}
return projects;
}
private static void AddIfProjectExists(List<ProjectDependency> projects, DirectoryInfo projectDirectory)
{
var projectJSONFilePath = Path.Combine(projectDirectory.FullName, "project.json");
var csProjFilePath = Path.Combine(projectDirectory.FullName, $"{projectDirectory.Name}.csproj");
if (File.Exists(projectJSONFilePath) || File.Exists(csProjFilePath))
{
var project = new ProjectDependency(projectDirectory.Name, projectJSONFilePath);
projects.Add(project);
}
}
internal static List<string> GetGlobalPaths(string rootPath)
{
var paths = new List<string>();

View file

@ -163,6 +163,21 @@ namespace Microsoft.DotNet.Migration.Tests
PublishMSBuild(projectDirectory, projectName);
}
[Fact]
public void ItMigratesAPackageReferenceAsSuchEvenIfAFolderWithTheSameNameExistsInTheRepo()
{
var solutionDirectory =
TestAssetsManager.CreateTestInstance("AppWithPackageNamedAfterFolder").Path;
var appProject = Path.Combine(solutionDirectory, "App", "App.csproj");
MigrateProject(solutionDirectory);
var projectRootElement = ProjectRootElement.Open(appProject);
projectRootElement.Items.Where(
i => i.Include == "EntityFramework" && i.ItemType == "PackageReference")
.Should().HaveCount(2);
}
[Fact]
public void ItAddsMicrosoftNetWebSdkToTheSdkAttributeOfAWebApp()
{