diff --git a/Microsoft.DotNet.Cli.sln b/Microsoft.DotNet.Cli.sln
index eec268d1b..9c714a1ca 100644
--- a/Microsoft.DotNet.Cli.sln
+++ b/Microsoft.DotNet.Cli.sln
@@ -121,6 +121,8 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Configurer
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Archive", "src\Microsoft.DotNet.Archive\Microsoft.DotNet.Archive.xproj", "{35B19F22-B8C0-4849-9C35-3F809B7588B8}"
EndProject
+Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "dotnet-build3.Tests", "test\dotnet-build3.Tests\dotnet-build3.Tests.xproj", "{49D7318E-D198-4E2B-BBEA-3A24D805F88D}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -805,22 +807,6 @@ Global
{A28BD8AC-DF15-4F58-8299-98A9AE2B8726}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
{A28BD8AC-DF15-4F58-8299-98A9AE2B8726}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
{A28BD8AC-DF15-4F58-8299-98A9AE2B8726}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
- {1DBB7542-0345-4F4B-A84B-3B00B185D416}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {1DBB7542-0345-4F4B-A84B-3B00B185D416}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {1DBB7542-0345-4F4B-A84B-3B00B185D416}.Debug|x64.ActiveCfg = Debug|Any CPU
- {1DBB7542-0345-4F4B-A84B-3B00B185D416}.Debug|x64.Build.0 = Debug|Any CPU
- {1DBB7542-0345-4F4B-A84B-3B00B185D416}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
- {1DBB7542-0345-4F4B-A84B-3B00B185D416}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
- {1DBB7542-0345-4F4B-A84B-3B00B185D416}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
- {1DBB7542-0345-4F4B-A84B-3B00B185D416}.MinSizeRel|x64.Build.0 = Debug|Any CPU
- {1DBB7542-0345-4F4B-A84B-3B00B185D416}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {1DBB7542-0345-4F4B-A84B-3B00B185D416}.Release|Any CPU.Build.0 = Release|Any CPU
- {1DBB7542-0345-4F4B-A84B-3B00B185D416}.Release|x64.ActiveCfg = Release|Any CPU
- {1DBB7542-0345-4F4B-A84B-3B00B185D416}.Release|x64.Build.0 = Release|Any CPU
- {1DBB7542-0345-4F4B-A84B-3B00B185D416}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
- {1DBB7542-0345-4F4B-A84B-3B00B185D416}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
- {1DBB7542-0345-4F4B-A84B-3B00B185D416}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
- {1DBB7542-0345-4F4B-A84B-3B00B185D416}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
{1C599FFD-FB52-4279-A8E5-465D3EC499E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1C599FFD-FB52-4279-A8E5-465D3EC499E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1C599FFD-FB52-4279-A8E5-465D3EC499E1}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -901,6 +887,22 @@ Global
{35B19F22-B8C0-4849-9C35-3F809B7588B8}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
{35B19F22-B8C0-4849-9C35-3F809B7588B8}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
{35B19F22-B8C0-4849-9C35-3F809B7588B8}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
+ {49D7318E-D198-4E2B-BBEA-3A24D805F88D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {49D7318E-D198-4E2B-BBEA-3A24D805F88D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {49D7318E-D198-4E2B-BBEA-3A24D805F88D}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {49D7318E-D198-4E2B-BBEA-3A24D805F88D}.Debug|x64.Build.0 = Debug|Any CPU
+ {49D7318E-D198-4E2B-BBEA-3A24D805F88D}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
+ {49D7318E-D198-4E2B-BBEA-3A24D805F88D}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
+ {49D7318E-D198-4E2B-BBEA-3A24D805F88D}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
+ {49D7318E-D198-4E2B-BBEA-3A24D805F88D}.MinSizeRel|x64.Build.0 = Debug|Any CPU
+ {49D7318E-D198-4E2B-BBEA-3A24D805F88D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {49D7318E-D198-4E2B-BBEA-3A24D805F88D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {49D7318E-D198-4E2B-BBEA-3A24D805F88D}.Release|x64.ActiveCfg = Release|Any CPU
+ {49D7318E-D198-4E2B-BBEA-3A24D805F88D}.Release|x64.Build.0 = Release|Any CPU
+ {49D7318E-D198-4E2B-BBEA-3A24D805F88D}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
+ {49D7318E-D198-4E2B-BBEA-3A24D805F88D}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
+ {49D7318E-D198-4E2B-BBEA-3A24D805F88D}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
+ {49D7318E-D198-4E2B-BBEA-3A24D805F88D}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -953,11 +955,11 @@ Global
{49BEB486-AB5A-4416-91EA-8CD34ABB0C9D} = {88278B81-7649-45DC-8A6A-D3A645C5AFC3}
{B768BD29-12BF-4C7C-B093-03193FE244D1} = {88278B81-7649-45DC-8A6A-D3A645C5AFC3}
{A28BD8AC-DF15-4F58-8299-98A9AE2B8726} = {88278B81-7649-45DC-8A6A-D3A645C5AFC3}
- {1DBB7542-0345-4F4B-A84B-3B00B185D416} = {88278B81-7649-45DC-8A6A-D3A645C5AFC3}
{1C599FFD-FB52-4279-A8E5-465D3EC499E1} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
{5DF6C9DA-6909-4EC0-909E-6913580BB4A4} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
{E5ED47EF-BF25-4DA9-A7FE-290C642CBF0F} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
{4C3B06D5-B6D5-4E5B-A44F-3EBE52A1C759} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
{35B19F22-B8C0-4849-9C35-3F809B7588B8} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
+ {49D7318E-D198-4E2B-BBEA-3A24D805F88D} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
EndGlobalSection
EndGlobal
diff --git a/TestAssets/TestProjects/MSBuildTestApp/MSBuildTestApp.csproj b/TestAssets/TestProjects/MSBuildTestApp/MSBuildTestApp.csproj
new file mode 100644
index 000000000..ed112f20e
--- /dev/null
+++ b/TestAssets/TestProjects/MSBuildTestApp/MSBuildTestApp.csproj
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+ Debug
+ x64
+ x64
+ Exe
+ MSBuildTestApp
+ $(MSBuildThisFileName)
+ NETCoreApp
+ v1.0
+ bin\$(Configuration)\netcoreapp1.0
+ false
+ true
+ true
+ true
+ .NETCoreApp,Version=v1.0
+
+ win7
+ false
+ none
+
+
+
+
+
+
+
+
+ $(DotnetHostPath)
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/TestAssets/TestProjects/MSBuildTestApp/Program.cs b/TestAssets/TestProjects/MSBuildTestApp/Program.cs
new file mode 100644
index 000000000..8dae6dd9e
--- /dev/null
+++ b/TestAssets/TestProjects/MSBuildTestApp/Program.cs
@@ -0,0 +1,12 @@
+using System;
+
+namespace MSBuildTestApp
+{
+ public class Program
+ {
+ public static void Main(string[] args)
+ {
+ Console.WriteLine("Hello World!");
+ }
+ }
+}
diff --git a/TestAssets/TestProjects/MSBuildTestApp/project.json b/TestAssets/TestProjects/MSBuildTestApp/project.json
new file mode 100644
index 000000000..90bc28bca
--- /dev/null
+++ b/TestAssets/TestProjects/MSBuildTestApp/project.json
@@ -0,0 +1,28 @@
+{
+ "frameworks": {
+ "netcoreapp1.0": {
+ "dependencies": {
+ "Microsoft.NETCore.App": {
+ "version": "1.0.0"
+ }
+ }
+ }
+ },
+ "runtimes": {
+ "win7-x64": {},
+ "win7-x86": {},
+ "win81-x64": {},
+ "win81-x86": {},
+ "win10-x64": {},
+ "win10-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": {}
+ },
+}
diff --git a/build.proj b/build.proj
new file mode 100644
index 000000000..51bd78d57
--- /dev/null
+++ b/build.proj
@@ -0,0 +1,49 @@
+
+
+
+
+
+ powershell -NoProfile -NoLogo -Command
+
+
+ .ps1
+ .sh
+
+ .exe
+
+
+ Prepare;Compile;Test;Package;Publish
+
+
+
+
+
+ $(MSBuildThisFileDirectory)/build_projects/dotnet-cli-build/bin/dotnet-cli-build$(PlatformExeExtension)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/build_projects/dotnet-cli-build/CompileTargets.cs b/build_projects/dotnet-cli-build/CompileTargets.cs
index bfe5255b1..19286231b 100644
--- a/build_projects/dotnet-cli-build/CompileTargets.cs
+++ b/build_projects/dotnet-cli-build/CompileTargets.cs
@@ -201,7 +201,6 @@ namespace Microsoft.DotNet.Cli.Build
var compilersDeps = Path.Combine(sdkOutputDirectory, "compilers.deps.json");
var compilersRuntimeConfig = Path.Combine(sdkOutputDirectory, "compilers.runtimeconfig.json");
-
var binaryToCorehostifyRelDir = Path.Combine("runtimes", "any", "native");
var binaryToCorehostifyOutDir = Path.Combine(sdkOutputDirectory, binaryToCorehostifyRelDir);
// Corehostify binaries
@@ -211,7 +210,7 @@ namespace Microsoft.DotNet.Cli.Build
{
// Yes, it is .exe even on Linux. This is the managed exe we're working with
File.Copy(Path.Combine(binaryToCorehostifyOutDir, $"{binaryToCorehostify}.exe"), Path.Combine(sdkOutputDirectory, $"{binaryToCorehostify}.dll"));
- File.Delete(Path.Combine(binaryToCorehostifyOutDir, $"{binaryToCorehostify}.exe"));
+ File.Move(Path.Combine(binaryToCorehostifyOutDir, $"{binaryToCorehostify}.exe"), Path.Combine(sdkOutputDirectory, $"{binaryToCorehostify}.exe"));
var binaryToCoreHostifyDeps = Path.Combine(sdkOutputDirectory, binaryToCorehostify + ".deps.json");
File.Copy(compilersDeps, Path.Combine(sdkOutputDirectory, binaryToCorehostify + ".deps.json"));
@@ -221,6 +220,8 @@ namespace Microsoft.DotNet.Cli.Build
{
var assetPath = Path.Combine(binaryToCorehostifyRelDir, $"{binaryToRemove}.exe").Replace(Path.DirectorySeparatorChar, '/');
RemoveAssetFromDepsPackages(binaryToCoreHostifyDeps, "runtimeTargets", assetPath);
+ RemoveAssetFromDepsPackages(
+ Path.Combine(sdkOutputDirectory, "dotnet.deps.json"), "runtimeTargets", assetPath);
}
}
catch (Exception ex)
@@ -270,9 +271,31 @@ namespace Microsoft.DotNet.Cli.Build
GenerateNuGetPackagesArchive(c, dotnet, sdkOutputDirectory);
}
+ CopyMSBuildTargetsToSDKRoot(sdkOutputDirectory);
+
return c.Success();
}
+ private static void CopyMSBuildTargetsToSDKRoot(string sdkOutputDirectory)
+ {
+ var msbuildTargetsDirectory = Path.Combine(sdkOutputDirectory, "runtimes", "any", "native");
+
+ var filesToCopy = new List();
+ filesToCopy.AddRange(Directory.EnumerateFiles(msbuildTargetsDirectory, "*.targets", SearchOption.AllDirectories));
+ filesToCopy.AddRange(Directory.EnumerateFiles(msbuildTargetsDirectory, "*.Targets", SearchOption.AllDirectories));
+ filesToCopy.AddRange(Directory.EnumerateFiles(msbuildTargetsDirectory, "*.props", SearchOption.AllDirectories));
+ filesToCopy.AddRange(Directory.EnumerateFiles(msbuildTargetsDirectory, "*.overridetasks", SearchOption.AllDirectories));
+ filesToCopy.AddRange(Directory.EnumerateFiles(msbuildTargetsDirectory, "*.tasks", SearchOption.AllDirectories));
+
+ foreach (var fileFullPath in filesToCopy)
+ {
+ var fileRelativePath = fileFullPath.Substring(msbuildTargetsDirectory.Length + 1);
+ var destinationFilePath = Path.Combine(sdkOutputDirectory, fileRelativePath);
+
+ File.Copy(fileFullPath, destinationFilePath, true);
+ }
+ }
+
private static void GenerateNuGetPackagesArchive(
BuildTargetContext c,
DotNetCli dotnet,
diff --git a/build_projects/dotnet-cli-build/TestTargets.cs b/build_projects/dotnet-cli-build/TestTargets.cs
index 413f411a4..41fc8bb9c 100644
--- a/build_projects/dotnet-cli-build/TestTargets.cs
+++ b/build_projects/dotnet-cli-build/TestTargets.cs
@@ -22,6 +22,7 @@ namespace Microsoft.DotNet.Cli.Build
"EndToEnd",
"dotnet.Tests",
"dotnet-build.Tests",
+ "dotnet-build3.Tests",
"dotnet-compile.Tests",
"dotnet-compile.UnitTests",
// TODO: https://github.com/dotnet/cli/issues/3558
diff --git a/src/dotnet/Program.cs b/src/dotnet/Program.cs
index 7aeb94c89..0dea85aff 100644
--- a/src/dotnet/Program.cs
+++ b/src/dotnet/Program.cs
@@ -37,7 +37,8 @@ namespace Microsoft.DotNet.Cli
["publish"] = PublishCommand.Run,
["restore"] = RestoreCommand.Run,
["run"] = RunCommand.Run,
- ["test"] = TestCommand.Run
+ ["test"] = TestCommand.Run,
+ ["build3"] = Build3Command.Run
};
public static int Main(string[] args)
diff --git a/src/dotnet/commands/dotnet-build3/ForwardingApp.cs b/src/dotnet/commands/dotnet-build3/ForwardingApp.cs
new file mode 100644
index 000000000..c3d14c6dc
--- /dev/null
+++ b/src/dotnet/commands/dotnet-build3/ForwardingApp.cs
@@ -0,0 +1,107 @@
+// 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.DotNet.Cli.Utils;
+using Microsoft.DotNet.ProjectModel;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Threading.Tasks;
+
+namespace Microsoft.DotNet.Cli
+{
+ ///
+ /// A class which encapsulates logic needed to forward arguments from the current process to another process
+ /// invoked with the dotnet.exe host.
+ ///
+ public class ForwardingApp
+ {
+ private const string s_hostExe = "dotnet";
+
+ private readonly string _forwardApplicationPath;
+ private readonly string[] _argsToForward;
+ private readonly string _depsFile;
+ private readonly string _runtimeConfig;
+ private readonly string _additionalProbingPath;
+ private readonly Dictionary _environmentVariables;
+
+ private readonly string[] _allArgs;
+
+ public ForwardingApp(
+ string forwardApplicationPath,
+ string[] argsToForward,
+ string depsFile = null,
+ string runtimeConfig = null,
+ string additionalProbingPath = null,
+ Dictionary environmentVariables = null)
+ {
+ _forwardApplicationPath = forwardApplicationPath;
+ _argsToForward = argsToForward;
+ _depsFile = depsFile;
+ _runtimeConfig = runtimeConfig;
+ _additionalProbingPath = additionalProbingPath;
+ _environmentVariables = environmentVariables;
+
+ var allArgs = new List();
+ allArgs.Add("exec");
+
+ if (_depsFile != null)
+ {
+ allArgs.Add("--depsfile");
+ allArgs.Add(_depsFile);
+ }
+
+ if (_runtimeConfig != null)
+ {
+ allArgs.Add("--runtimeconfig");
+ allArgs.Add(_runtimeConfig);
+ }
+
+ if (_additionalProbingPath != null)
+ {
+ allArgs.Add("--additionalprobingpath");
+ allArgs.Add(_additionalProbingPath);
+ }
+
+ allArgs.Add(_forwardApplicationPath);
+ allArgs.AddRange(_argsToForward);
+
+ _allArgs = allArgs.ToArray();
+ }
+
+ public int Execute()
+ {
+ var processInfo = new ProcessStartInfo
+ {
+ FileName = GetHostExeName(),
+ Arguments = ArgumentEscaper.EscapeAndConcatenateArgArrayForProcessStart(_allArgs),
+ UseShellExecute = false
+ };
+
+ if (_environmentVariables != null)
+ {
+ foreach (var entry in _environmentVariables)
+ {
+ processInfo.Environment[entry.Key] = entry.Value;
+ }
+ }
+
+ var process = new Process
+ {
+ StartInfo = processInfo
+ };
+
+ process.Start();
+ process.WaitForExit();
+
+ return process.ExitCode;
+ }
+
+ private string GetHostExeName()
+ {
+ return $"{s_hostExe}{FileNameSuffixes.CurrentPlatform.Exe}";
+ }
+ }
+}
diff --git a/src/dotnet/commands/dotnet-build3/MSBuildForwardingApp.cs b/src/dotnet/commands/dotnet-build3/MSBuildForwardingApp.cs
new file mode 100644
index 000000000..d8037cd0c
--- /dev/null
+++ b/src/dotnet/commands/dotnet-build3/MSBuildForwardingApp.cs
@@ -0,0 +1,80 @@
+// 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.DotNet.Cli.Utils;
+using Microsoft.DotNet.InternalAbstractions;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace Microsoft.DotNet.Cli
+{
+ public class MSBuildForwardingApp
+ {
+ private const string s_msbuildExeName = "MSBuild.exe";
+ private readonly ForwardingApp _forwardingApp;
+
+ public MSBuildForwardingApp(string[] argsToForward)
+ {
+ _forwardingApp = new ForwardingApp(
+ GetMSBuildExePath(),
+ argsToForward,
+ depsFile: GetDepsFile(),
+ runtimeConfig: GetRuntimeConfig(),
+ environmentVariables: GetEnvironmentVariables());
+ }
+
+ public int Execute()
+ {
+ return _forwardingApp.Execute();
+ }
+
+ private static Dictionary GetEnvironmentVariables()
+ {
+ return new Dictionary
+ {
+ { "MSBuildExtensionsPath", AppContext.BaseDirectory },
+ { "DotnetHostPath", GetHostPath() },
+ { "BaseNuGetRuntimeIdentifier", GetCurrentBaseRid() },
+ { "Platform", GetCurrentArchitecture() },
+ { "PlatformTarget", GetCurrentArchitecture() }
+ };
+ }
+
+ private static string GetCurrentBaseRid()
+ {
+ return RuntimeEnvironment.GetRuntimeIdentifier()
+ .Replace("-" + RuntimeEnvironment.RuntimeArchitecture, "");
+ }
+
+ private static string GetHostPath()
+ {
+ return new Muxer().MuxerPath;
+ }
+
+ private static string GetRuntimeConfig()
+ {
+ return Path.Combine(AppContext.BaseDirectory, "dotnet.runtimeconfig.json");
+ }
+
+ private static string GetDepsFile()
+ {
+ return Path.Combine(AppContext.BaseDirectory, "dotnet.deps.json");
+ }
+
+ private static string GetMSBuildExePath()
+ {
+ return Path.Combine(
+ AppContext.BaseDirectory,
+ "runtimes", "any", "native",
+ s_msbuildExeName);
+ }
+
+ private static string GetCurrentArchitecture()
+ {
+ return RuntimeEnvironment.RuntimeArchitecture;
+ }
+ }
+}
diff --git a/src/dotnet/commands/dotnet-build3/Program.cs b/src/dotnet/commands/dotnet-build3/Program.cs
new file mode 100644
index 000000000..e9efe9698
--- /dev/null
+++ b/src/dotnet/commands/dotnet-build3/Program.cs
@@ -0,0 +1,20 @@
+// 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.DotNet.Cli.Utils;
+using System;
+using System.Diagnostics;
+using System.IO;
+using System.Reflection;
+
+namespace Microsoft.DotNet.Cli
+{
+ public class Build3Command
+ {
+ public static int Run(string[] args)
+ {
+ return new MSBuildForwardingApp(args).Execute();
+ }
+
+ }
+}
diff --git a/src/dotnet/commands/dotnet-new/Program.cs b/src/dotnet/commands/dotnet-new/Program.cs
index e22cce0d6..2a0392d80 100644
--- a/src/dotnet/commands/dotnet-new/Program.cs
+++ b/src/dotnet/commands/dotnet-new/Program.cs
@@ -1,4 +1,7 @@
-using Microsoft.DotNet.Cli.CommandLine;
+// 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.DotNet.Cli.CommandLine;
using Microsoft.DotNet.Cli.Utils;
using System;
using System.Collections.Generic;
diff --git a/src/dotnet/commands/dotnet-pack/PackageGenerator.cs b/src/dotnet/commands/dotnet-pack/PackageGenerator.cs
index 1997b95ec..0ecfb3102 100644
--- a/src/dotnet/commands/dotnet-pack/PackageGenerator.cs
+++ b/src/dotnet/commands/dotnet-pack/PackageGenerator.cs
@@ -19,6 +19,7 @@ using NuGet.Frameworks;
using NuGet.Packaging.Core;
using NuGet.Versioning;
using PackageBuilder = NuGet.PackageBuilder;
+using NuGetConstants = NuGet.Constants;
namespace Microsoft.DotNet.Tools.Compiler
{
@@ -58,7 +59,7 @@ namespace Microsoft.DotNet.Tools.Compiler
var packageOutputPath = Path.Combine(
ArtifactPathsCalculator.PackageOutputPath,
- GetPackageName() + NuGet.Constants.PackageExtension);
+ GetPackageName() + NuGetConstants.PackageExtension);
if (GeneratePackage(packageOutputPath, packDiagnostics))
{
diff --git a/src/dotnet/project.json b/src/dotnet/project.json
index c029b55fb..35116b1ef 100644
--- a/src/dotnet/project.json
+++ b/src/dotnet/project.json
@@ -52,14 +52,25 @@
},
"System.Diagnostics.TraceSource": "4.0.0",
"System.Diagnostics.TextWriterTraceListener": "4.0.0",
- "System.Resources.Writer": "4.0.0",
"System.Runtime.Serialization.Primitives": "4.1.1",
"System.Private.DataContractSerialization": "4.1.1",
"System.Text.RegularExpressions": "4.1.0",
"Microsoft.Win32.Registry": {
"version": "4.0.0",
"exclude": "compile"
- }
+ },
+
+ "MSBuild": "0.1.0-preview-00024-160610",
+ "Microsoft.Build.Framework": "0.1.0-preview-00024-160610",
+ "Microsoft.Build.Tasks.Core": "0.1.0-preview-00024-160610",
+ "Microsoft.Build.Utilities.Core": "0.1.0-preview-00024-160610",
+ "Microsoft.Build.Targets": "0.1.0-preview-00024-160610",
+ "Microsoft.Build": "0.1.0-preview-00024-160610",
+ "Microsoft.Net.Compilers.NetCore": "1.3.0",
+ "Microsoft.Net.Compilers.Targets.NetCore": "0.1.5-dev",
+ "Microsoft.Cci": "4.0.0-rc3-24128-00",
+ "Microsoft.Composition": "1.0.30",
+ "Microsoft.NuGet.Build.Tasks": "1.0.0-alpha-000001"
},
"frameworks": {
"netcoreapp1.0": {
diff --git a/test/dotnet-build3.Tests/GivenDotnetBuild3BuildsCsproj.cs b/test/dotnet-build3.Tests/GivenDotnetBuild3BuildsCsproj.cs
new file mode 100644
index 000000000..58ab13aa7
--- /dev/null
+++ b/test/dotnet-build3.Tests/GivenDotnetBuild3BuildsCsproj.cs
@@ -0,0 +1,42 @@
+// 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.IO;
+using FluentAssertions;
+using Microsoft.DotNet.Tools.Test.Utilities;
+using Xunit;
+
+namespace Microsoft.DotNet.Cli.Build3.Tests
+{
+ public class GivenDotnetBuild3BuildsCsproj : TestBase
+ {
+ [Fact]
+ public void It_builds_a_runnable_output()
+ {
+ var testAppName = "MSBuildTestApp";
+ var testInstance = TestAssetsManager
+ .CreateTestInstance(testAppName)
+ .WithLockFiles();
+
+ var testProjectDirectory = testInstance.TestRoot;
+
+ var build3Command = new TestCommand("dotnet");
+ build3Command.WorkingDirectory = testProjectDirectory;
+
+ build3Command.ExecuteWithCapturedOutput("build3")
+ .Should()
+ .Pass();
+
+ var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
+ var outputDll = Path.Combine(testProjectDirectory, "bin", configuration, "netcoreapp1.0", $"{testAppName}.dll");
+ var outputRunCommand = new TestCommand("dotnet");
+
+ outputRunCommand.ExecuteWithCapturedOutput(outputDll)
+ .Should()
+ .Pass()
+ .And
+ .HaveStdOutContaining("Hello World");
+ }
+ }
+}
diff --git a/test/dotnet-build3.Tests/dotnet-build3.Tests.xproj b/test/dotnet-build3.Tests/dotnet-build3.Tests.xproj
new file mode 100644
index 000000000..eddb02bc1
--- /dev/null
+++ b/test/dotnet-build3.Tests/dotnet-build3.Tests.xproj
@@ -0,0 +1,21 @@
+
+
+
+ 14.0.23107
+ $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
+
+
+
+ 49d7318e-d198-4e2b-bbea-3a24d805f88d
+ Microsoft.DotNet.Cli.Build3.Tests
+ ..\..\artifacts\obj\$(MSBuildProjectName)
+ ..\..\artifacts\bin
+
+
+ 2.0
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test/dotnet-build3.Tests/project.json b/test/dotnet-build3.Tests/project.json
new file mode 100644
index 000000000..b2644e92e
--- /dev/null
+++ b/test/dotnet-build3.Tests/project.json
@@ -0,0 +1,24 @@
+{
+ "version": "1.0.0-*",
+ "dependencies": {
+ "Microsoft.NETCore.App": {
+ "type": "platform",
+ "version": "1.0.0"
+ },
+ "System.Runtime.Serialization.Primitives": "4.1.1",
+ "Microsoft.DotNet.Tools.Tests.Utilities": {
+ "target": "project"
+ },
+ "xunit": "2.1.0",
+ "dotnet-test-xunit": "1.0.0-rc2-192208-24"
+ },
+ "frameworks": {
+ "netcoreapp1.0": {
+ "imports": [
+ "dotnet5.4",
+ "portable-net451+win8"
+ ]
+ }
+ },
+ "testRunner": "xunit"
+}