make 'platform' flag dependent upon CLI bitness
this will make net451 deployment work for x86 apps
This commit is contained in:
parent
f2bf60d06f
commit
a48596ff23
15 changed files with 94 additions and 28 deletions
|
@ -1,7 +1,8 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"dependencies": {
|
||||
"PackageWithFakeNativeDep": "1.0.0-*"
|
||||
"PackageWithFakeNativeDep": "1.0.0-*",
|
||||
"Microsoft.NETCore.Platforms": "1.0.0-rc2-24008"
|
||||
},
|
||||
"compilationOptions": {
|
||||
"emitEntryPoint": true
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
"dependencies": {
|
||||
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-20113",
|
||||
"Microsoft.AspNetCore.Hosting": "1.0.0-rc2-20113",
|
||||
"Microsoft.Extensions.Logging.Console": "1.0.0-rc2-20254"
|
||||
"Microsoft.Extensions.Logging.Console": "1.0.0-rc2-20254",
|
||||
"Microsoft.NETCore.Platforms": "1.0.0-rc2-24008"
|
||||
},
|
||||
"compilationOptions": {
|
||||
"emitEntryPoint": true
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"dependencies": {
|
||||
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-20113",
|
||||
"Microsoft.AspNetCore.Hosting": "1.0.0-rc2-20113",
|
||||
"Microsoft.Extensions.Logging.Console": "1.0.0-rc2-20254",
|
||||
"Microsoft.NETCore.Platforms": "1.0.0-rc2-24008"
|
||||
},
|
||||
"compilationOptions": {
|
||||
"platform": "anycpu32bitpreferred",
|
||||
"emitEntryPoint": true
|
||||
},
|
||||
"compile": [
|
||||
"../src/*.cs"
|
||||
],
|
||||
"frameworks": {
|
||||
"net451": { }
|
||||
}
|
||||
}
|
|
@ -3,7 +3,8 @@
|
|||
"dependencies": {
|
||||
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-20113",
|
||||
"Microsoft.AspNetCore.Hosting": "1.0.0-rc2-20113",
|
||||
"Microsoft.Extensions.Logging.Console": "1.0.0-rc2-20254"
|
||||
"Microsoft.Extensions.Logging.Console": "1.0.0-rc2-20254",
|
||||
"Microsoft.NETCore.Platforms": "1.0.0-rc2-24008"
|
||||
},
|
||||
"compilationOptions": {
|
||||
"emitEntryPoint": true
|
||||
|
@ -15,6 +16,7 @@
|
|||
"net451": { }
|
||||
},
|
||||
"runtimes": {
|
||||
"win7-x86": {},
|
||||
"win7-x64": {},
|
||||
"osx.10.11-x64": {}
|
||||
}
|
||||
|
|
|
@ -9,9 +9,8 @@
|
|||
<ProjectGuid>c26a48bb-193f-450c-ab09-4d3324c78188</ProjectGuid>
|
||||
<RootNamespace>dotnet-dependency-tool-invoker</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\..\artifacts\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -9,9 +9,8 @@
|
|||
<ProjectGuid>da8e0e9e-a6d6-4583-864c-8f40465e3a48</ProjectGuid>
|
||||
<RootNamespace>TestAppWithArgs</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\..\artifacts\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -9,9 +9,8 @@
|
|||
<ProjectGuid>0138cb8f-4aa9-4029-a21e-c07c30f425ba</ProjectGuid>
|
||||
<RootNamespace>TestAppWithContents</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\..\artifacts\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -16,6 +16,7 @@ using Microsoft.Extensions.DependencyModel;
|
|||
using NuGet.Frameworks;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using System.Reflection.PortableExecutable;
|
||||
|
||||
namespace Microsoft.Dotnet.Cli.Compiler.Common
|
||||
{
|
||||
|
|
|
@ -108,7 +108,7 @@ namespace Microsoft.DotNet.Tools.Build
|
|||
{
|
||||
if (CLIChangedSinceLastCompilation(project))
|
||||
{
|
||||
Reporter.Output.WriteLine($"Project {project.GetDisplayName()} will be compiled because the CLI changed");
|
||||
Reporter.Output.WriteLine($"Project {project.GetDisplayName()} will be compiled because the version or bitness of the CLI changed since the last build");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -207,7 +207,9 @@ namespace Microsoft.DotNet.Tools.Build
|
|||
return false;
|
||||
}
|
||||
|
||||
var versionsAreEqual = string.Equals(File.ReadAllText(currentVersionFile), File.ReadAllText(versionFileFromLastCompile), StringComparison.OrdinalIgnoreCase);
|
||||
var currentContent = ComputeCurrentVersionFileData();
|
||||
|
||||
var versionsAreEqual = string.Equals(currentContent, File.ReadAllText(versionFileFromLastCompile), StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
return !versionsAreEqual;
|
||||
}
|
||||
|
@ -224,7 +226,9 @@ namespace Microsoft.DotNet.Tools.Build
|
|||
Directory.CreateDirectory(parentDirectory);
|
||||
}
|
||||
|
||||
File.Copy(DotnetFiles.VersionFile, projectVersionFile, true);
|
||||
string content = ComputeCurrentVersionFileData();
|
||||
|
||||
File.WriteAllText(projectVersionFile, content);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -232,6 +236,14 @@ namespace Microsoft.DotNet.Tools.Build
|
|||
}
|
||||
}
|
||||
|
||||
private static string ComputeCurrentVersionFileData()
|
||||
{
|
||||
var content = File.ReadAllText(DotnetFiles.VersionFile);
|
||||
content += Environment.NewLine;
|
||||
content += PlatformServices.Default.Runtime.GetRuntimeIdentifier();
|
||||
return content;
|
||||
}
|
||||
|
||||
private void PrintSummary(bool success)
|
||||
{
|
||||
// todo: Ideally it's the builder's responsibility for adding the time elapsed. That way we avoid cross cutting display concerns between compile and build for printing time elapsed
|
||||
|
|
|
@ -5,11 +5,13 @@ using System.Collections.Generic;
|
|||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.DotNet.Cli.Compiler.Common;
|
||||
using Microsoft.DotNet.Cli.Utils;
|
||||
using Microsoft.DotNet.ProjectModel;
|
||||
using Microsoft.DotNet.ProjectModel.Compilation;
|
||||
using Microsoft.Extensions.DependencyModel;
|
||||
using NuGet.Frameworks;
|
||||
|
||||
namespace Microsoft.DotNet.Tools.Compiler
|
||||
{
|
||||
|
@ -77,6 +79,15 @@ namespace Microsoft.DotNet.Tools.Compiler
|
|||
};
|
||||
|
||||
var compilationOptions = context.ResolveCompilationOptions(args.ConfigValue);
|
||||
|
||||
// Set default platform if it isn't already set and we're on desktop
|
||||
if(compilationOptions.EmitEntryPoint == true && string.IsNullOrEmpty(compilationOptions.Platform) && context.TargetFramework.IsDesktop())
|
||||
{
|
||||
// See https://github.com/dotnet/cli/issues/2428 for more details.
|
||||
compilationOptions.Platform = RuntimeInformation.ProcessArchitecture == Architecture.X64 ?
|
||||
"x64" : "anycpu32bitpreferred";
|
||||
}
|
||||
|
||||
var languageId = CompilerUtil.ResolveLanguageId(context);
|
||||
|
||||
var references = new List<string>();
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<ProjectGuid>0B31C336-149D-471A-B7B1-27B0F1E80F83</ProjectGuid>
|
||||
<RootNamespace>Microsoft.DotNet.Cli.Msi.Tests</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\..\artifacts\</OutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading.Tasks;
|
||||
using FluentAssertions;
|
||||
using Microsoft.DotNet.Cli.Utils;
|
||||
using Microsoft.DotNet.TestFramework;
|
||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
using Microsoft.Extensions.PlatformAbstractions;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.DotNet.Tools.Publish.Tests
|
||||
|
@ -13,11 +16,16 @@ namespace Microsoft.DotNet.Tools.Publish.Tests
|
|||
public class PublishDesktopTests : TestBase
|
||||
{
|
||||
[WindowsOnlyTheory]
|
||||
[InlineData(null, "the-win-x64-version.txt")]
|
||||
[InlineData(null, null)]
|
||||
[InlineData("win7-x64", "the-win-x64-version.txt")]
|
||||
[InlineData("win7-x86", "the-win-x86-version.txt")]
|
||||
public async Task DesktopApp_WithDependencyOnNativePackage_ProducesExpectedOutput(string runtime, string expectedOutputName)
|
||||
{
|
||||
if(string.IsNullOrEmpty(expectedOutputName))
|
||||
{
|
||||
expectedOutputName = $"the-win-{RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant()}-version.txt";
|
||||
}
|
||||
|
||||
var testInstance = TestAssetsManager.CreateTestInstance(Path.Combine("..", "DesktopTestProjects", "DesktopAppWithNativeDep"))
|
||||
.WithLockFiles();
|
||||
|
||||
|
@ -33,12 +41,17 @@ namespace Microsoft.DotNet.Tools.Publish.Tests
|
|||
}
|
||||
|
||||
[WindowsOnlyTheory]
|
||||
[InlineData("KestrelDesktopWithRuntimes", "http://localhost:20201", null, "libuv.dll", true)]
|
||||
[InlineData("KestrelDesktopWithRuntimes", "http://localhost:20202", "win7-x64", "libuv.dll", true)]
|
||||
[InlineData("KestrelDesktop", "http://localhost:20204", null, "libuv.dll", true)]
|
||||
[InlineData("KestrelDesktop", "http://localhost:20205", "win7-x64", "libuv.dll", true)]
|
||||
public async Task DesktopApp_WithKestrel_WorksWhenPublished(string project, string url, string runtime, string libuvName, bool runnable)
|
||||
[InlineData("KestrelDesktopWithRuntimes", "http://localhost:20201", null, "libuv.dll", false)]
|
||||
[InlineData("KestrelDesktopWithRuntimes", "http://localhost:20202", "win7-x64", "libuv.dll", false)]
|
||||
[InlineData("KestrelDesktopWithRuntimes", "http://localhost:20203", "win7-x86", "libuv.dll", false)]
|
||||
[InlineData("KestrelDesktopForce32", "http://localhost:20204", "win7-x86", "libuv.dll", true)]
|
||||
[InlineData("KestrelDesktop", "http://localhost:20205", null, "libuv.dll", false)]
|
||||
[InlineData("KestrelDesktop", "http://localhost:20206", "win7-x64", "libuv.dll", false)]
|
||||
[InlineData("KestrelDesktop", "http://localhost:20207", "win7-x86", "libuv.dll", false)]
|
||||
public async Task DesktopApp_WithKestrel_WorksWhenPublished(string project, string url, string runtime, string libuvName, bool forceRunnable)
|
||||
{
|
||||
var runnable = forceRunnable || string.IsNullOrEmpty(runtime) || (PlatformServices.Default.Runtime.GetLegacyRestoreRuntimeIdentifier().Contains(runtime));
|
||||
|
||||
var testInstance = GetTestInstance()
|
||||
.WithLockFiles();
|
||||
|
||||
|
@ -55,7 +68,9 @@ namespace Microsoft.DotNet.Tools.Publish.Tests
|
|||
Task exec = null;
|
||||
if (runnable)
|
||||
{
|
||||
var command = new TestCommand(Path.Combine(outputDir.FullName, publishCommand.GetOutputExecutable()));
|
||||
var outputExePath = Path.Combine(outputDir.FullName, publishCommand.GetOutputExecutable());
|
||||
|
||||
var command = new TestCommand(outputExePath);
|
||||
try
|
||||
{
|
||||
exec = command.ExecuteAsync(url);
|
||||
|
@ -74,10 +89,16 @@ namespace Microsoft.DotNet.Tools.Publish.Tests
|
|||
}
|
||||
|
||||
[WindowsOnlyTheory]
|
||||
[InlineData("KestrelDesktop", "http://localhost:20207")]
|
||||
[InlineData("KestrelDesktopWithRuntimes", "http://localhost:20208")]
|
||||
[InlineData("KestrelDesktop", "http://localhost:20301")]
|
||||
[InlineData("KestrelDesktopWithRuntimes", "http://localhost:20302")]
|
||||
public async Task DesktopApp_WithKestrel_WorksWhenRun(string project, string url)
|
||||
{
|
||||
// Disabled due to https://github.com/dotnet/cli/issues/2428
|
||||
if (RuntimeInformation.ProcessArchitecture == Architecture.X86)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var testInstance = GetTestInstance()
|
||||
.WithLockFiles()
|
||||
.WithBuildArtifacts();
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
},
|
||||
"xunit": "2.1.0",
|
||||
"xunit.netcore.extensions": "1.0.0-prerelease-00206",
|
||||
"dotnet-test-xunit": "1.0.0-dev-140469-38"
|
||||
"dotnet-test-xunit": "1.0.0-dev-140469-38",
|
||||
"System.Runtime.InteropServices.RuntimeInformation": "4.0.0-rc2-24008"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue