提交 dc6b29c1 编写于 作者: G Gaurav Khanna 提交者: GitHub

Correct extraction of IETF resource code (dotnet/core-setup#2160)

* Correct extraction of IETF resource code


Commit migrated from https://github.com/dotnet/core-setup/commit/039e66c522e871bd49e45885de95f2b7d450de41
上级 b05b9a90
using System;
namespace ResourceLookup
{
public static class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.25123" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.25123</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>e484fcd8-e438-4559-a745-e58574263ffd</ProjectGuid>
<RootNamespace>ResourceLookup</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>
\ No newline at end of file
{
"buildOptions": {
"emitEntryPoint": true
},
"dependencies": {},
"frameworks": {
"netcoreapp2.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "2.0.0-preview2-*"
},
"System.Spatial": "5.8.2",
"Microsoft.CodeAnalysis.Analyzers": {
"version": "1.1.0",
"exclude": "all"
},
"Microsoft.CSharp": {
"version": "4.3.0",
"exclude": "all"
},
"Microsoft.DiaSymReader.Native": {
"version": "1.4.0",
"exclude": "all"
},
"Microsoft.VisualBasic": {
"version": "10.1.0",
"exclude": "all"
},
"Microsoft.Win32.Primitives": {
"version": "4.3.0",
"exclude": "all"
},
"Microsoft.Win32.Registry": {
"version": "4.3.0",
"exclude": "all"
},
"System.AppContext": {
"version": "4.3.0",
"exclude": "all"
},
"System.Buffers": {
"version": "4.3.0",
"exclude": "all"
},
"System.Collections": {
"version": "4.3.0",
"exclude": "all"
},
"System.Collections.Concurrent": {
"version": "4.3.0",
"exclude": "all"
},
"System.Collections.Immutable": {
"version": "1.3.0",
"exclude": "all"
},
"System.ComponentModel": {
"version": "4.3.0",
"exclude": "all"
},
"System.ComponentModel.Annotations": {
"version": "4.3.0",
"exclude": "all"
},
"System.Console": {
"version": "4.3.0",
"exclude": "all"
},
"System.Diagnostics.Debug": {
"version": "4.3.0",
"exclude": "all"
},
"System.Diagnostics.DiagnosticSource": {
"version": "4.3.0",
"exclude": "all"
},
"System.Diagnostics.FileVersionInfo": {
"version": "4.0.0",
"exclude": "all"
},
"System.Diagnostics.Process": {
"version": "4.3.0",
"exclude": "all"
},
"System.Diagnostics.StackTrace": {
"version": "4.0.1",
"exclude": "all"
},
"System.Diagnostics.Tools": {
"version": "4.3.0",
"exclude": "all"
},
"System.Diagnostics.Tracing": {
"version": "4.3.0",
"exclude": "all"
},
"System.Dynamic.Runtime": {
"version": "4.3.0",
"exclude": "all"
},
"System.Globalization": {
"version": "4.3.0",
"exclude": "all"
},
"System.Globalization.Calendars": {
"version": "4.3.0",
"exclude": "all"
},
"System.Globalization.Extensions": {
"version": "4.3.0",
"exclude": "all"
},
"System.IO": {
"version": "4.3.0",
"exclude": "all"
},
"System.IO.Compression": {
"version": "4.3.0",
"exclude": "all"
},
"System.IO.Compression.ZipFile": {
"version": "4.3.0",
"exclude": "all"
},
"System.IO.FileSystem": {
"version": "4.3.0",
"exclude": "all"
},
"System.IO.FileSystem.Primitives": {
"version": "4.3.0",
"exclude": "all"
},
"System.IO.FileSystem.Watcher": {
"version": "4.3.0",
"exclude": "all"
},
"System.IO.MemoryMappedFiles": {
"version": "4.3.0",
"exclude": "all"
},
"System.IO.UnmanagedMemoryStream": {
"version": "4.3.0",
"exclude": "all"
},
"System.Linq": {
"version": "4.3.0",
"exclude": "all"
},
"System.Linq.Expressions": {
"version": "4.3.0",
"exclude": "all"
},
"System.Linq.Parallel": {
"version": "4.3.0",
"exclude": "all"
},
"System.Linq.Queryable": {
"version": "4.3.0",
"exclude": "all"
},
"System.Net.Http": {
"version": "4.3.0",
"exclude": "all"
},
"System.Net.NameResolution": {
"version": "4.3.0",
"exclude": "all"
},
"System.Net.Primitives": {
"version": "4.3.0",
"exclude": "all"
},
"System.Net.Requests": {
"version": "4.3.0",
"exclude": "all"
},
"System.Net.Security": {
"version": "4.3.0",
"exclude": "all"
},
"System.Net.Sockets": {
"version": "4.3.0",
"exclude": "all"
},
"System.Net.WebHeaderCollection": {
"version": "4.3.0",
"exclude": "all"
},
"System.Numerics.Vectors": {
"version": "4.3.0",
"exclude": "all"
},
"System.ObjectModel": {
"version": "4.3.0",
"exclude": "all"
},
"System.Reflection": {
"version": "4.3.0",
"exclude": "all"
},
"System.Reflection.DispatchProxy": {
"version": "4.3.0",
"exclude": "all"
},
"System.Reflection.Emit": {
"version": "4.3.0",
"exclude": "all"
},
"System.Reflection.Emit.ILGeneration": {
"version": "4.3.0",
"exclude": "all"
},
"System.Reflection.Emit.Lightweight": {
"version": "4.3.0",
"exclude": "all"
},
"System.Reflection.Extensions": {
"version": "4.3.0",
"exclude": "all"
},
"System.Reflection.Metadata": {
"version": "1.4.1",
"exclude": "all"
},
"System.Reflection.Primitives": {
"version": "4.3.0",
"exclude": "all"
},
"System.Reflection.TypeExtensions": {
"version": "4.3.0",
"exclude": "all"
},
"System.Resources.Reader": {
"version": "4.3.0",
"exclude": "all"
},
"System.Resources.ResourceManager": {
"version": "4.3.0",
"exclude": "all"
},
"System.Runtime": {
"version": "4.3.0",
"exclude": "all"
},
"System.Runtime.Extensions": {
"version": "4.3.0",
"exclude": "all"
},
"System.Runtime.Handles": {
"version": "4.3.0",
"exclude": "all"
},
"System.Runtime.InteropServices": {
"version": "4.3.0",
"exclude": "all"
},
"System.Runtime.InteropServices.RuntimeInformation": {
"version": "4.3.0",
"exclude": "all"
},
"System.Runtime.Loader": {
"version": "4.3.0",
"exclude": "all"
},
"System.Runtime.Numerics": {
"version": "4.3.0",
"exclude": "all"
},
"System.Security.Claims": {
"version": "4.3.0",
"exclude": "all"
},
"System.Security.Cryptography.Algorithms": {
"version": "4.3.0",
"exclude": "all"
},
"System.Security.Cryptography.Cng": {
"version": "4.3.0",
"exclude": "all"
},
"System.Security.Cryptography.Csp": {
"version": "4.3.0",
"exclude": "all"
},
"System.Security.Cryptography.Encoding": {
"version": "4.3.0",
"exclude": "all"
},
"System.Security.Cryptography.OpenSsl": {
"version": "4.3.0",
"exclude": "all"
},
"System.Security.Cryptography.Primitives": {
"version": "4.3.0",
"exclude": "all"
},
"System.Security.Cryptography.X509Certificates": {
"version": "4.3.0",
"exclude": "all"
},
"System.Security.Principal": {
"version": "4.3.0",
"exclude": "all"
},
"System.Security.Principal.Windows": {
"version": "4.3.0",
"exclude": "all"
},
"System.Text.Encoding": {
"version": "4.3.0",
"exclude": "all"
},
"System.Text.Encoding.CodePages": {
"version": "4.0.1",
"exclude": "all"
},
"System.Text.Encoding.Extensions": {
"version": "4.3.0",
"exclude": "all"
},
"System.Text.RegularExpressions": {
"version": "4.3.0",
"exclude": "all"
},
"System.Threading": {
"version": "4.3.0",
"exclude": "all"
},
"System.Threading.Overlapped": {
"version": "4.3.0",
"exclude": "all"
},
"System.Threading.Tasks": {
"version": "4.3.0",
"exclude": "all"
},
"System.Threading.Tasks.Dataflow": {
"version": "4.7.0",
"exclude": "all"
},
"System.Threading.Tasks.Extensions": {
"version": "4.3.0",
"exclude": "all"
},
"System.Threading.Tasks.Parallel": {
"version": "4.3.0",
"exclude": "all"
},
"System.Threading.Thread": {
"version": "4.3.0",
"exclude": "all"
},
"System.Threading.ThreadPool": {
"version": "4.3.0",
"exclude": "all"
},
"System.Threading.Timer": {
"version": "4.3.0",
"exclude": "all"
},
"System.Xml.ReaderWriter": {
"version": "4.3.0",
"exclude": "all"
},
"System.Xml.XDocument": {
"version": "4.3.0",
"exclude": "all"
},
"System.Xml.XmlDocument": {
"version": "4.0.1",
"exclude": "all"
},
"System.Xml.XPath": {
"version": "4.0.1",
"exclude": "all"
},
"System.Xml.XPath.XDocument": {
"version": "4.0.1",
"exclude": "all"
}
}
}
}
}
......@@ -70,17 +70,18 @@ bool deps_entry_t::to_dir_path(const pal::string_t& base, pal::string_t* str) co
replace_char(&pal_relative_path, _X('/'), DIR_SEPARATOR);
}
// Resources are represented as "<ietf-code>/<ResourceAssemblyName.dll>" in the deps.json.
// Resources are represented as "lib/<netstandrd_ver>/<ietf-code>/<ResourceAssemblyName.dll>" in the deps.json.
// The <ietf-code> is the "directory" in the pal_relative_path below, so extract it.
pal::string_t ietf_dir = get_directory(pal_relative_path);
pal::string_t ietf = ietf_dir;
// get_directory returns with DIR_SEPERATOR appended that we need to remove.
auto sep_pos = ietf.find_last_of(DIR_SEPARATOR);
if (sep_pos != pal::string_t::npos)
{
ietf = ietf.erase(sep_pos, pal::string_t::npos);
if (ietf.back() == DIR_SEPARATOR) {
ietf.pop_back();
}
// Extract IETF code from "lib/<netstandrd_ver>/<ietf-code>"
ietf = get_filename(ietf);
pal::string_t base_ietf_dir = base;
append_path(&base_ietf_dir, ietf.c_str());
......
// 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.IO;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
using Xunit;
using FluentAssertions;
using Microsoft.DotNet.CoreSetup.Test;
namespace Microsoft.DotNet.CoreSetup.Test.HostActivation.ResourceLookup
{
public class GivenThatICareAboutResourceLookup
{
private static TestProjectFixture PreviouslyBuiltAndRestoredResourceLookupTestProjectFixture { get; set; }
private static TestProjectFixture PreviouslyPublishedAndRestoredResourceLookupTestProjectFixture { get; set; }
private static RepoDirectoriesProvider RepoDirectories { get; set; }
static GivenThatICareAboutResourceLookup()
{
RepoDirectories = new RepoDirectoriesProvider();
PreviouslyBuiltAndRestoredResourceLookupTestProjectFixture = new TestProjectFixture("ResourceLookup", RepoDirectories)
.EnsureRestored(RepoDirectories.CorehostPackages)
.BuildProject();
PreviouslyPublishedAndRestoredResourceLookupTestProjectFixture = new TestProjectFixture("ResourceLookup", RepoDirectories)
.EnsureRestored(RepoDirectories.CorehostPackages)
.PublishProject();
}
[Fact]
public void Muxer_activation_of_Build_Output_Resource_DLL_with_DepsJson_and_RuntimeConfig_Local_Succeeds()
{
var fixture = PreviouslyBuiltAndRestoredResourceLookupTestProjectFixture
.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
dotnet.Exec(appDll)
.CaptureStdErr()
.CaptureStdOut()
.Execute()
.Should()
.Pass()
.And
.HaveStdOutContaining("Hello World");
dotnet.Exec("exec", appDll)
.CaptureStdErr()
.CaptureStdOut()
.Execute()
.Should()
.Pass()
.And
.HaveStdOutContaining("Hello World");
}
[Fact]
public void Muxer_activation_of_Publish_Output_ResourceLookup_DLL_with_DepsJson_and_RuntimeConfig_Local_Succeeds()
{
var fixture = PreviouslyPublishedAndRestoredResourceLookupTestProjectFixture
.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
dotnet.Exec(appDll)
.CaptureStdErr()
.CaptureStdOut()
.Execute()
.Should()
.Pass()
.And
.HaveStdOutContaining("Hello World");
dotnet.Exec("exec", appDll)
.CaptureStdErr()
.CaptureStdOut()
.Execute()
.Should()
.Pass()
.And
.HaveStdOutContaining("Hello World");
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册