Prototype round #1 of .NET Core MSBuild .props and .targets.

This commit is contained in:
Eric Erhardt 2016-07-18 11:50:36 -05:00
parent 9446a81a25
commit 30712966cc
15 changed files with 494 additions and 7 deletions

View file

@ -147,6 +147,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{FF498306-2
build\test\TestPackageProjects.props = build\test\TestPackageProjects.props
EndProjectSection
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Core.MSBuild", "src\Microsoft.DotNet.Core.MSBuild\Microsoft.DotNet.Core.MSBuild.xproj", "{556554CA-6EC9-4007-A2C3-AB03DCF8F741}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Core.Build.Tasks", "src\Microsoft.DotNet.Core.Build.Tasks\Microsoft.DotNet.Core.Build.Tasks.xproj", "{E8E7D24B-4830-4662-80A8-255D6FE3B0BE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -895,6 +899,38 @@ Global
{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
{556554CA-6EC9-4007-A2C3-AB03DCF8F741}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{556554CA-6EC9-4007-A2C3-AB03DCF8F741}.Debug|Any CPU.Build.0 = Debug|Any CPU
{556554CA-6EC9-4007-A2C3-AB03DCF8F741}.Debug|x64.ActiveCfg = Debug|Any CPU
{556554CA-6EC9-4007-A2C3-AB03DCF8F741}.Debug|x64.Build.0 = Debug|Any CPU
{556554CA-6EC9-4007-A2C3-AB03DCF8F741}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
{556554CA-6EC9-4007-A2C3-AB03DCF8F741}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
{556554CA-6EC9-4007-A2C3-AB03DCF8F741}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
{556554CA-6EC9-4007-A2C3-AB03DCF8F741}.MinSizeRel|x64.Build.0 = Debug|Any CPU
{556554CA-6EC9-4007-A2C3-AB03DCF8F741}.Release|Any CPU.ActiveCfg = Release|Any CPU
{556554CA-6EC9-4007-A2C3-AB03DCF8F741}.Release|Any CPU.Build.0 = Release|Any CPU
{556554CA-6EC9-4007-A2C3-AB03DCF8F741}.Release|x64.ActiveCfg = Release|Any CPU
{556554CA-6EC9-4007-A2C3-AB03DCF8F741}.Release|x64.Build.0 = Release|Any CPU
{556554CA-6EC9-4007-A2C3-AB03DCF8F741}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
{556554CA-6EC9-4007-A2C3-AB03DCF8F741}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
{556554CA-6EC9-4007-A2C3-AB03DCF8F741}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
{556554CA-6EC9-4007-A2C3-AB03DCF8F741}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
{E8E7D24B-4830-4662-80A8-255D6FE3B0BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E8E7D24B-4830-4662-80A8-255D6FE3B0BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E8E7D24B-4830-4662-80A8-255D6FE3B0BE}.Debug|x64.ActiveCfg = Debug|Any CPU
{E8E7D24B-4830-4662-80A8-255D6FE3B0BE}.Debug|x64.Build.0 = Debug|Any CPU
{E8E7D24B-4830-4662-80A8-255D6FE3B0BE}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
{E8E7D24B-4830-4662-80A8-255D6FE3B0BE}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
{E8E7D24B-4830-4662-80A8-255D6FE3B0BE}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
{E8E7D24B-4830-4662-80A8-255D6FE3B0BE}.MinSizeRel|x64.Build.0 = Debug|Any CPU
{E8E7D24B-4830-4662-80A8-255D6FE3B0BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E8E7D24B-4830-4662-80A8-255D6FE3B0BE}.Release|Any CPU.Build.0 = Release|Any CPU
{E8E7D24B-4830-4662-80A8-255D6FE3B0BE}.Release|x64.ActiveCfg = Release|Any CPU
{E8E7D24B-4830-4662-80A8-255D6FE3B0BE}.Release|x64.Build.0 = Release|Any CPU
{E8E7D24B-4830-4662-80A8-255D6FE3B0BE}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
{E8E7D24B-4830-4662-80A8-255D6FE3B0BE}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
{E8E7D24B-4830-4662-80A8-255D6FE3B0BE}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
{E8E7D24B-4830-4662-80A8-255D6FE3B0BE}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -954,5 +990,7 @@ Global
{FD7D515A-D10F-4F49-B8AE-21CF7ED071AE} = {89905EC4-BC0F-443B-8ADF-691321F10108}
{8E3354BD-827F-41B7-9EE6-6BE1F1EDD8E9} = {89905EC4-BC0F-443B-8ADF-691321F10108}
{FF498306-2DE2-47F6-8C35-3CF0589CF2B8} = {89905EC4-BC0F-443B-8ADF-691321F10108}
{556554CA-6EC9-4007-A2C3-AB03DCF8F741} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
{E8E7D24B-4830-4662-80A8-255D6FE3B0BE} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,17 @@
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworkIdentifier>.NETCoreApp</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v1.0</TargetFrameworkVersion>
</PropertyGroup>
<ItemGroup>
<Compile Include="**\*.cs" Exclude="$(GlobalExclude)" />
<EmbeddedResource Include="**\*.resx" Exclude="$(GlobalExclude)" />
<None Include="project.json" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View file

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

View file

@ -0,0 +1,19 @@
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
},
"Microsoft.DotNet.Core.MSBuild": "1.0.0-preview3"
},
"frameworks": {
"netcoreapp1.0": {
}
},
"runtimes": {
"win-x64": {},
"win-x86": {},
"win10-x64": {},
"win10-x86": {}
}
}

View file

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="Local" value="Packages" />
<add key="tempnuget" value="C:\temp\nuget" />
</packageSources>
</configuration>

View file

@ -1,3 +1,3 @@
{
"projects": [ ".", "../../src" ]
"projects": [ "." ]
}

View file

@ -97,13 +97,12 @@ namespace Microsoft.DotNet.Cli.Compiler.Common
{
WriteDepsFileAndCopyProjectDependencies(_exporter);
var emitEntryPoint = _compilerOptions.EmitEntryPoint ?? false;
var isRunnable = _compilerOptions.EmitEntryPoint ?? _context.ProjectFile.OverrideIsRunnable;
if (emitEntryPoint && !_context.IsPortable)
if (isRunnable && !_context.IsPortable)
{
// TODO: Pick a host based on the RID
VerifyCoreClrPresenceInPackageGraph();
CoreHost.CopyTo(_runtimeOutputPath, _compilerOptions.OutputName + Constants.ExeSuffix);
RenamePublishedHost(_context, _runtimeOutputPath, _compilerOptions);
}
}
@ -333,5 +332,59 @@ namespace Microsoft.DotNet.Cli.Compiler.Common
exporter.GetAllExports().GenerateBindingRedirects(configFiles);
}
private static int RenamePublishedHost(ProjectContext context, string outputPath, CommonCompilerOptions compilationOptions)
{
if (context.TargetFramework.IsDesktop())
{
return 0;
}
var publishedHostFile = ResolvePublishedHostFile(outputPath);
if (publishedHostFile == null)
{
Reporter.Output.WriteLine($"publish: warning: host executable not available in dependencies, using host for current platform");
// TODO should this be an error?
CoreHost.CopyTo(outputPath, compilationOptions.OutputName + Constants.ExeSuffix);
return 0;
}
var publishedHostExtension = Path.GetExtension(publishedHostFile);
var renamedHostName = compilationOptions.OutputName + publishedHostExtension;
var renamedHostFile = Path.Combine(outputPath, renamedHostName);
try
{
Reporter.Verbose.WriteLine($"publish: renaming published host {publishedHostFile} to {renamedHostFile}");
File.Copy(publishedHostFile, renamedHostFile, true);
File.Delete(publishedHostFile);
}
catch (Exception e)
{
Reporter.Error.WriteLine($"publish: Failed to rename {publishedHostFile} to {renamedHostFile}: {e.Message}");
return 1;
}
return 0;
}
private static string ResolvePublishedHostFile(string outputPath)
{
var tryExtensions = new string[] { "", ".exe" };
foreach (var extension in tryExtensions)
{
var hostFile = Path.Combine(outputPath, Constants.PublishedHostExecutableName + extension);
if (File.Exists(hostFile))
{
Reporter.Verbose.WriteLine($"resolved published host: {hostFile}");
return hostFile;
}
}
Reporter.Verbose.WriteLine($"failed to resolve published host in: {outputPath}");
return null;
}
}
}

View file

@ -0,0 +1,89 @@
// 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.Diagnostics;
using System.Linq;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Microsoft.DotNet.Cli.Compiler.Common;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.InternalAbstractions;
using Microsoft.DotNet.ProjectModel;
using Microsoft.DotNet.ProjectModel.Compilation;
using NuGet.Frameworks;
namespace Microsoft.DotNet.Cli.Tasks
{
public class MakeNetCoreRunnable : Task
{
[Required]
public string ProjectPath { get; set; }
[Required]
public string Configuration { get; set; }
[Required]
public string OutputPath { get; set; }
[Required]
public string OutputType { get; set; }
public string Runtime { get; set; }
private bool HasRuntimeOutput
{
get { return string.Equals("Exe", OutputType, StringComparison.OrdinalIgnoreCase); }
}
public override bool Execute()
{
BuildWorkspace workspace = BuildWorkspace.Create();
string framework = null; //TODO: should we take a NuGet framework ?
IEnumerable<ProjectContext> projectContexts = GetProjectContexts(workspace,
framework == null ? null : NuGetFramework.Parse(framework),
Runtime);
if (!projectContexts.Any())
{
Log.LogError($"'{ProjectPath}' cannot be made runnable for '{framework ?? "<no framework provided>"}' '{Runtime ?? "<no runtime provided>"}'");
return false;
}
foreach (ProjectContext projectContext in projectContexts)
{
string buildBasePath = null; // TODO: Is there an "Intermediate Directory" property we can take?
projectContext.ProjectFile.OverrideIsRunnable = HasRuntimeOutput;
OutputPaths outputPaths = projectContext.GetOutputPaths(Configuration, buildBasePath, OutputPath);
LibraryExporter libraryExporter = projectContext.CreateExporter(Configuration, buildBasePath);
Executable executable = new Executable(projectContext, outputPaths, libraryExporter, Configuration);
executable.MakeCompilationOutputRunnable();
}
return true;
}
private IEnumerable<ProjectContext> GetProjectContexts(BuildWorkspace workspace, NuGetFramework framework, string runtime)
{
var contexts = workspace.GetProjectContextCollection(ProjectPath)
.EnsureValid(ProjectPath)
.FrameworkOnlyContexts;
contexts = framework == null ?
contexts :
contexts.Where(c => Equals(c.TargetFramework, framework));
var rids = string.IsNullOrEmpty(runtime) ?
RuntimeEnvironmentRidExtensions.GetAllCandidateRuntimeIdentifiers() :
new[] { runtime };
return contexts.Select(c => workspace.GetRuntimeContext(c, rids));
}
}
}

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.25420" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.25420</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>e8e7d24b-4830-4662-80a8-255d6fe3b0be</ProjectGuid>
<RootNamespace>Microsoft.DotNet.Core.MSBuild</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

View file

@ -0,0 +1,34 @@
{
"version": "1.0.0-preview3-*",
"buildOptions": {
"keyFile": "../../tools/Key.snk",
"warningsAsErrors": true
},
"dependencies": {
"Microsoft.DotNet.Compiler.Common": {
"target": "project"
}
},
"frameworks": {
"net451": {
"frameworkAssemblies": {
"Microsoft.Build.Utilities.v4.0": {
"type": "build"
},
"Microsoft.Build.Framework": {
"type": "build"
}
}
},
"netstandard1.6": {
"imports": [
"portable-net45+wp80+win8+wpa81+dnxcore50"
],
"dependencies": {
"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"
}
}
}
}

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.25420" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.25420</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>556554ca-6ec9-4007-a2c3-ab03dcf8f741</ProjectGuid>
<RootNamespace>Microsoft.DotNet.Core.MSBuild</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

View file

@ -0,0 +1,87 @@
<!--<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x64</Platform>
<PlatformTarget Condition=" '$(PlatformTarget)' == '' ">x64</PlatformTarget>
<RootNamespace>$(MSBuildProjectName)</RootNamespace>
<AssemblyName>$(MSBuildProjectName)</AssemblyName>
<TargetFrameworkIdentifier>NETCoreApp</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v1.0</TargetFrameworkVersion>
<OutputPath>bin\$(Configuration)\netcoreapp1.0</OutputPath>
<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<NoStdLib>true</NoStdLib>
<NoLogo>true</NoLogo> -->
<!-- Temp Hack: https://github.com/dotnet/roslyn/issues/12167 -->
<!--
<NuGetTargetMoniker>.NETCoreApp,Version=v1.0</NuGetTargetMoniker>
-->
<!-- Temp Hack: Being passed through from cli, where should this come from? -->
<!--
<BaseNuGetRuntimeIdentifier Condition=" '$(BaseNuGetRuntimeIdentifier)' == '' ">win7</BaseNuGetRuntimeIdentifier>
<DebugSymbols>false</DebugSymbols>
<DebugType>none</DebugType>
</PropertyGroup>
</Project>-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<!-- User-facing configuration-agnostic defaults -->
<PropertyGroup>
<Configuration>Debug</Configuration>
<Platform>AnyCPU</Platform>
<FileAlignment>512</FileAlignment>
<GlobalExclude>bin\**;obj\**;</GlobalExclude>
</PropertyGroup>
<!-- User-facing configuration-specific defaults -->
<PropertyGroup>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>$(NoWarn);1701</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<NoStdLib>true</NoStdLib>
<!-- TODO: Need to figure out runtimes -->
<!-- TODO: Below are hacks eerhardt made on top of davkean's .props file -->
<!-- Temp Hack: davkean had this, but that casues all references not to be copied to output dir:
<CopyNuGetImplementations>false</CopyNuGetImplementations>
This will be set to false during "build", but set to true during "publish"
-->
<!--Setting PlatformTarget is needed when CopyNuGetImplementations is left on, or else you get 'Your project.json doesn't list 'win10' as a targeted runtime. You should add '"win10": { }' inside your "runtimes" section in your project.json, and then re-run NuGet restore' errors -->
<PlatformTarget>x64</PlatformTarget>
<!-- Temp Hack: https://github.com/dotnet/roslyn/issues/12167 -->
<NoLogo>true</NoLogo>
<!-- Temp Hack: https://github.com/Microsoft/msbuild/issues/720 -->
<OverrideToolHost Condition=" '$(DotnetHostPath)' != '' and '$(OverrideToolHost)' == ''">$(DotnetHostPath)</OverrideToolHost>
</PropertyGroup>
</Project>

View file

@ -0,0 +1,79 @@
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MicrosoftDotNetCoreBuildTasksDirectoryRoot>$(MSBuildThisFileDirectory)../../lib/</MicrosoftDotNetCoreBuildTasksDirectoryRoot>
<MicrosoftDotNetCoreBuildTasksTFM Condition=" '$(MSBuildRuntimeType)' == 'Core'">netstandard1.6</MicrosoftDotNetCoreBuildTasksTFM>
<MicrosoftDotNetCoreBuildTasksTFM Condition=" '$(MicrosoftDotNetCoreBuildTasksTFM)' == ''">net451</MicrosoftDotNetCoreBuildTasksTFM>
<MicrosoftDotNetCoreBuildTasksDirectory>$(MicrosoftDotNetCoreBuildTasksDirectoryRoot)$(MicrosoftDotNetCoreBuildTasksTFM)/</MicrosoftDotNetCoreBuildTasksDirectory>
</PropertyGroup>
<PropertyGroup>
<!-- We don't use any of MSBuild's resolution logic for resolving the framework, so just set these two
properties to any folder that exists to skip the GetReferenceAssemblyPaths task (not target) and
to prevent it from outputting a warning (MSB3644).
-->
<_TargetFrameworkDirectories>$(MSBuildThisFileDirectory)</_TargetFrameworkDirectories>
<_FullFrameworkReferenceAssemblyPaths>$(MSBuildThisFileDirectory)</_FullFrameworkReferenceAssemblyPaths>
</PropertyGroup>
<UsingTask TaskName="MakeNetCoreRunnable" AssemblyFile="$(MicrosoftDotNetCoreBuildTasksDirectory)/Microsoft.DotNet.Core.Build.Tasks.dll" />
<PropertyGroup>
<!-- TODO Condition="IsNetCore" -->
<CoreBuildDependsOn>
NetCorePreCoreBuild;
$(CoreBuildDependsOn);
NetCorePostCoreBuild
</CoreBuildDependsOn>
</PropertyGroup>
<Target Name="MakeCompilationOutputRunnable">
<!--
TODO: Is this the best way? Should we just tell CSC to output $(AssemblyName).dll directly?
-->
<Move SourceFiles="$(TargetPath)" DestinationFiles="$(TargetDir)/$(AssemblyName).dll" />
<!--
TODO: need to remove ProjectPath (to load up the project.json) and instead pass @(PackageDependency)
-->
<MakeNetCoreRunnable ProjectPath="$(MSBuildProjectDirectory)"
Configuration="$(Configuration)"
OutputPath="$(OutDir)"
OutputType="$(OutputType)" />
</Target>
<Target Name="NetCorePreCoreBuild" />
<Target Name="NetCorePostCoreBuild"
DependsOnTargets="MakeCompilationOutputRunnable" />
<!--
============================================================
Publish
Override the "in-box" publish, which is very ClickOnce centric.
============================================================
-->
<PropertyGroup>
<PublishDependsOn>
NetCorePublishPreBuild;
Build;
NetCorePublishPostBuild
</PublishDependsOn>
</PropertyGroup>
<Target
Name="Publish"
DependsOnTargets="$(PublishDependsOn)" />
<Target Name="NetCorePublishPreBuild">
<PropertyGroup>
<PublishDir Condition=" '$(PublishDir)' == '' ">$(OutDir)publish\</PublishDir>
</PropertyGroup>
</Target>
<Target Name="NetCorePublishPostBuild">
<Message Text="ERIC NetCorePublishPostBuild" />
</Target>
</Project>

View file

@ -0,0 +1,19 @@
{
"version": "1.0.0-preview3-*",
"packOptions": {
"files": {
"include": [
"build/**/*",
"../../artifacts/bin/src/Microsoft.DotNet.Core.Build.Tasks/bin/Debug/netstandard1.6/*.dll",
"../../artifacts/bin/src/Microsoft.DotNet.Core.Build.Tasks/bin/Debug/net451/*.dll"
],
"mappings": {
"lib/netstandard1.6/": "../../artifacts/bin/src/Microsoft.DotNet.Core.Build.Tasks/bin/Debug/netstandard1.6/*.dll",
"lib/net451/": "../../artifacts/bin/src/Microsoft.DotNet.Core.Build.Tasks/bin/Debug/net451/*.dll"
}
}
},
"frameworks": {
"netstandard1.0": {}
}
}

View file

@ -84,6 +84,8 @@ namespace Microsoft.DotNet.ProjectModel
public bool IsTestProject => !string.IsNullOrEmpty(TestRunner);
public bool OverrideIsRunnable { get; set; }
public IEnumerable<TargetFrameworkInformation> GetTargetFrameworks()
{
return _targetFrameworks.Values;
@ -128,7 +130,7 @@ namespace Microsoft.DotNet.ProjectModel
var compilerOptions = GetCompilerOptions(targetFramework: null, configurationName: configuration);
// TODO: Make this opt in via another mechanism
return compilerOptions.EmitEntryPoint.GetValueOrDefault() || IsTestProject;
return compilerOptions.EmitEntryPoint.GetValueOrDefault() || IsTestProject || OverrideIsRunnable;
}
private CommonCompilerOptions GetCompilerOptions()