зеркало из https://github.com/dotnet/aspnetcore.git
Add .version file to shared framework zip (#21587)
* Add .version file to shared framework zip * Fix test * Test for proper version file depending on env
This commit is contained in:
Родитель
9a5d3c7640
Коммит
7c58b8b767
|
@ -67,7 +67,8 @@ This package is an internal implementation of the .NET Core SDK and is not meant
|
|||
<!-- There is no way to suppress the .dev.runtimeconfig.json generation. -->
|
||||
<ProjectRuntimeConfigDevFilePath>$(IntermediateOutputPath)ignoreme.dev.runtimeconfig.json</ProjectRuntimeConfigDevFilePath>
|
||||
|
||||
<VersionFileIntermediateOutputPath>$(IntermediateOutputPath)$(SharedFxName).versions.txt</VersionFileIntermediateOutputPath>
|
||||
<VersionTxtFileIntermediateOutputPath>$(IntermediateOutputPath)$(SharedFxName).versions.txt</VersionTxtFileIntermediateOutputPath>
|
||||
<DotVersionFileIntermediateOutputPath>$(IntermediateOutputPath).version</DotVersionFileIntermediateOutputPath>
|
||||
|
||||
<!-- The project representing the shared framework doesn't produce a .NET assembly or symbols. -->
|
||||
<DebugType>none</DebugType>
|
||||
|
@ -259,7 +260,12 @@ This package is an internal implementation of the .NET Core SDK and is not meant
|
|||
</ItemGroup>
|
||||
|
||||
<WriteLinesToFile
|
||||
File="$(VersionFileIntermediateOutputPath)"
|
||||
File="$(VersionTxtFileIntermediateOutputPath)"
|
||||
Lines="@(VersionLines)"
|
||||
Overwrite="true" />
|
||||
|
||||
<WriteLinesToFile
|
||||
File="$(DotVersionFileIntermediateOutputPath)"
|
||||
Lines="@(VersionLines)"
|
||||
Overwrite="true" />
|
||||
</Target>
|
||||
|
@ -402,7 +408,7 @@ This package is an internal implementation of the .NET Core SDK and is not meant
|
|||
|
||||
<Target Name="_ResolveSharedFrameworkContent" DependsOnTargets="ResolveReferences;Crossgen">
|
||||
<ItemGroup>
|
||||
<SharedFxContent Include="$(VersionFileIntermediateOutputPath)" />
|
||||
<SharedFxContent Include="$(DotVersionFileIntermediateOutputPath)" />
|
||||
<SharedFxContent Include="$(ProjectDepsFilePath)" />
|
||||
<SharedFxContent Include="$(ProjectRuntimeConfigFilePath)" />
|
||||
<SharedFxContent Include="@(ReferenceCopyLocalPaths)" Condition="'%(Extension)' != '.pdb'" />
|
||||
|
@ -501,7 +507,7 @@ This package is an internal implementation of the .NET Core SDK and is not meant
|
|||
BeforeTargets="_GetPackageFiles">
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="$(VersionFileIntermediateOutputPath)" Pack="true" PackagePath="." />
|
||||
<None Include="$(VersionTxtFileIntermediateOutputPath)" Pack="true" PackagePath="." />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace Microsoft.AspNetCore
|
|||
{
|
||||
private readonly string _expectedTfm;
|
||||
private readonly string _expectedRid;
|
||||
private readonly string _expectedVersionFileName;
|
||||
private readonly string _sharedFxRoot;
|
||||
private readonly ITestOutputHelper _output;
|
||||
|
||||
|
@ -26,6 +27,7 @@ namespace Microsoft.AspNetCore
|
|||
_sharedFxRoot = string.IsNullOrEmpty(Environment.GetEnvironmentVariable("ASPNET_RUNTIME_PATH"))
|
||||
? Path.Combine(TestData.GetTestDataValue("SharedFrameworkLayoutRoot"), "shared", TestData.GetTestDataValue("RuntimePackageVersion"))
|
||||
: Environment.GetEnvironmentVariable("ASPNET_RUNTIME_PATH");
|
||||
_expectedVersionFileName = string.IsNullOrEmpty(Environment.GetEnvironmentVariable("ASPNET_RUNTIME_PATH")) ? ".version" : "Microsoft.AspNetCore.App.versions.txt";
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -133,7 +135,7 @@ namespace Microsoft.AspNetCore
|
|||
[Fact]
|
||||
public void ItContainsVersionFile()
|
||||
{
|
||||
var versionFile = Path.Combine(_sharedFxRoot, "Microsoft.AspNetCore.App.versions.txt");
|
||||
var versionFile = Path.Combine(_sharedFxRoot, _expectedVersionFileName);
|
||||
AssertEx.FileExists(versionFile);
|
||||
var lines = File.ReadAllLines(versionFile);
|
||||
Assert.Equal(2, lines.Length);
|
||||
|
|
Загрузка…
Ссылка в новой задаче