Merge branch 'rel/1.0.1' into merge_rel101_into_master

* rel/1.0.1: (66 commits)
  Update LZMA license with correct text
  Bump to 2.0.0-rc5-61427-04
  Remove duplicate installer suffix
  Add license text to LZMA SDK license notice
  Updating the SDK to 1.0.0-alpha-20170224-6
  Updating both platform abstractions and dependency model to 1.0.3.
  Bump Roslyn to 2.0.0-rc5-61424-02
  Update Stage0 to use the latest build.
  Update README with new distros.
  Back porting #5597 into rel/1.0.0
  Fixing the exclude pattern used by the Migration to exclude WEB SDK globs.
  Remove RID from test package creation
  Disable migrate and publish web app with content because CI does not have NPM
  Adding an E2E test for pack with content during migration.
  Fixing a failing test and adding a few more E2E tests around binplace content for migrated projects.
  Fix debian_config.json on ubuntu16.10
  Updating publish, pack and build of content to use None with Never/false/Never in their metadata for excluded items.
  Intermediate commit to get a WIP PR out. This adds the None Update with CopyToOutputDirectory set to Never.
  Switching the CopyToOutput for build and publish and the file for pack to use None Update instead of include. Also, fixed the exclude patterns for web apps.
  Do not migrate Content that is already included in the Web SDK for web apps.
  ...
This commit is contained in:
Livar Cunha 2017-03-01 20:50:42 -08:00
commit 3a9525b5ac
105 changed files with 1994 additions and 706 deletions

View file

@ -1 +1 @@
1.0.0-preview3-003930 1.0.0-preview2-1-003177

View file

@ -1,2 +1,2 @@
microsoft.dotnet.buildtools=1.0.26-prerelease-00926-02 microsoft.dotnet.buildtools=1.0.27-prerelease-01316-08
microsoft.dotnet.buildtools.run=1.0.0-prerelease-00807-04 microsoft.dotnet.buildtools.run=1.0.0-prerelease-00807-04

View file

@ -9,5 +9,6 @@
<add key="roslyn" value="https://dotnet.myget.org/f/roslyn/api/v3/index.json" /> <add key="roslyn" value="https://dotnet.myget.org/f/roslyn/api/v3/index.json" />
<add key="xunit" value="https://www.myget.org/F/xunit/api/v3/index.json" /> <add key="xunit" value="https://www.myget.org/F/xunit/api/v3/index.json" />
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" /> <add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="AspNetCurrent" value="https://dotnet.myget.org/F/aspnet-feb2017-patch/api/v3/index.json" />
</packageSources> </packageSources>
</configuration> </configuration>

View file

@ -23,8 +23,7 @@ There are a couple of things to keep in mind:
Found an issue? Found an issue?
--------------- ---------------
You can consult the [known issues page](https://github.com/dotnet/core/blob/master/cli/known-issues.md) to find out the current issues and You can consult the [known issues page](https://github.com/dotnet/core/blob/master/cli/known-issues.md) to find out the current issues and to see the workarounds.
to see the workarounds.
If you don't find your issue, please file one! However, given that this is a very high-frequency repo, we've setup some [basic guidelines](Documentation/issue-filing-guide.md) to help you. Please consult those first. If you don't find your issue, please file one! However, given that this is a very high-frequency repo, we've setup some [basic guidelines](Documentation/issue-filing-guide.md) to help you. Please consult those first.

View file

@ -31,9 +31,13 @@ specific language governing permissions and limitations under the License.
License notice for LZMA SDK License notice for LZMA SDK
--------------------------- ---------------------------
http://www.7-zip.org/sdk.html http://7-zip.org/sdk.html
LZMA is placed in the public domain. LZMA SDK is placed in the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute the
original LZMA SDK code, either in source code form or as a compiled binary,
for any purpose, commercial or non-commercial, and by any means.
License notice for RFC 3492 License notice for RFC 3492
--------------------------- ---------------------------

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netcoreapp1.0;net451</TargetFrameworks> <TargetFrameworks>netcoreapp1.1;net451</TargetFrameworks>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);portable-net45+win8;dnxcore50</PackageTargetFallback> <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);portable-net45+win8;dnxcore50</PackageTargetFallback>
<RuntimeIdentifiers>win7-x64;win7-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</RuntimeIdentifiers> <RuntimeIdentifiers>win7-x64;win7-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</RuntimeIdentifiers>
@ -11,11 +11,6 @@
<Version>1.0.0-*</Version> <Version>1.0.0-*</Version>
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">
<PackageReference Include="Microsoft.NETCore.App">
<Version>1.0.3</Version>
</PackageReference>
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net451' "> <ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
@ -25,7 +20,4 @@
<Version>1.0.0-*</Version> <Version>1.0.0-*</Version>
</DotNetCliToolReference> </DotNetCliToolReference>
</ItemGroup> </ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
</Project> </Project>

View file

@ -4,6 +4,7 @@
<AssemblyName>AppWithRedirectsAndConfig</AssemblyName> <AssemblyName>AppWithRedirectsAndConfig</AssemblyName>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<RuntimeIdentifiers>win7-x64;win7-x86</RuntimeIdentifiers> <RuntimeIdentifiers>win7-x64;win7-x86</RuntimeIdentifiers>
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View file

@ -4,6 +4,7 @@
<AssemblyName>AppWithRedirectsNoConfig</AssemblyName> <AssemblyName>AppWithRedirectsNoConfig</AssemblyName>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<RuntimeIdentifiers>win7-x64;win7-x86</RuntimeIdentifiers> <RuntimeIdentifiers>win7-x64;win7-x86</RuntimeIdentifiers>
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View file

@ -2,7 +2,8 @@
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netstandard1.6;net451</TargetFrameworks> <TargetFrameworks>netstandard1.6;net451</TargetFrameworks>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);portable-net45+win8;dnxcore50;netcoreapp1.0</PackageTargetFallback> <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);portable-net45+win8;dnxcore50;netcoreapp1.1</PackageTargetFallback>
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View file

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.0</TargetFramework> <TargetFramework>netcoreapp1.1</TargetFramework>
<AssemblyName>dotnet-throwingtool</AssemblyName> <AssemblyName>dotnet-throwingtool</AssemblyName>
<PackageId>$(AssemblyName)</PackageId> <PackageId>$(AssemblyName)</PackageId>
</PropertyGroup> </PropertyGroup>
@ -13,10 +13,4 @@
</BuiltProjectOutputGroupOutput> </BuiltProjectOutputGroupOutput>
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.App">
<Version>1.0.3</Version>
</PackageReference>
</ItemGroup>
</Project> </Project>

View file

@ -2,15 +2,10 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.0</TargetFramework> <TargetFramework>netcoreapp1.1</TargetFramework>
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.App">
<Version>1.0.3</Version>
</PackageReference>
</ItemGroup>
<ItemGroup> <ItemGroup>
<DotNetCliToolReference Include="dotnet-throwingtool"> <DotNetCliToolReference Include="dotnet-throwingtool">
<Version>1.0.0</Version> <Version>1.0.0</Version>

View file

@ -2,8 +2,8 @@
"version": "1.0.0-*", "version": "1.0.0-*",
"content": "*.txt", "content": "*.txt",
"contentExclude": "ExcludeThis1.txt", "contentExclude": "ExcludeThis1.txt",
"contentFiles": [ "../ContentFile1.txt", "../ContentFile2.txt" ], "contentFiles": [ "ContentFile1.txt1", "ContentFile2.txt1" ],
"contentBuiltIn": [ "../ContentFileBuiltIn1.txt", "../ContentFileBuiltIn2.txt" ], "contentBuiltIn": [ "ContentFileBuiltIn1.txt1", "ContentFileBuiltIn2.txt1" ],
"publishExclude": "ExcludeThis2.txt", "publishExclude": "ExcludeThis2.txt",
"buildOptions": { "buildOptions": {
"debugType": "portable", "debugType": "portable",

View file

@ -2,12 +2,12 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.0</TargetFramework> <TargetFramework>netcoreapp1.1</TargetFramework>
<GeneratedPackageId>random-name</GeneratedPackageId> <GeneratedPackageId>random-name</GeneratedPackageId>
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NETCore.App" Version="1.0.3" />
<DotNetCliToolReference Include="$(GeneratedPackageId)"> <DotNetCliToolReference Include="$(GeneratedPackageId)">
<Version>1.0.0</Version> <Version>1.0.0</Version>
</DotNetCliToolReference> </DotNetCliToolReference>

View file

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.0</TargetFramework> <TargetFramework>netcoreapp1.1</TargetFramework>
<GeneratedPackageId>random-name</GeneratedPackageId> <GeneratedPackageId>random-name</GeneratedPackageId>
<PackageId>$(GeneratedPackageId)</PackageId> <PackageId>$(GeneratedPackageId)</PackageId>
<AssemblyName>dotnet-randompackage</AssemblyName> <AssemblyName>dotnet-randompackage</AssemblyName>
@ -14,8 +14,4 @@
</BuiltProjectOutputGroupOutput> </BuiltProjectOutputGroupOutput>
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.App" Version="1.0.3" />
</ItemGroup>
</Project> </Project>

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp1.0</TargetFramework> <TargetFramework>netcoreapp1.1</TargetFramework>
<AssemblyName>dotnet-tool-with-output-name</AssemblyName> <AssemblyName>dotnet-tool-with-output-name</AssemblyName>
<PackageId>ToolWithOutputName</PackageId> <PackageId>ToolWithOutputName</PackageId>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
@ -12,13 +12,4 @@
</BuiltProjectOutputGroupOutput> </BuiltProjectOutputGroupOutput>
</ItemGroup> </ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">
<PackageReference Include="Microsoft.NETCore.App">
<Version>1.0.4</Version>
</PackageReference>
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
</Project> </Project>

View file

@ -1,4 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup> <PropertyGroup>
<VersionPrefix>1.0.0-rc</VersionPrefix> <VersionPrefix>1.0.0-rc</VersionPrefix>
<TargetFramework>netcoreapp1.0</TargetFramework> <TargetFramework>netcoreapp1.0</TargetFramework>
@ -18,7 +20,7 @@
<Version>1.0.4</Version> <Version>1.0.4</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyModel"> <PackageReference Include="Microsoft.Extensions.DependencyModel">
<Version>1.0.1-beta-000933</Version> <Version>$(DependencyModelVersion)</Version>
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>

View file

@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<VersionPrefix>1.0.0-rc</VersionPrefix> <VersionPrefix>1.0.0-rc</VersionPrefix>
<TargetFramework>netcoreapp1.0</TargetFramework> <TargetFramework>netcoreapp1.1</TargetFramework>
<AssemblyName>dotnet-dependency-tool-invoker</AssemblyName> <AssemblyName>dotnet-dependency-tool-invoker</AssemblyName>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);portable-net45+win8;dnxcore50</PackageTargetFallback> <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);portable-net45+win8;dnxcore50</PackageTargetFallback>
@ -23,9 +23,6 @@
</BuiltProjectOutputGroupOutput> </BuiltProjectOutputGroupOutput>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NETCore.App">
<Version>1.0.4</Version>
</PackageReference>
<PackageReference Include="NuGet.Frameworks"> <PackageReference Include="NuGet.Frameworks">
<Version>$(CLI_NuGet_Version)</Version> <Version>$(CLI_NuGet_Version)</Version>
</PackageReference> </PackageReference>
@ -33,8 +30,4 @@
<Version>$(SdkNugetVersion)</Version> <Version>$(SdkNugetVersion)</Version>
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
</Project> </Project>

View file

@ -1,24 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0"> <Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<PropertyGroup> <PropertyGroup>
<VersionPrefix>1.0.0-rc</VersionPrefix> <VersionPrefix>1.0.0-rc</VersionPrefix>
<TargetFrameworks>netcoreapp1.0;net451</TargetFrameworks> <TargetFrameworks>netcoreapp1.1;net451</TargetFrameworks>
<AssemblyName>dotnet-desktop-and-portable</AssemblyName> <AssemblyName>dotnet-desktop-and-portable</AssemblyName>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<RuntimeIdentifiers>win7-x64;win7-x86</RuntimeIdentifiers> <RuntimeIdentifiers>win7-x64;win7-x86</RuntimeIdentifiers>
</PropertyGroup> </PropertyGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' "> <ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.1' ">
<BuiltProjectOutputGroupOutput Include="$(ProjectRuntimeConfigFilePath)"> <BuiltProjectOutputGroupOutput Include="$(ProjectRuntimeConfigFilePath)">
<FinalOutputPath>$(ProjectRuntimeConfigFilePath)</FinalOutputPath> <FinalOutputPath>$(ProjectRuntimeConfigFilePath)</FinalOutputPath>
</BuiltProjectOutputGroupOutput> </BuiltProjectOutputGroupOutput>
</ItemGroup> </ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">
<PackageReference Include="Microsoft.NETCore.App">
<Version>1.0.4</Version>
</PackageReference>
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net451' "> <ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />

View file

@ -2,7 +2,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp1.0</TargetFramework> <TargetFramework>netcoreapp1.1</TargetFramework>
<AssemblyName>dotnet-portable</AssemblyName> <AssemblyName>dotnet-portable</AssemblyName>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<VersionSuffix></VersionSuffix> <VersionSuffix></VersionSuffix>
@ -13,14 +13,4 @@
<FinalOutputPath>$(ProjectRuntimeConfigFilePath)</FinalOutputPath> <FinalOutputPath>$(ProjectRuntimeConfigFilePath)</FinalOutputPath>
</BuiltProjectOutputGroupOutput> </BuiltProjectOutputGroupOutput>
</ItemGroup> </ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">
<PackageReference Include="Microsoft.NETCore.App">
<Version>1.0.4</Version>
</PackageReference>
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
</Project> </Project>

View file

@ -2,6 +2,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp1.0</TargetFramework> <TargetFramework>netcoreapp1.0</TargetFramework>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -14,7 +15,4 @@
<Version>1.0.0</Version> <Version>1.0.0</Version>
</DotNetCliToolReference> </DotNetCliToolReference>
</ItemGroup> </ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
</Project> </Project>

View file

@ -2,6 +2,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework> <TargetFramework>netcoreapp2.0</TargetFramework>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View file

@ -1,23 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp1.0</TargetFramework> <TargetFramework>netcoreapp1.1</TargetFramework>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="ToolWithOutputName"> <PackageReference Include="ToolWithOutputName">
<Version>1.0.0</Version> <Version>1.0.0</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.NETCore.App">
<Version>1.0.3</Version>
</PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<DotNetCliToolReference Include="dotnet-dependency-tool-invoker"> <DotNetCliToolReference Include="dotnet-dependency-tool-invoker">
<Version>1.0.0-*</Version> <Version>1.0.0-*</Version>
</DotNetCliToolReference> </DotNetCliToolReference>
</ItemGroup> </ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
</Project> </Project>

View file

@ -2,6 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFrameworks>net451;netcoreapp1.0</TargetFrameworks> <TargetFrameworks>net451;netcoreapp1.0</TargetFrameworks>
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View file

@ -1,14 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp1.0</TargetFramework> <TargetFramework>netcoreapp1.1</TargetFramework>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.App">
<Version>1.0.3</Version>
</PackageReference>
</ItemGroup>
<ItemGroup> <ItemGroup>
<DotNetCliToolReference Include="dotnet-portable"> <DotNetCliToolReference Include="dotnet-portable">
<Version>1.0.0</Version> <Version>1.0.0</Version>
@ -17,7 +13,4 @@
<Version>1.0.0</Version> <Version>1.0.0</Version>
</DotNetCliToolReference> </DotNetCliToolReference>
</ItemGroup> </ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
</Project> </Project>

View file

@ -2,6 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFrameworks>net451;netcoreapp1.0</TargetFrameworks> <TargetFrameworks>net451;netcoreapp1.0</TargetFrameworks>
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View file

@ -0,0 +1 @@
Random content.

View file

@ -17,5 +17,13 @@
}, },
"frameworks": { "frameworks": {
"netstandard1.5": {} "netstandard1.5": {}
},
"packOptions": {
"files": {
"include": ["contentitem.txt"],
"mappings": {
"dir/contentitem.txt": "contentitem.txt"
}
}
} }
} }

View file

@ -97,7 +97,8 @@
"wwwroot", "wwwroot",
"**/*.cshtml", "**/*.cshtml",
"appsettings.json", "appsettings.json",
"web.config" "web.config",
"README.md"
] ]
}, },

View file

@ -1,13 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.0</TargetFramework> <TargetFramework>netcoreapp1.1</TargetFramework>
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NETCore.App">
<Version>1.0.3</Version>
</PackageReference>
<PackageReference Include="dotnet-portable"> <PackageReference Include="dotnet-portable">
<Version>1.0.0</Version> <Version>1.0.0</Version>
<PrivateAssets>All</PrivateAssets> <PrivateAssets>All</PrivateAssets>

View file

@ -2,13 +2,11 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.0</TargetFramework> <TargetFramework>netcoreapp1.1</TargetFramework>
<DisableImplicitFrameworkReferences>false</DisableImplicitFrameworkReferences>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NETCore.App">
<Version>1.0.3</Version>
</PackageReference>
<PackageReference Include="MSTest.TestFramework"> <PackageReference Include="MSTest.TestFramework">
<Version>1.0.6-preview</Version> <Version>1.0.6-preview</Version>
</PackageReference> </PackageReference>

View file

@ -2,13 +2,11 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.0</TargetFramework> <TargetFramework>netcoreapp1.1</TargetFramework>
<DisableImplicitFrameworkReferences>false</DisableImplicitFrameworkReferences>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NETCore.App">
<Version>1.0.3</Version>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk"> <PackageReference Include="Microsoft.NET.Test.Sdk">
<Version>$(CLI_TestPlatform_Version)</Version> <Version>$(CLI_TestPlatform_Version)</Version>
</PackageReference> </PackageReference>

View file

@ -45,11 +45,10 @@
<ReplaceFileContents <ReplaceFileContents
InputFile="$(DebianConfigTemplateFile)" InputFile="$(DebianConfigTemplateFile)"
DestinationFile="$(DebianConfigJsonFile)" DestinationFile="$(DebianConfigJsonFile)"
ReplacementPatterns="@(DebianConfigTokenValues -> '%(Identity)')" ReplacementItems="@(DebianConfigTokenValues)" />
ReplacementStrings="@(DebianConfigTokenValues -> '%(ReplacementString)')" />
<!-- Build SDK Deb package --> <!-- Build SDK Deb package -->
<DotNetDebTool ToolPath="$(Stage0PjDirectory)" <DotNetDebTool ToolPath="$(Stage0Directory)"
InputDirectory="$(LayoutDirectory)" InputDirectory="$(LayoutDirectory)"
OutputDirectory="$(DotNetDebToolOutputDirectory)" OutputDirectory="$(DotNetDebToolOutputDirectory)"
PackageName="$(SdkDebianPackageName)" PackageName="$(SdkDebianPackageName)"
@ -75,8 +74,10 @@
<Exec Command="sudo dpkg -r $(SharedFxDebianPackageName)" /> <Exec Command="sudo dpkg -r $(SharedFxDebianPackageName)" />
<Exec Command="sudo dpkg -r $(HostFxrDebianPackageName)" /> <Exec Command="sudo dpkg -r $(HostFxrDebianPackageName)" />
<Exec Command="sudo dpkg -r $(AdditionalSharedFxDebianPackageName)" /> <Exec Command="sudo dpkg -r $(AdditionalSharedFxDebianPackageName)"
<Exec Command="sudo dpkg -r $(AdditionalHostFxrDebianPackageName)" /> Condition="'$(IncludeAdditionalSharedFrameworks)' == 'true'" />
<Exec Command="sudo dpkg -r $(AdditionalHostFxrDebianPackageName)"
Condition="'$(IncludeAdditionalSharedFrameworks)' == 'true'" />
<Exec Command="sudo dpkg -r $(HostDebianPackageName)" /> <Exec Command="sudo dpkg -r $(HostDebianPackageName)" />
</Target> </Target>
@ -90,9 +91,12 @@
Outputs="$(DebianTestResultsXmlFile)" > Outputs="$(DebianTestResultsXmlFile)" >
<!-- Install Dependencies and SDK Packages --> <!-- Install Dependencies and SDK Packages -->
<Exec Command="sudo dpkg -i $(AdditionalDownloadedSharedHostInstallerFile)" /> <Exec Command="sudo dpkg -i $(AdditionalDownloadedSharedHostInstallerFile)"
<Exec Command="sudo dpkg -i $(AdditionalDownloadedHostFxrInstallerFile)" /> Condition="'$(IncludeAdditionalSharedFrameworks)' == 'true'" />
<Exec Command="sudo dpkg -i $(AdditionalDownloadedSharedFrameworkInstallerFile)" /> <Exec Command="sudo dpkg -i $(AdditionalDownloadedHostFxrInstallerFile)"
Condition="'$(IncludeAdditionalSharedFrameworks)' == 'true'" />
<Exec Command="sudo dpkg -i $(AdditionalDownloadedSharedFrameworkInstallerFile)"
Condition="'$(IncludeAdditionalSharedFrameworks)' == 'true'" />
<Exec Command="sudo dpkg -i $(DownloadedSharedHostInstallerFile)" /> <Exec Command="sudo dpkg -i $(DownloadedSharedHostInstallerFile)" />
<Exec Command="sudo dpkg -i $(DownloadedHostFxrInstallerFile)" /> <Exec Command="sudo dpkg -i $(DownloadedHostFxrInstallerFile)" />
@ -113,8 +117,10 @@
<Exec Command="sudo dpkg -r $(SharedFxDebianPackageName)" /> <Exec Command="sudo dpkg -r $(SharedFxDebianPackageName)" />
<Exec Command="sudo dpkg -r $(HostFxrDebianPackageName)" /> <Exec Command="sudo dpkg -r $(HostFxrDebianPackageName)" />
<Exec Command="sudo dpkg -r $(AdditionalSharedFxDebianPackageName)" /> <Exec Command="sudo dpkg -r $(AdditionalSharedFxDebianPackageName)"
<Exec Command="sudo dpkg -r $(AdditionalHostFxrDebianPackageName)" /> Condition="'$(IncludeAdditionalSharedFrameworks)' == 'true'" />
<Exec Command="sudo dpkg -r $(AdditionalHostFxrDebianPackageName)"
Condition="'$(IncludeAdditionalSharedFrameworks)' == 'true'" />
<Exec Command="sudo dpkg -r $(HostDebianPackageName)" /> <Exec Command="sudo dpkg -r $(HostDebianPackageName)" />
</Target> </Target>
@ -148,10 +154,9 @@
</Target> </Target>
<Target Name="PrepareDotnetDebTool" <Target Name="PrepareDotnetDebTool"
DependsOnTargets="WriteDotnetDebToolProjectJson;"> DependsOnTargets="WriteDotnetDebToolProject">
<DotNetRestorePj FallbackSource="$(DotnetDebToolPackageSource)" <DotNetRestore ToolPath="$(Stage0Directory)"
ToolPath="$(Stage0PjDirectory)"
WorkingDirectory="$(DotnetDebToolDir)" /> WorkingDirectory="$(DotnetDebToolDir)" />
</Target> </Target>
@ -159,12 +164,9 @@
Inputs="$(MSBuildThisFile);$(MSBuildThisFileDirectory)/Installer.DEB.props" Inputs="$(MSBuildThisFile);$(MSBuildThisFileDirectory)/Installer.DEB.props"
Outputs="$(DotnetDebToolDir)/project.json"> Outputs="$(DotnetDebToolDir)/project.json">
<MakeDir Condition=" !Exists($(DotnetDebToolDir)) " <Copy SourceFiles="$(MSBuildThisFileDirectory)/$(DotnetDebToolConsumerProjectName)"
Directories="$(DotnetDebToolDir)" /> DestinationFiles="$(DotnetDebToolDir)/$(DotnetDebToolConsumerProjectName)" />
<WriteLinesToFile File="$(DotnetDebToolDir)/project.json"
Lines="@(DotnetDebToolProjectJsonLines)"
Overwrite="True" />
</Target> </Target>
<Target Name="TestDebuild"> <Target Name="TestDebuild">

View file

@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<DotNetCliToolReference Include="dotnet-deb-tool" Version="2.0.0-*" />
</ItemGroup>
</Project>

View file

@ -20,7 +20,7 @@
<Version>4.1.0</Version> <Version>4.1.0</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions"> <PackageReference Include="Microsoft.DotNet.PlatformAbstractions">
<Version>1.0.1-beta-000933</Version> <Version>$(PlatformAbstractionsVersion)</Version>
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>

View file

@ -18,6 +18,9 @@ namespace Microsoft.DotNet.Cli.Build
{ {
} }
[Required]
public string SDKVersion { get; set; }
[Required] [Required]
public string ToolPath { get; set; } public string ToolPath { get; set; }
@ -75,6 +78,8 @@ namespace Microsoft.DotNet.Cli.Build
Directory.Delete(targetDir, true); Directory.Delete(targetDir, true);
} }
dataToHash += SDKVersion;
Log.LogMessage($"NuGet Packages Archive Data To Hash: '{dataToHash}'"); Log.LogMessage($"NuGet Packages Archive Data To Hash: '{dataToHash}'");
var sha256 = SHA256.Create(); var sha256 = SHA256.Create();

View file

@ -9,7 +9,12 @@ using Microsoft.Build.Framework;
namespace Microsoft.DotNet.Cli.Build namespace Microsoft.DotNet.Cli.Build
{ {
/// <summary> /// <summary>
/// Reads contents of an input file, and searches for each ReplacementPattern passed in. /// Reads contents of an input file, and searches for each replacement passed in.
///
/// When ReplacementItems is matched, it will replace the Include/ItemSpec with the corresponding
/// ReplacementString metadata value. This can be useful if the ReplacementString is a value that
/// cannot be represented by ITaskItem.ItemSpec (like string.Empty).
///
/// When a ReplacementPattern is matched it will replace it with the string of the corresponding (by index) /// When a ReplacementPattern is matched it will replace it with the string of the corresponding (by index)
/// item in ReplacementStrings. /// item in ReplacementStrings.
/// ///
@ -27,14 +32,23 @@ namespace Microsoft.DotNet.Cli.Build
[Required] [Required]
public string DestinationFile { get; set; } public string DestinationFile { get; set; }
[Required] public ITaskItem[] ReplacementItems { get; set; }
public ITaskItem[] ReplacementPatterns { get; set; } public ITaskItem[] ReplacementPatterns { get; set; }
[Required]
public ITaskItem[] ReplacementStrings { get; set; } public ITaskItem[] ReplacementStrings { get; set; }
public override bool Execute() public override bool Execute()
{ {
if (ReplacementItems == null && ReplacementPatterns == null && ReplacementStrings == null)
{
throw new Exception($"ReplaceFileContents was called with no replacement values. Either pass ReplacementItems or ReplacementPatterns/ReplacementStrings properties.");
}
ReplacementItems = ReplacementItems ?? Array.Empty<ITaskItem>();
ReplacementPatterns = ReplacementPatterns ?? Array.Empty<ITaskItem>();
ReplacementStrings = ReplacementStrings ?? Array.Empty<ITaskItem>();
if (ReplacementPatterns.Length != ReplacementStrings.Length) if (ReplacementPatterns.Length != ReplacementStrings.Length)
{ {
throw new Exception($"Expected {nameof(ReplacementPatterns)} (length {ReplacementPatterns.Length}) and {nameof(ReplacementStrings)} (length {ReplacementStrings.Length}) to have the same length."); throw new Exception($"Expected {nameof(ReplacementPatterns)} (length {ReplacementPatterns.Length}) and {nameof(ReplacementStrings)} (length {ReplacementStrings.Length}) to have the same length.");
@ -57,6 +71,14 @@ namespace Microsoft.DotNet.Cli.Build
{ {
var outText = inputFileText; var outText = inputFileText;
foreach (var replacementItem in ReplacementItems)
{
var replacementPattern = replacementItem.ItemSpec;
var replacementString = replacementItem.GetMetadata("ReplacementString");
outText = outText.Replace(replacementPattern, replacementString);
}
for (int i=0; i<ReplacementPatterns.Length; ++i) for (int i=0; i<ReplacementPatterns.Length; ++i)
{ {
var replacementPattern = ReplacementPatterns[i].ItemSpec; var replacementPattern = ReplacementPatterns[i].ItemSpec;

View file

@ -52,7 +52,7 @@
<Version>$(CLI_MSBuild_Version)</Version> <Version>$(CLI_MSBuild_Version)</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions"> <PackageReference Include="Microsoft.DotNet.PlatformAbstractions">
<Version>1.0.1-beta-000933</Version> <Version>$(PlatformAbstractionsVersion)</Version>
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>
</Project> </Project>

View file

@ -38,7 +38,7 @@
<Version>7.2.1</Version> <Version>7.2.1</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions"> <PackageReference Include="Microsoft.DotNet.PlatformAbstractions">
<Version>1.0.1-beta-000933</Version> <Version>$(PlatformAbstractionsVersion)</Version>
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>

View file

@ -29,7 +29,6 @@
}, },
"debian_dependencies":{ "debian_dependencies":{
"%SHARED_FRAMEWORK_DEBIAN_PACKAGE_NAME%" : {}, "%SHARED_FRAMEWORK_DEBIAN_PACKAGE_NAME%" : {}%SHARED_FRAMEWORK_DEBIAN_PACKAGE_ADDITIONAL_DEPENDENCY%
"%SHARED_FRAMEWORK_DEBIAN_PACKAGE_NAME_ADDITIONAL%" : {}
} }
} }

View file

@ -0,0 +1,28 @@
FROM fedora:24
RUN dnf install -y bash git cmake wget which python clang-3.8.0-1.fc24.x86_64 llvm-devel-3.8.0-1.fc24.x86_64 make libicu-devel lldb-devel.x86_64 \
libunwind-devel.x86_64 lttng-ust-devel.x86_64 uuid-devel libuuid-devel tar glibc-locale-source zlib-devel libcurl-devel \
krb5-devel openssl-devel autoconf libtool hostname
RUN dnf upgrade -y nss
RUN dnf clean all
# Set a different rid to publish buildtools for, until we update to a version which
# natively supports fedora.24-x64
ENV __PUBLISH_RID=fedora.23-x64
# Setup User to match Host User, and give superuser permissions
ARG USER_ID=0
RUN useradd -m code_executor -u ${USER_ID} -g wheel
RUN echo 'code_executor ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# With the User Change, we need to change permissions on these directories
RUN chmod -R a+rwx /usr/local
RUN chmod -R a+rwx /home
# Set user to the one we just created
USER ${USER_ID}
# Set working directory
WORKDIR /opt/code

View file

@ -0,0 +1,50 @@
#
# 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.
#
FROM opensuse:42.1
# Install the base toolchain we need to build anything (clang, cmake, make and the like)
# this does not include libraries that we need to compile different projects, we'd like
# them in a different layer.
RUN zypper -n install binutils \
cmake \
which \
gcc \
llvm-clang \
tar \
ncurses-utils \
curl \
git \
sudo && \
ln -s /usr/bin/clang++ /usr/bin/clang++-3.5 && \
zypper clean -a
# Dependencies of CoreCLR and CoreFX.
RUN zypper -n install --force-resolution \
libunwind \
libicu \
lttng-ust \
libuuid1 \
libopenssl1_0_0 \
libcurl4 \
krb5 && \
zypper clean -a
# Setup User to match Host User, and give superuser permissions
ARG USER_ID=0
RUN useradd -m code_executor -u ${USER_ID} -g wheel
RUN echo 'code_executor ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# With the User Change, we need to change permissions on these directories
RUN chmod -R a+rwx /usr/local
RUN chmod -R a+rwx /home
RUN chmod -R 755 /usr/lib/sudo
# Set user to the one we just created
USER ${USER_ID}
# Set working directory
WORKDIR /opt/code

View file

@ -0,0 +1,63 @@
#
# 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.
#
# Dockerfile that creates a container suitable to build dotnet-cli
FROM ubuntu:16.10
# Misc Dependencies for build
RUN apt-get update && \
apt-get -qqy install \
curl \
unzip \
gettext \
sudo && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# This could become a "microsoft/coreclr" image, since it just installs the dependencies for CoreCLR (and stdlib)
RUN apt-get update && \
apt-get -qqy install \
libunwind8 \
libkrb5-3 \
libicu57 \
liblttng-ust0 \
libssl1.0.0 \
zlib1g \
libuuid1 \
liblldb-3.5 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install Build Prereqs
RUN apt-get update && \
apt-get -qqy install \
debhelper \
build-essential \
devscripts \
git \
cmake \
clang-3.5 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Use clang as c++ compiler
RUN update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-3.5 100
RUN update-alternatives --set c++ /usr/bin/clang++-3.5
# Setup User to match Host User, and give superuser permissions
ARG USER_ID=0
RUN useradd -m code_executor -u ${USER_ID} -g sudo
RUN echo 'code_executor ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# With the User Change, we need to change permissions on these directories
RUN chmod -R a+rwx /usr/local
RUN chmod -R a+rwx /home
RUN chmod -R 755 /usr/lib/sudo
# Set user to the one we just created
USER ${USER_ID}
# Set working directory
WORKDIR /opt/code

View file

@ -2,4 +2,9 @@
This source came from the C# implementation of LZMA from the LZMA SDK, version 16.02, from http://www.7-zip.org/sdk.html. This source came from the C# implementation of LZMA from the LZMA SDK, version 16.02, from http://www.7-zip.org/sdk.html.
## License ## License
The LZMA SDK is public domain. Thanks goes to Igor Pavlov for making this available. LZMA SDK is placed in the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute the original LZMA SDK code, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.
## Thanks!
Thanks goes to Igor Pavlov for making this available.

View file

@ -2,6 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information. // Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Collections.Generic; using System.Collections.Generic;
using NuGet.Frameworks;
using NuGet.ProjectModel; using NuGet.ProjectModel;
namespace Microsoft.DotNet.Cli.Utils namespace Microsoft.DotNet.Cli.Utils
@ -22,6 +23,8 @@ namespace Microsoft.DotNet.Cli.Utils
string FullOutputPath { get; } string FullOutputPath { get; }
NuGetFramework DotnetCliToolTargetFramework { get; }
Dictionary<string, string> EnvironmentVariables { get; } Dictionary<string, string> EnvironmentVariables { get; }
} }
} }

View file

@ -13,6 +13,8 @@ namespace Microsoft.DotNet.Cli.Utils
{ {
internal class MSBuildProject : IProject internal class MSBuildProject : IProject
{ {
private static readonly NuGetFramework s_toolPackageFramework = FrameworkConstants.CommonFrameworks.NetCoreApp10;
private Project _project; private Project _project;
private string _projectRoot; private string _projectRoot;
@ -60,6 +62,25 @@ namespace Microsoft.DotNet.Cli.Utils
} }
} }
public NuGetFramework DotnetCliToolTargetFramework
{
get
{
var frameworkString = _project
.AllEvaluatedProperties
.FirstOrDefault(p => p.Name.Equals("DotnetCliToolTargetFramework"))
?.EvaluatedValue;
if (string.IsNullOrEmpty(frameworkString))
{
return s_toolPackageFramework;
}
return NuGetFramework.Parse(frameworkString);
}
}
public Dictionary<string, string> EnvironmentVariables public Dictionary<string, string> EnvironmentVariables
{ {
get get

View file

@ -21,8 +21,6 @@ namespace Microsoft.DotNet.Cli.Utils
{ {
private const string ProjectToolsCommandResolverName = "projecttoolscommandresolver"; private const string ProjectToolsCommandResolverName = "projecttoolscommandresolver";
private static readonly NuGetFramework s_toolPackageFramework = FrameworkConstants.CommonFrameworks.NetCoreApp10;
private static readonly CommandResolutionStrategy s_commandResolutionStrategy = private static readonly CommandResolutionStrategy s_commandResolutionStrategy =
CommandResolutionStrategy.ProjectToolsPackage; CommandResolutionStrategy.ProjectToolsPackage;
@ -136,8 +134,14 @@ namespace Microsoft.DotNet.Cli.Utils
ProjectToolsCommandResolverName, ProjectToolsCommandResolverName,
string.Join(Environment.NewLine, possiblePackageRoots.Select((p) => $"- {p}")))); string.Join(Environment.NewLine, possiblePackageRoots.Select((p) => $"- {p}"))));
var toolPackageFramework = project.DotnetCliToolTargetFramework;
string nugetPackagesRoot; string nugetPackagesRoot;
var toolLockFile = GetToolLockFile(toolLibraryRange, possiblePackageRoots, out nugetPackagesRoot); var toolLockFile = GetToolLockFile(
toolLibraryRange,
toolPackageFramework,
possiblePackageRoots,
out nugetPackagesRoot);
if (toolLockFile == null) if (toolLockFile == null)
{ {
@ -150,7 +154,7 @@ namespace Microsoft.DotNet.Cli.Utils
toolLockFile.Path)); toolLockFile.Path));
var toolLibrary = toolLockFile.Targets var toolLibrary = toolLockFile.Targets
.FirstOrDefault(t => s_toolPackageFramework == t.TargetFramework) .FirstOrDefault(t => toolPackageFramework == t.TargetFramework)
?.Libraries.FirstOrDefault( ?.Libraries.FirstOrDefault(
l => StringComparer.OrdinalIgnoreCase.Equals(l.Name, toolLibraryRange.Name)); l => StringComparer.OrdinalIgnoreCase.Equals(l.Name, toolLibraryRange.Name));
if (toolLibrary == null) if (toolLibrary == null)
@ -164,7 +168,11 @@ namespace Microsoft.DotNet.Cli.Utils
var depsFileRoot = Path.GetDirectoryName(toolLockFile.Path); var depsFileRoot = Path.GetDirectoryName(toolLockFile.Path);
var depsFilePath = GetToolDepsFilePath(toolLibraryRange, toolLockFile, depsFileRoot); var depsFilePath = GetToolDepsFilePath(
toolLibraryRange,
toolPackageFramework,
toolLockFile,
depsFileRoot);
var normalizedNugetPackagesRoot = PathUtility.EnsureNoTrailingDirectorySeparator(nugetPackagesRoot); var normalizedNugetPackagesRoot = PathUtility.EnsureNoTrailingDirectorySeparator(nugetPackagesRoot);
@ -206,12 +214,13 @@ namespace Microsoft.DotNet.Cli.Utils
private LockFile GetToolLockFile( private LockFile GetToolLockFile(
SingleProjectInfo toolLibrary, SingleProjectInfo toolLibrary,
NuGetFramework framework,
IEnumerable<string> possibleNugetPackagesRoot, IEnumerable<string> possibleNugetPackagesRoot,
out string nugetPackagesRoot) out string nugetPackagesRoot)
{ {
foreach (var packagesRoot in possibleNugetPackagesRoot) foreach (var packagesRoot in possibleNugetPackagesRoot)
{ {
if (TryGetToolLockFile(toolLibrary, packagesRoot, out LockFile lockFile)) if (TryGetToolLockFile(toolLibrary, framework, packagesRoot, out LockFile lockFile))
{ {
nugetPackagesRoot = packagesRoot; nugetPackagesRoot = packagesRoot;
return lockFile; return lockFile;
@ -233,11 +242,12 @@ namespace Microsoft.DotNet.Cli.Utils
private bool TryGetToolLockFile( private bool TryGetToolLockFile(
SingleProjectInfo toolLibrary, SingleProjectInfo toolLibrary,
NuGetFramework framework,
string nugetPackagesRoot, string nugetPackagesRoot,
out LockFile lockFile) out LockFile lockFile)
{ {
lockFile = null; lockFile = null;
var lockFilePath = GetToolLockFilePath(toolLibrary, nugetPackagesRoot); var lockFilePath = GetToolLockFilePath(toolLibrary, framework, nugetPackagesRoot);
if (!FileExistsWithLock(lockFilePath).Result) if (!FileExistsWithLock(lockFilePath).Result)
{ {
@ -260,6 +270,7 @@ namespace Microsoft.DotNet.Cli.Utils
private string GetToolLockFilePath( private string GetToolLockFilePath(
SingleProjectInfo toolLibrary, SingleProjectInfo toolLibrary,
NuGetFramework framework,
string nugetPackagesRoot) string nugetPackagesRoot)
{ {
var toolPathCalculator = new ToolPathCalculator(nugetPackagesRoot); var toolPathCalculator = new ToolPathCalculator(nugetPackagesRoot);
@ -267,11 +278,12 @@ namespace Microsoft.DotNet.Cli.Utils
return toolPathCalculator.GetBestLockFilePath( return toolPathCalculator.GetBestLockFilePath(
toolLibrary.Name, toolLibrary.Name,
VersionRange.Parse(toolLibrary.Version), VersionRange.Parse(toolLibrary.Version),
s_toolPackageFramework); framework);
} }
private string GetToolDepsFilePath( private string GetToolDepsFilePath(
SingleProjectInfo toolLibrary, SingleProjectInfo toolLibrary,
NuGetFramework framework,
LockFile toolLockFile, LockFile toolLockFile,
string depsPathRoot) string depsPathRoot)
{ {
@ -284,24 +296,26 @@ namespace Microsoft.DotNet.Cli.Utils
ProjectToolsCommandResolverName, ProjectToolsCommandResolverName,
depsJsonPath)); depsJsonPath));
EnsureToolJsonDepsFileExists(toolLockFile, depsJsonPath, toolLibrary); EnsureToolJsonDepsFileExists(toolLockFile, framework, depsJsonPath, toolLibrary);
return depsJsonPath; return depsJsonPath;
} }
private void EnsureToolJsonDepsFileExists( private void EnsureToolJsonDepsFileExists(
LockFile toolLockFile, LockFile toolLockFile,
NuGetFramework framework,
string depsPath, string depsPath,
SingleProjectInfo toolLibrary) SingleProjectInfo toolLibrary)
{ {
if (!File.Exists(depsPath)) if (!File.Exists(depsPath))
{ {
GenerateDepsJsonFile(toolLockFile, depsPath, toolLibrary); GenerateDepsJsonFile(toolLockFile, framework, depsPath, toolLibrary);
} }
} }
internal void GenerateDepsJsonFile( internal void GenerateDepsJsonFile(
LockFile toolLockFile, LockFile toolLockFile,
NuGetFramework framework,
string depsPath, string depsPath,
SingleProjectInfo toolLibrary) SingleProjectInfo toolLibrary)
{ {
@ -310,7 +324,7 @@ namespace Microsoft.DotNet.Cli.Utils
depsPath)); depsPath));
var dependencyContext = new DepsJsonBuilder() var dependencyContext = new DepsJsonBuilder()
.Build(toolLibrary, null, toolLockFile, s_toolPackageFramework, null); .Build(toolLibrary, null, toolLockFile, framework, null);
var tempDepsFile = Path.GetTempFileName(); var tempDepsFile = Path.GetTempFileName();
using (var fileStream = File.Open(tempDepsFile, FileMode.Open, FileAccess.Write)) using (var fileStream = File.Open(tempDepsFile, FileMode.Open, FileAccess.Write))

View file

@ -7,8 +7,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration
{ {
public const string AspNetToolsVersion = "1.0.0"; public const string AspNetToolsVersion = "1.0.0";
public const string AspNet110ToolsVersion = "1.1.0"; public const string AspNet110ToolsVersion = "1.1.0";
public const string AspNetLTSPackagesVersion = "1.0.2"; public const string AspNetLTSPackagesVersion = "1.0.3";
public const string EntityFrameworkLTSPackagesVersion = "1.0.2"; public const string EntityFrameworkLTSPackagesVersion = "1.0.3";
public const string TestSdkPackageVersion = "15.0.0-preview-20170106-08"; public const string TestSdkPackageVersion = "15.0.0-preview-20170106-08";
public const string XUnitPackageVersion = "2.2.0-beta5-build3474"; public const string XUnitPackageVersion = "2.2.0-beta5-build3474";
public const string XUnitRunnerPackageVersion = "2.2.0-beta5-build1225"; public const string XUnitRunnerPackageVersion = "2.2.0-beta5-build1225";

View file

@ -23,6 +23,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration
var values = line.Split(','); var values = line.Split(',');
var packageName = values[0]; var packageName = values[0];
var ltsVersion = values[1]; var ltsVersion = values[1];
var ftsVersion = values[2];
if (HasVersion(ltsVersion)) if (HasVersion(ltsVersion))
{ {
@ -38,6 +39,22 @@ namespace Microsoft.DotNet.ProjectJsonMigration
Version = ltsVersion Version = ltsVersion
}); });
} }
if(HasVersion(ftsVersion))
{
var version = HasVersion(ltsVersion) ? $"({ltsVersion},{ftsVersion})" : $"[,{ftsVersion})";
projectDependenciesPackages.Add(
new PackageDependencyInfo
{
Name = packageName,
Version = version
},
new PackageDependencyInfo
{
Name = packageName,
Version = ftsVersion
});
}
} }
} }
} }

View file

@ -71,6 +71,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration
public const string IncludesNotEquivalent = "{0}.{1} includes not equivalent."; public const string IncludesNotEquivalent = "{0}.{1} includes not equivalent.";
public const string UpdatesNotEquivalent = "{0}.{1} updates not equivalent.";
public const string ExcludesNotEquivalent = "{0}.{1} excludes not equivalent."; public const string ExcludesNotEquivalent = "{0}.{1} excludes not equivalent.";
public const string RemovesNotEquivalent = "{0}.{1} removes not equivalent."; public const string RemovesNotEquivalent = "{0}.{1} removes not equivalent.";
@ -109,6 +111,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration
public const string ItemTransformApplicatorEncompassedIncludes = "{0}: encompassed includes {1}"; public const string ItemTransformApplicatorEncompassedIncludes = "{0}: encompassed includes {1}";
public const string ItemTransformApplicatorEncompassedUpdates = "{0}: encompassed updates {1}";
public const string ItemTransformApplicatorRemovingItem = "{0}: Removing Item {{ ItemType: {1}, Condition: {2}, Include: {3}, Exclude: {4} }}"; public const string ItemTransformApplicatorRemovingItem = "{0}: Removing Item {{ ItemType: {1}, Condition: {2}, Include: {3}, Exclude: {4} }}";
public const string ItemTransformApplicatorIgnoringItem = "{0}: Ignoring Item {{ ItemType: {1}, Condition: {2}, Include: {3}, Exclude: {4} }}"; public const string ItemTransformApplicatorIgnoringItem = "{0}: Ignoring Item {{ ItemType: {1}, Condition: {2}, Include: {3}, Exclude: {4} }}";

View file

@ -14,7 +14,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration
public static IEnumerable<string> GetEncompassedIncludes(this ProjectItemElement item, public static IEnumerable<string> GetEncompassedIncludes(this ProjectItemElement item,
ProjectItemElement otherItem, TextWriter trace = null) ProjectItemElement otherItem, TextWriter trace = null)
{ {
if (otherItem.IsEquivalentToExceptIncludeAndExclude(item, trace) && if (otherItem.IsEquivalentToExceptIncludeUpdateAndExclude(item, trace) &&
new HashSet<string>(otherItem.Excludes()).IsSubsetOf(new HashSet<string>(item.Excludes()))) new HashSet<string>(otherItem.Excludes()).IsSubsetOf(new HashSet<string>(item.Excludes())))
{ {
return otherItem.IntersectIncludes(item); return otherItem.IntersectIncludes(item);
@ -23,6 +23,18 @@ namespace Microsoft.DotNet.ProjectJsonMigration
return Enumerable.Empty<string>(); return Enumerable.Empty<string>();
} }
public static IEnumerable<string> GetEncompassedUpdates(this ProjectItemElement item,
ProjectItemElement otherItem, TextWriter trace = null)
{
if (otherItem.IsEquivalentToExceptIncludeUpdateAndExclude(item, trace) &&
new HashSet<string>(otherItem.Excludes()).IsSubsetOf(new HashSet<string>(item.Excludes())))
{
return otherItem.IntersectUpdates(item);
}
return Enumerable.Empty<string>();
}
public static bool IsEquivalentTo(this ProjectItemElement item, ProjectItemElement otherItem, TextWriter trace = null) public static bool IsEquivalentTo(this ProjectItemElement item, ProjectItemElement otherItem, TextWriter trace = null)
{ {
// Different includes // Different includes
@ -32,6 +44,12 @@ namespace Microsoft.DotNet.ProjectJsonMigration
return false; return false;
} }
if (item.IntersectUpdates(otherItem).Count() != item.Updates().Count())
{
trace?.WriteLine(String.Format(LocalizableStrings.UpdatesNotEquivalent, nameof(MSBuildExtensions), nameof(IsEquivalentTo)));
return false;
}
// Different Excludes // Different Excludes
if (item.IntersectExcludes(otherItem).Count() != item.Excludes().Count()) if (item.IntersectExcludes(otherItem).Count() != item.Excludes().Count())
{ {
@ -39,10 +57,10 @@ namespace Microsoft.DotNet.ProjectJsonMigration
return false; return false;
} }
return item.IsEquivalentToExceptIncludeAndExclude(otherItem, trace); return item.IsEquivalentToExceptIncludeUpdateAndExclude(otherItem, trace);
} }
public static bool IsEquivalentToExceptIncludeAndExclude(this ProjectItemElement item, ProjectItemElement otherItem, TextWriter trace = null) public static bool IsEquivalentToExceptIncludeUpdateAndExclude(this ProjectItemElement item, ProjectItemElement otherItem, TextWriter trace = null)
{ {
// Different remove // Different remove
if (item.Remove != otherItem.Remove) if (item.Remove != otherItem.Remove)
@ -119,6 +137,12 @@ namespace Microsoft.DotNet.ProjectJsonMigration
return SplitSemicolonDelimitedValues(item.Include); return SplitSemicolonDelimitedValues(item.Include);
} }
public static IEnumerable<string> Updates(
this ProjectItemElement item)
{
return SplitSemicolonDelimitedValues(item.Update);
}
public static IEnumerable<string> Excludes( public static IEnumerable<string> Excludes(
this ProjectItemElement item) this ProjectItemElement item)
{ {
@ -141,6 +165,11 @@ namespace Microsoft.DotNet.ProjectJsonMigration
return item.Includes().Intersect(otherItem.Includes()); return item.Includes().Intersect(otherItem.Includes());
} }
public static IEnumerable<string> IntersectUpdates(this ProjectItemElement item, ProjectItemElement otherItem)
{
return item.Updates().Intersect(otherItem.Updates());
}
public static IEnumerable<string> IntersectExcludes(this ProjectItemElement item, ProjectItemElement otherItem) public static IEnumerable<string> IntersectExcludes(this ProjectItemElement item, ProjectItemElement otherItem)
{ {
return item.Excludes().Intersect(otherItem.Excludes()); return item.Excludes().Intersect(otherItem.Excludes());
@ -151,6 +180,11 @@ namespace Microsoft.DotNet.ProjectJsonMigration
item.Include = string.Join(";", item.Includes().Except(includesToRemove)); item.Include = string.Join(";", item.Includes().Except(includesToRemove));
} }
public static void RemoveUpdates(this ProjectItemElement item, IEnumerable<string> updatesToRemove)
{
item.Update = string.Join(";", item.Updates().Except(updatesToRemove));
}
public static void UnionIncludes(this ProjectItemElement item, IEnumerable<string> includesToAdd) public static void UnionIncludes(this ProjectItemElement item, IEnumerable<string> includesToAdd)
{ {
item.Include = string.Join(";", item.Includes().Union(includesToAdd)); item.Include = string.Join(";", item.Includes().Union(includesToAdd));

View file

@ -0,0 +1,54 @@
// 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.Linq;
using Newtonsoft.Json.Linq;
namespace Microsoft.DotNet.Internal.ProjectModel.Files
{
// Similar to IncludeContext, except that it replaces the include information with the exclude information and clears
// out the exclude information. This is to be used by migration to do CopyToOutput with Never set as its metadata.
internal class ExcludeContext : IncludeContext
{
public ExcludeContext(
string sourceBasePath,
string option,
JObject rawObject,
string[] defaultBuiltInInclude,
string[] defaultBuiltInExclude) : base(
sourceBasePath,
option,
rawObject,
defaultBuiltInInclude,
defaultBuiltInExclude)
{
IncludePatterns = ExcludePatterns;
ExcludePatterns = new List<string>();
IncludeFiles = ExcludeFiles;
ExcludeFiles = new List<string>();
BuiltInsInclude = BuiltInsExclude;
BuiltInsExclude = new List<string>();
if (Mappings != null)
{
var newMappings = new Dictionary<string, IncludeContext>();
foreach (var mapping in Mappings)
{
newMappings.Add(mapping.Key, new ExcludeContext(
mapping.Value.SourceBasePath,
mapping.Value.Option,
mapping.Value.RawObject,
mapping.Value.BuiltInsInclude?.ToArray(),
mapping.Value.BuiltInsExclude?.ToArray()));
}
Mappings = newMappings;
}
}
}
}

View file

@ -39,6 +39,7 @@ namespace Microsoft.DotNet.Internal.ProjectModel.Files
CustomRemovePatterns = new List<string>(); CustomRemovePatterns = new List<string>();
SourceBasePath = sourceBasePath; SourceBasePath = sourceBasePath;
Option = option; Option = option;
RawObject = rawObject;
var token = rawObject.Value<JToken>(option); var token = rawObject.Value<JToken>(option);
if (token == null) if (token == null)
@ -117,19 +118,21 @@ namespace Microsoft.DotNet.Internal.ProjectModel.Files
public List<string> CustomRemovePatterns { get; } public List<string> CustomRemovePatterns { get; }
public List<string> IncludePatterns { get; } public List<string> IncludePatterns { get; protected set; }
public List<string> ExcludePatterns { get; } public List<string> ExcludePatterns { get; protected set; }
public List<string> IncludeFiles { get; } public List<string> IncludeFiles { get; protected set; }
public List<string> ExcludeFiles { get; } public List<string> ExcludeFiles { get; protected set; }
public List<string> BuiltInsInclude { get; } public List<string> BuiltInsInclude { get; protected set; }
public List<string> BuiltInsExclude { get; } public List<string> BuiltInsExclude { get; protected set; }
public IDictionary<string, IncludeContext> Mappings { get; } public IDictionary<string, IncludeContext> Mappings { get; protected set; }
public JObject RawObject { get; }
public override bool Equals(object obj) public override bool Equals(object obj)
{ {

View file

@ -0,0 +1,17 @@
// 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.
namespace Microsoft.DotNet.ProjectJsonMigration.Rules
{
internal class ItemsIncludedInTheWebSDK
{
public static bool HasContent(string content)
{
return content.Equals("wwwroot") ||
content.Contains("web.config") ||
content.Equals("**/*.cshtml") ||
content.Equals(@"**\*.cshtml") ||
content.Contains(".json");
}
}
}

View file

@ -147,11 +147,18 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
new RemoveContextTransform("EmbeddedResource", condition: ic => ic != null); new RemoveContextTransform("EmbeddedResource", condition: ic => ic != null);
private IncludeContextTransform CopyToOutputFilesTransform => private IncludeContextTransform CopyToOutputFilesTransform =>
new IncludeContextTransform("Content", transformMappings: true) new UpdateContextTransform("None", transformMappings: true)
.WithMetadata("CopyToOutputDirectory", "PreserveNewest"); .WithMetadata("CopyToOutputDirectory", "PreserveNewest");
private IncludeContextTransform DoNotCopyToOutputFilesTransform =>
new UpdateContextTransform("None", transformMappings: true)
.WithMetadata("CopyToOutputDirectory", "Never");
private IncludeContextTransform CopyToOutputFilesTransformForWeb => private IncludeContextTransform CopyToOutputFilesTransformForWeb =>
new UpdateContextTransform("Content", transformMappings: true) new UpdateContextTransform(
"None",
transformMappings: true,
excludePatternsRule: pattern => ItemsIncludedInTheWebSDK.HasContent(pattern))
.WithMetadata("CopyToOutputDirectory", "PreserveNewest"); .WithMetadata("CopyToOutputDirectory", "PreserveNewest");
private AddPropertyTransform<Project> GenerateRuntimeConfigurationFilesTransform => private AddPropertyTransform<Project> GenerateRuntimeConfigurationFilesTransform =>
@ -194,6 +201,12 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
return copyToOutputFilesTransform.Transform(GetCopyToOutputIncludeContext(compilerOptions, projectDirectory)); return copyToOutputFilesTransform.Transform(GetCopyToOutputIncludeContext(compilerOptions, projectDirectory));
}; };
private Func<CommonCompilerOptions, string, ProjectType, IEnumerable<ProjectItemElement>> DoNotCopyToOutputFilesTransformExecute =>
(compilerOptions, projectDirectory, projectType) =>
{
return DoNotCopyToOutputFilesTransform.Transform(GetDoNotCopyToOutputIncludeContext(compilerOptions, projectDirectory));
};
private readonly string[] DefaultEmptyExcludeOption = new string[0]; private readonly string[] DefaultEmptyExcludeOption = new string[0];
private readonly ProjectPropertyGroupElement _configurationPropertyGroup; private readonly ProjectPropertyGroupElement _configurationPropertyGroup;
@ -265,7 +278,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
{ {
CompileFilesTransformExecute, CompileFilesTransformExecute,
EmbedFilesTransformExecute, EmbedFilesTransformExecute,
CopyToOutputFilesTransformExecute CopyToOutputFilesTransformExecute,
DoNotCopyToOutputFilesTransformExecute
}; };
} }
@ -528,6 +542,28 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
null); null);
} }
private IncludeContext GetDoNotCopyToOutputIncludeContext(CommonCompilerOptions compilerOptions, string projectDirectory)
{
// Defaults from src/Microsoft.DotNet.ProjectModel/ProjectReader.cs #608
var copyToOutputIncludeContext = compilerOptions.CopyToOutputInclude ??
new IncludeContext(
projectDirectory,
"copyToOutput",
new JObject(),
null,
null);
var doNotCopyToOutputIncludeContext =
new ExcludeContext(
copyToOutputIncludeContext.SourceBasePath,
copyToOutputIncludeContext.Option,
copyToOutputIncludeContext.RawObject,
copyToOutputIncludeContext.BuiltInsInclude?.ToArray(),
copyToOutputIncludeContext.BuiltInsExclude?.ToArray());
return doNotCopyToOutputIncludeContext;
}
private string FormatLanguageVersion(string langVersion) private string FormatLanguageVersion(string langVersion)
{ {
if (langVersion.StartsWith("csharp", StringComparison.OrdinalIgnoreCase)) if (langVersion.StartsWith("csharp", StringComparison.OrdinalIgnoreCase))

View file

@ -57,10 +57,17 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
packOptions => !string.IsNullOrEmpty(packOptions.RepositoryUrl)); packOptions => !string.IsNullOrEmpty(packOptions.RepositoryUrl));
private IncludeContextTransform PackFilesTransform => private IncludeContextTransform PackFilesTransform =>
new IncludeContextTransform("Content", transformMappings: true) new UpdateContextTransform("None", transformMappings: true)
.WithMetadata("Pack", "true") .WithMetadata("Pack", "true")
.WithMappingsToTransform(_mappingsToTransfrom); .WithMappingsToTransform(_mappingsToTransfrom);
private IncludeContextTransform DoNotPackFilesTransform =>
new UpdateContextTransform(
"None",
transformMappings: true,
excludePatternsRule: pattern => ProjectFilesCollection.DefaultBuiltInExcludePatterns.Contains(pattern))
.WithMetadata("Pack", "false");
private Func<AddItemTransform<IncludeContext>, string, AddItemTransform<IncludeContext>> _mappingsToTransfrom => private Func<AddItemTransform<IncludeContext>, string, AddItemTransform<IncludeContext>> _mappingsToTransfrom =>
(addItemTransform, targetPath) => (addItemTransform, targetPath) =>
{ {
@ -115,7 +122,28 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
private void TransformPackFiles(PackOptions packOptions, ProjectItemGroupElement itemGroup) private void TransformPackFiles(PackOptions packOptions, ProjectItemGroupElement itemGroup)
{ {
var transformResult = PackFilesTransform.Transform(packOptions.PackInclude); ExecuteTransformation(PackFilesTransform, packOptions.PackInclude, itemGroup);
if (packOptions.PackInclude != null)
{
ExecuteTransformation(
DoNotPackFilesTransform,
new ExcludeContext(
packOptions.PackInclude.SourceBasePath,
packOptions.PackInclude.Option,
packOptions.PackInclude.RawObject,
packOptions.PackInclude.BuiltInsInclude?.ToArray(),
packOptions.PackInclude.BuiltInsExclude?.ToArray()),
itemGroup);
}
}
private void ExecuteTransformation(
IncludeContextTransform transform,
IncludeContext includeContext,
ProjectItemGroupElement itemGroup)
{
var transformResult = transform.Transform(includeContext);
if (transformResult != null && transformResult.Any()) if (transformResult != null && transformResult.Any())
{ {

View file

@ -1,7 +1,10 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved. // 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. // Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Collections.Generic;
using System.Linq; using System.Linq;
using Microsoft.Build.Construction;
using Microsoft.DotNet.Internal.ProjectModel.Files;
using Microsoft.DotNet.ProjectJsonMigration.Transforms; using Microsoft.DotNet.ProjectJsonMigration.Transforms;
namespace Microsoft.DotNet.ProjectJsonMigration.Rules namespace Microsoft.DotNet.ProjectJsonMigration.Rules
@ -28,7 +31,31 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
CopyToPublishDirectoryTransformForWeb : CopyToPublishDirectoryTransformForWeb :
CopyToPublishDirectoryTransform; CopyToPublishDirectoryTransform;
var transformResult = copyToPublishDirectoryTransform.Transform(projectContext.ProjectFile.PublishOptions); ExecuteTransformation(
copyToPublishDirectoryTransform,
projectContext.ProjectFile.PublishOptions,
migrationRuleInputs);
if (projectContext.ProjectFile.PublishOptions != null)
{
ExecuteTransformation(
DoNotCopyToPublishDirectoryTransform,
new ExcludeContext(
projectContext.ProjectFile.PublishOptions.SourceBasePath,
projectContext.ProjectFile.PublishOptions.Option,
projectContext.ProjectFile.PublishOptions.RawObject,
projectContext.ProjectFile.PublishOptions.BuiltInsInclude?.ToArray(),
projectContext.ProjectFile.PublishOptions.BuiltInsExclude?.ToArray()),
migrationRuleInputs);
}
}
private void ExecuteTransformation(
IncludeContextTransform transform,
IncludeContext includeContext,
MigrationRuleInputs migrationRuleInputs)
{
var transformResult = transform.Transform(includeContext);
if (transformResult != null && transformResult.Any()) if (transformResult != null && transformResult.Any())
{ {
@ -41,11 +68,18 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
} }
private IncludeContextTransform CopyToPublishDirectoryTransform => private IncludeContextTransform CopyToPublishDirectoryTransform =>
new IncludeContextTransform("Content", transformMappings: true) new UpdateContextTransform("None", transformMappings: true)
.WithMetadata("CopyToPublishDirectory", "PreserveNewest"); .WithMetadata("CopyToPublishDirectory", "PreserveNewest");
private IncludeContextTransform DoNotCopyToPublishDirectoryTransform =>
new UpdateContextTransform("None", transformMappings: true)
.WithMetadata("CopyToPublishDirectory", "Never");
private IncludeContextTransform CopyToPublishDirectoryTransformForWeb => private IncludeContextTransform CopyToPublishDirectoryTransformForWeb =>
new UpdateContextTransform("Content", transformMappings: true) new UpdateContextTransform(
"None",
transformMappings: true,
excludePatternsRule: pattern => ItemsIncludedInTheWebSDK.HasContent(pattern))
.WithMetadata("CopyToPublishDirectory", "PreserveNewest"); .WithMetadata("CopyToPublishDirectory", "PreserveNewest");
} }
} }

View file

@ -50,15 +50,6 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
propertyGroup, propertyGroup,
mergeExisting: true); mergeExisting: true);
} }
_transformApplicator.Execute(
RuntimeIdentifiersTransform.Transform(migrationRuleInputs.ProjectContexts),
propertyGroup,
mergeExisting: true);
_transformApplicator.Execute(
RuntimeIdentifierTransform.Transform(migrationRuleInputs.ProjectContexts),
propertyGroup,
mergeExisting: true);
} }
private void CleanExistingProperties(ProjectRootElement csproj) private void CleanExistingProperties(ProjectRootElement csproj)
@ -127,36 +118,5 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
"TargetFramework", "TargetFramework",
framework => framework.GetShortFolderName(), framework => framework.GetShortFolderName(),
framework => true); framework => true);
private AddPropertyTransform<IEnumerable<ProjectContext>> RuntimeIdentifiersTransform =>
new AddPropertyTransform<IEnumerable<ProjectContext>>(
"RuntimeIdentifiers",
projectContexts => RuntimeIdentifiers,
projectContexts => !projectContexts.HasRuntimes() &&
!projectContexts.HasLibraryOutput() &&
projectContexts.HasBothCoreAndFullFrameworkTFMs());
private AddPropertyTransform<IEnumerable<ProjectContext>> RuntimeIdentifierTransform =>
new AddPropertyTransform<IEnumerable<ProjectContext>>(
"RuntimeIdentifier",
projectContexts => "win7-x86",
projectContexts => !projectContexts.HasRuntimes() &&
!projectContexts.HasLibraryOutput() &&
projectContexts.HasFullFrameworkTFM())
.WithMSBuildCondition(projectContexts =>
{
string msBuildCondition = null;
if (projectContexts.HasBothCoreAndFullFrameworkTFMs())
{
msBuildCondition = string.Join(
" OR ",
projectContexts.Where(p => p.IsFullFramework()).Select(
p => $"'$(TargetFramework)' == '{p.TargetFramework.GetShortFolderName()}'"));
msBuildCondition = $" {msBuildCondition} ";
}
return msBuildCondition;
});
} }
} }

View file

@ -188,6 +188,30 @@ namespace Microsoft.DotNet.ProjectJsonMigration
Version = ConstantPackageVersions.AspNetToolsVersion Version = ConstantPackageVersions.AspNetToolsVersion
} }
}, },
{
new PackageDependencyInfo
{
Name = "Microsoft.VisualStudio.Web.BrowserLink.Loader",
Version = "[14.1.0-*,)"
},
new PackageDependencyInfo
{
Name = "Microsoft.VisualStudio.Web.BrowserLink",
Version = "1.1.0"
}
},
{
new PackageDependencyInfo
{
Name = "Microsoft.VisualStudio.Web.BrowserLink.Loader",
Version = "[14.0.0-*,14.1.0)"
},
new PackageDependencyInfo
{
Name = "Microsoft.VisualStudio.Web.BrowserLink",
Version = "1.0.1"
}
},
{ {
new PackageDependencyInfo new PackageDependencyInfo
{ {

View file

@ -19,12 +19,18 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
{ {
if (typeof(T) != typeof(ProjectItemElement)) if (typeof(T) != typeof(ProjectItemElement))
{ {
throw new ArgumentException(String.Format(LocalizableStrings.ExpectedElementToBeOfTypeNotTypeError, nameof(ProjectItemElement), typeof(T))); throw new ArgumentException(String.Format(
LocalizableStrings.ExpectedElementToBeOfTypeNotTypeError,
nameof(ProjectItemElement),
typeof(T)));
} }
if (typeof(U) != typeof(ProjectItemGroupElement)) if (typeof(U) != typeof(ProjectItemGroupElement))
{ {
throw new ArgumentException(String.Format(LocalizableStrings.ExpectedElementToBeOfTypeNotTypeError, nameof(ProjectItemGroupElement), typeof(U))); throw new ArgumentException(String.Format(
LocalizableStrings.ExpectedElementToBeOfTypeNotTypeError,
nameof(ProjectItemGroupElement),
typeof(U)));
} }
if (element == null) if (element == null)
@ -40,8 +46,18 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
var item = element as ProjectItemElement; var item = element as ProjectItemElement;
var destinationItemGroup = destinationElement as ProjectItemGroupElement; var destinationItemGroup = destinationElement as ProjectItemGroupElement;
MigrationTrace.Instance.WriteLine(String.Format(LocalizableStrings.ItemTransformApplicatorHeader, nameof(ItemTransformApplicator), item.ItemType, item.Condition, item.Include, item.Exclude, item.Update)); MigrationTrace.Instance.WriteLine(String.Format(
MigrationTrace.Instance.WriteLine(String.Format(LocalizableStrings.ItemTransformApplicatorItemGroup, nameof(ItemTransformApplicator), destinationItemGroup.Condition)); LocalizableStrings.ItemTransformApplicatorHeader,
nameof(ItemTransformApplicator),
item.ItemType,
item.Condition,
item.Include,
item.Exclude,
item.Update));
MigrationTrace.Instance.WriteLine(String.Format(
LocalizableStrings.ItemTransformApplicatorItemGroup,
nameof(ItemTransformApplicator),
destinationItemGroup.Condition));
if (mergeExisting) if (mergeExisting)
{ {
@ -49,7 +65,9 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
item = MergeWithExistingItemsWithSameCondition(item, destinationItemGroup); item = MergeWithExistingItemsWithSameCondition(item, destinationItemGroup);
if (item == null) if (item == null)
{ {
MigrationTrace.Instance.WriteLine(String.Format(LocalizableStrings.ItemTransformAppliatorItemCompletelyMerged, nameof(ItemTransformApplicator))); MigrationTrace.Instance.WriteLine(String.Format(
LocalizableStrings.ItemTransformAppliatorItemCompletelyMerged,
nameof(ItemTransformApplicator)));
return; return;
} }
@ -57,14 +75,18 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
item = MergeWithExistingItemsWithNoCondition(item, destinationItemGroup); item = MergeWithExistingItemsWithNoCondition(item, destinationItemGroup);
if (item == null) if (item == null)
{ {
MigrationTrace.Instance.WriteLine(String.Format(LocalizableStrings.ItemTransformAppliatorItemCompletelyMerged, nameof(ItemTransformApplicator))); MigrationTrace.Instance.WriteLine(String.Format(
LocalizableStrings.ItemTransformAppliatorItemCompletelyMerged,
nameof(ItemTransformApplicator)));
return; return;
} }
item = MergeWithExistingItemsWithACondition(item, destinationItemGroup); item = MergeWithExistingItemsWithACondition(item, destinationItemGroup);
if (item == null) if (item == null)
{ {
MigrationTrace.Instance.WriteLine(String.Format(LocalizableStrings.ItemTransformAppliatorItemCompletelyMerged, nameof(ItemTransformApplicator))); MigrationTrace.Instance.WriteLine(String.Format(
LocalizableStrings.ItemTransformAppliatorItemCompletelyMerged,
nameof(ItemTransformApplicator)));
return; return;
} }
} }
@ -88,13 +110,22 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
var outputItem = itemGroup.ContainingProject.CreateItemElement("___TEMP___"); var outputItem = itemGroup.ContainingProject.CreateItemElement("___TEMP___");
outputItem.CopyFrom(item); outputItem.CopyFrom(item);
MigrationTrace.Instance.WriteLine(String.Format(LocalizableStrings.ItemTransformApplicatorAddItemHeader, nameof(ItemTransformApplicator), outputItem.ItemType, outputItem.Condition, outputItem.Include, outputItem.Exclude, outputItem.Update)); MigrationTrace.Instance.WriteLine(String.Format(
LocalizableStrings.ItemTransformApplicatorAddItemHeader,
nameof(ItemTransformApplicator),
outputItem.ItemType,
outputItem.Condition,
outputItem.Include,
outputItem.Exclude,
outputItem.Update));
itemGroup.AppendChild(outputItem); itemGroup.AppendChild(outputItem);
outputItem.AddMetadata(item.Metadata, MigrationTrace.Instance); outputItem.AddMetadata(item.Metadata, MigrationTrace.Instance);
} }
private ProjectItemElement MergeWithExistingItemsWithACondition(ProjectItemElement item, ProjectItemGroupElement destinationItemGroup) private ProjectItemElement MergeWithExistingItemsWithACondition(
ProjectItemElement item,
ProjectItemGroupElement destinationItemGroup)
{ {
// This logic only applies to conditionless items // This logic only applies to conditionless items
if (item.ConditionChain().Any() || destinationItemGroup.ConditionChain().Any()) if (item.ConditionChain().Any() || destinationItemGroup.ConditionChain().Any())
@ -105,24 +136,55 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
var existingItemsWithACondition = var existingItemsWithACondition =
FindExistingItemsWithACondition(item, destinationItemGroup.ContainingProject, destinationItemGroup); FindExistingItemsWithACondition(item, destinationItemGroup.ContainingProject, destinationItemGroup);
MigrationTrace.Instance.WriteLine(String.Format(LocalizableStrings.ItemTransformApplicatorMergingItemWithExistingItems, nameof(ItemTransformApplicator), existingItemsWithACondition.Count())); MigrationTrace.Instance.WriteLine(String.Format(
LocalizableStrings.ItemTransformApplicatorMergingItemWithExistingItems,
nameof(ItemTransformApplicator),
existingItemsWithACondition.Count()));
foreach (var existingItem in existingItemsWithACondition) foreach (var existingItem in existingItemsWithACondition)
{
if (!string.IsNullOrEmpty(item.Include))
{
MergeOnIncludesWithExistingItemsWithACondition(item, existingItem, destinationItemGroup);
}
if (!string.IsNullOrEmpty(item.Update))
{
MergeOnUpdatesWithExistingItemsWithACondition(item, existingItem, destinationItemGroup);
}
}
return item;
}
private void MergeOnIncludesWithExistingItemsWithACondition(
ProjectItemElement item,
ProjectItemElement existingItem,
ProjectItemGroupElement destinationItemGroup)
{ {
// If this item is encompassing items in a condition, remove the encompassed includes from the existing item // If this item is encompassing items in a condition, remove the encompassed includes from the existing item
var encompassedIncludes = item.GetEncompassedIncludes(existingItem, MigrationTrace.Instance); var encompassedIncludes = item.GetEncompassedIncludes(existingItem, MigrationTrace.Instance);
if (encompassedIncludes.Any()) if (encompassedIncludes.Any())
{ {
MigrationTrace.Instance.WriteLine(String.Format(LocalizableStrings.ItemTransformApplicatorEncompassedIncludes, nameof(ItemTransformApplicator), string.Join(", ", encompassedIncludes))); MigrationTrace.Instance.WriteLine(String.Format(
LocalizableStrings.ItemTransformApplicatorEncompassedIncludes,
nameof(ItemTransformApplicator),
string.Join(", ", encompassedIncludes)));
existingItem.RemoveIncludes(encompassedIncludes); existingItem.RemoveIncludes(encompassedIncludes);
} }
// continue if the existing item is now empty // continue if the existing item is now empty
if (!existingItem.Includes().Any()) if (!existingItem.Includes().Any())
{ {
MigrationTrace.Instance.WriteLine(String.Format(LocalizableStrings.ItemTransformApplicatorRemovingItem, nameof(ItemTransformApplicator), existingItem.ItemType, existingItem.Condition, existingItem.Include, existingItem.Exclude)); MigrationTrace.Instance.WriteLine(String.Format(
LocalizableStrings.ItemTransformApplicatorRemovingItem,
nameof(ItemTransformApplicator),
existingItem.ItemType,
existingItem.Condition,
existingItem.Include,
existingItem.Exclude));
existingItem.Parent.RemoveChild(existingItem); existingItem.Parent.RemoveChild(existingItem);
continue; return;
} }
// If we haven't continued, the existing item may have includes // If we haven't continued, the existing item may have includes
@ -158,10 +220,72 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
} }
} }
return item; private void MergeOnUpdatesWithExistingItemsWithACondition(
ProjectItemElement item,
ProjectItemElement existingItem,
ProjectItemGroupElement destinationItemGroup)
{
// If this item is encompassing items in a condition, remove the encompassed updates from the existing item
var encompassedUpdates = item.GetEncompassedUpdates(existingItem, MigrationTrace.Instance);
if (encompassedUpdates.Any())
{
MigrationTrace.Instance.WriteLine(String.Format(
LocalizableStrings.ItemTransformApplicatorEncompassedUpdates,
nameof(ItemTransformApplicator),
string.Join(", ", encompassedUpdates)));
existingItem.RemoveUpdates(encompassedUpdates);
} }
private ProjectItemElement MergeWithExistingItemsWithNoCondition(ProjectItemElement item, ProjectItemGroupElement destinationItemGroup) // continue if the existing item is now empty
if (!existingItem.Updates().Any())
{
MigrationTrace.Instance.WriteLine(String.Format(
LocalizableStrings.ItemTransformApplicatorRemovingItem,
nameof(ItemTransformApplicator),
existingItem.ItemType,
existingItem.Condition,
existingItem.Update,
existingItem.Exclude));
existingItem.Parent.RemoveChild(existingItem);
return;
}
// If we haven't continued, the existing item may have updates
// that need to be removed before being redefined, to avoid duplicate updates
// Create or merge with existing remove
var remainingIntersectedUpdates = existingItem.IntersectUpdates(item);
if (remainingIntersectedUpdates.Any())
{
var existingRemoveItem = destinationItemGroup.Items
.Where(i =>
string.IsNullOrEmpty(i.Update)
&& string.IsNullOrEmpty(i.Exclude)
&& !string.IsNullOrEmpty(i.Remove))
.FirstOrDefault();
if (existingRemoveItem != null)
{
var removes = new HashSet<string>(existingRemoveItem.Remove.Split(';'));
foreach (var update in remainingIntersectedUpdates)
{
removes.Add(update);
}
existingRemoveItem.Remove = string.Join(";", removes);
}
else
{
var clearPreviousItem = _projectElementGenerator.CreateItemElement(item.ItemType);
clearPreviousItem.Remove = string.Join(";", remainingIntersectedUpdates);
AddItemToItemGroup(clearPreviousItem, existingItem.Parent as ProjectItemGroupElement);
}
}
}
private ProjectItemElement MergeWithExistingItemsWithNoCondition(
ProjectItemElement item,
ProjectItemGroupElement destinationItemGroup)
{ {
// This logic only applies to items being placed into a condition // This logic only applies to items being placed into a condition
if (!item.ConditionChain().Any() && !destinationItemGroup.ConditionChain().Any()) if (!item.ConditionChain().Any() && !destinationItemGroup.ConditionChain().Any())
@ -172,8 +296,13 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
var existingItemsWithNoCondition = var existingItemsWithNoCondition =
FindExistingItemsWithNoCondition(item, destinationItemGroup.ContainingProject, destinationItemGroup); FindExistingItemsWithNoCondition(item, destinationItemGroup.ContainingProject, destinationItemGroup);
MigrationTrace.Instance.WriteLine(String.Format(LocalizableStrings.ItemTransformApplicatorMergingItemWithExistingItems, nameof(ItemTransformApplicator), existingItemsWithNoCondition.Count())); MigrationTrace.Instance.WriteLine(String.Format(
LocalizableStrings.ItemTransformApplicatorMergingItemWithExistingItems,
nameof(ItemTransformApplicator),
existingItemsWithNoCondition.Count()));
if (!string.IsNullOrEmpty(item.Include))
{
// Handle the item being placed inside of a condition, when it is overlapping with a conditionless item // Handle the item being placed inside of a condition, when it is overlapping with a conditionless item
// If it is not definining new metadata or excludes, the conditioned item can be merged with the // If it is not definining new metadata or excludes, the conditioned item can be merged with the
// conditionless item // conditionless item
@ -182,15 +311,55 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
var encompassedIncludes = existingItem.GetEncompassedIncludes(item, MigrationTrace.Instance); var encompassedIncludes = existingItem.GetEncompassedIncludes(item, MigrationTrace.Instance);
if (encompassedIncludes.Any()) if (encompassedIncludes.Any())
{ {
MigrationTrace.Instance.WriteLine(String.Format(LocalizableStrings.ItemTransformApplicatorEncompassedIncludes, nameof(ItemTransformApplicator), string.Join(", ", encompassedIncludes))); MigrationTrace.Instance.WriteLine(String.Format(
LocalizableStrings.ItemTransformApplicatorEncompassedIncludes,
nameof(ItemTransformApplicator),
string.Join(", ", encompassedIncludes)));
item.RemoveIncludes(encompassedIncludes); item.RemoveIncludes(encompassedIncludes);
if (!item.Includes().Any()) if (!item.Includes().Any())
{ {
MigrationTrace.Instance.WriteLine(String.Format(LocalizableStrings.ItemTransformApplicatorIgnoringItem, nameof(ItemTransformApplicator), existingItem.ItemType, existingItem.Condition, existingItem.Include, existingItem.Exclude)); MigrationTrace.Instance.WriteLine(String.Format(
LocalizableStrings.ItemTransformApplicatorIgnoringItem,
nameof(ItemTransformApplicator),
existingItem.ItemType,
existingItem.Condition,
existingItem.Include,
existingItem.Exclude));
return null; return null;
} }
} }
} }
}
if (!string.IsNullOrEmpty(item.Update))
{
// Handle the item being placed inside of a condition, when it is overlapping with a conditionless item
// If it is not definining new metadata or excludes, the conditioned item can be merged with the
// conditionless item
foreach (var existingItem in existingItemsWithNoCondition)
{
var encompassedUpdates = existingItem.GetEncompassedUpdates(item, MigrationTrace.Instance);
if (encompassedUpdates.Any())
{
MigrationTrace.Instance.WriteLine(String.Format(
LocalizableStrings.ItemTransformApplicatorEncompassedUpdates,
nameof(ItemTransformApplicator),
string.Join(", ", encompassedUpdates)));
item.RemoveUpdates(encompassedUpdates);
if (!item.Updates().Any())
{
MigrationTrace.Instance.WriteLine(String.Format(
LocalizableStrings.ItemTransformApplicatorIgnoringItem,
nameof(ItemTransformApplicator),
existingItem.ItemType,
existingItem.Condition,
existingItem.Update,
existingItem.Exclude));
return null;
}
}
}
}
// If we haven't returned, and there are existing items with a separate condition, we need to // If we haven't returned, and there are existing items with a separate condition, we need to
// overwrite with those items inside the destinationItemGroup by using a Remove // overwrite with those items inside the destinationItemGroup by using a Remove
@ -200,18 +369,20 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
var existingRemoveItem = destinationItemGroup.Items var existingRemoveItem = destinationItemGroup.Items
.Where(i => .Where(i =>
string.IsNullOrEmpty(i.Include) string.IsNullOrEmpty(i.Include)
&& string.IsNullOrEmpty(i.Update)
&& string.IsNullOrEmpty(i.Exclude) && string.IsNullOrEmpty(i.Exclude)
&& !string.IsNullOrEmpty(i.Remove)) && !string.IsNullOrEmpty(i.Remove))
.FirstOrDefault(); .FirstOrDefault();
var itemsToRemove = string.IsNullOrEmpty(item.Include) ? item.Update : item.Include;
if (existingRemoveItem != null) if (existingRemoveItem != null)
{ {
existingRemoveItem.Remove += ";" + item.Include; existingRemoveItem.Remove += ";" + itemsToRemove;
} }
else else
{ {
var clearPreviousItem = _projectElementGenerator.CreateItemElement(item.ItemType); var clearPreviousItem = _projectElementGenerator.CreateItemElement(item.ItemType);
clearPreviousItem.Remove = item.Include; clearPreviousItem.Remove = itemsToRemove;
AddItemToItemGroup(clearPreviousItem, destinationItemGroup); AddItemToItemGroup(clearPreviousItem, destinationItemGroup);
} }
@ -220,12 +391,19 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
return item; return item;
} }
private ProjectItemElement MergeWithExistingItemsWithSameCondition(ProjectItemElement item, ProjectItemGroupElement destinationItemGroup) private ProjectItemElement MergeWithExistingItemsWithSameCondition(
ProjectItemElement item,
ProjectItemGroupElement destinationItemGroup)
{ {
var existingItemsWithSameCondition = var existingItemsWithSameCondition = FindExistingItemsWithSameCondition(
FindExistingItemsWithSameCondition(item, destinationItemGroup.ContainingProject, destinationItemGroup); item,
destinationItemGroup.ContainingProject,
destinationItemGroup);
MigrationTrace.Instance.WriteLine(String.Format(LocalizableStrings.ItemTransformApplicatorMergingItemWithExistingItemsSameChain, nameof(TransformApplicator), existingItemsWithSameCondition.Count())); MigrationTrace.Instance.WriteLine(String.Format(
LocalizableStrings.ItemTransformApplicatorMergingItemWithExistingItemsSameChain,
nameof(TransformApplicator),
existingItemsWithSameCondition.Count()));
foreach (var existingItem in existingItemsWithSameCondition) foreach (var existingItem in existingItemsWithSameCondition)
{ {
@ -238,7 +416,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
existingItem.Parent.RemoveChild(existingItem); existingItem.Parent.RemoveChild(existingItem);
} }
MigrationTrace.Instance.WriteLine(String.Format(LocalizableStrings.ItemTransformApplicatorAddingMergedItem, MigrationTrace.Instance.WriteLine(String.Format(
LocalizableStrings.ItemTransformApplicatorAddingMergedItem,
nameof(TransformApplicator), nameof(TransformApplicator),
mergeResult.MergedItem.ItemType, mergeResult.MergedItem.ItemType,
mergeResult.MergedItem.Condition, mergeResult.MergedItem.Condition,
@ -250,6 +429,21 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
return item; return item;
} }
private MergeResult MergeItems(ProjectItemElement item, ProjectItemElement existingItem)
{
if (!string.IsNullOrEmpty(item.Include))
{
return MergeItemsOnIncludes(item, existingItem);
}
if (!string.IsNullOrEmpty(item.Update))
{
return MergeItemsOnUpdates(item, existingItem);
}
throw new InvalidOperationException(LocalizableStrings.CannotMergeItemsWithoutCommonIncludeError);
}
/// <summary> /// <summary>
/// Merges two items on their common sets of includes. /// Merges two items on their common sets of includes.
/// The output is 3 items, the 2 input items and the merged items. If the common /// The output is 3 items, the 2 input items and the merged items. If the common
@ -262,18 +456,13 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
/// ///
/// This function will mutate the Include property of the 2 input items, removing the common subset. /// This function will mutate the Include property of the 2 input items, removing the common subset.
/// </summary> /// </summary>
private MergeResult MergeItems(ProjectItemElement item, ProjectItemElement existingItem) private MergeResult MergeItemsOnIncludes(ProjectItemElement item, ProjectItemElement existingItem)
{ {
if (!string.Equals(item.ItemType, existingItem.ItemType, StringComparison.Ordinal)) if (!string.Equals(item.ItemType, existingItem.ItemType, StringComparison.Ordinal))
{ {
throw new InvalidOperationException(LocalizableStrings.CannotMergeItemsOfDifferentTypesError); throw new InvalidOperationException(LocalizableStrings.CannotMergeItemsOfDifferentTypesError);
} }
if (!item.IntersectIncludes(existingItem).Any())
{
throw new InvalidOperationException(LocalizableStrings.CannotMergeItemsWithoutCommonIncludeError);
}
var commonIncludes = item.IntersectIncludes(existingItem).ToList(); var commonIncludes = item.IntersectIncludes(existingItem).ToList();
var mergedItem = _projectElementGenerator.AddItem(item.ItemType, string.Join(";", commonIncludes)); var mergedItem = _projectElementGenerator.AddItem(item.ItemType, string.Join(";", commonIncludes));
@ -295,11 +484,41 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
return mergeResult; return mergeResult;
} }
private MergeResult MergeItemsOnUpdates(ProjectItemElement item, ProjectItemElement existingItem)
{
if (!string.Equals(item.ItemType, existingItem.ItemType, StringComparison.Ordinal))
{
throw new InvalidOperationException(LocalizableStrings.CannotMergeItemsOfDifferentTypesError);
}
var commonUpdates = item.IntersectUpdates(existingItem).ToList();
var mergedItem = _projectElementGenerator.AddItem(item.ItemType, "placeholder");
mergedItem.Include = string.Empty;
mergedItem.Update = string.Join(";", commonUpdates);
mergedItem.UnionExcludes(existingItem.Excludes());
mergedItem.UnionExcludes(item.Excludes());
mergedItem.AddMetadata(MergeMetadata(existingItem.Metadata, item.Metadata), MigrationTrace.Instance);
item.RemoveUpdates(commonUpdates);
existingItem.RemoveUpdates(commonUpdates);
var mergeResult = new MergeResult
{
InputItem = string.IsNullOrEmpty(item.Update) ? null : item,
ExistingItem = string.IsNullOrEmpty(existingItem.Update) ? null : existingItem,
MergedItem = mergedItem
};
return mergeResult;
}
private ICollection<ProjectMetadataElement> MergeMetadata( private ICollection<ProjectMetadataElement> MergeMetadata(
ICollection<ProjectMetadataElement> existingMetadataElements, ICollection<ProjectMetadataElement> existingMetadataElements,
ICollection<ProjectMetadataElement> newMetadataElements) ICollection<ProjectMetadataElement> newMetadataElements)
{ {
var mergedMetadata = new List<ProjectMetadataElement>(existingMetadataElements); var mergedMetadata = new List<ProjectMetadataElement>(existingMetadataElements.Select(m => (ProjectMetadataElement) m.Clone()));
foreach (var newMetadata in newMetadataElements) foreach (var newMetadata in newMetadataElements)
{ {
@ -307,11 +526,11 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
m.Name.Equals(newMetadata.Name, StringComparison.OrdinalIgnoreCase)); m.Name.Equals(newMetadata.Name, StringComparison.OrdinalIgnoreCase));
if (existingMetadata == null) if (existingMetadata == null)
{ {
mergedMetadata.Add(newMetadata); mergedMetadata.Add((ProjectMetadataElement) newMetadata.Clone());
} }
else else
{ {
MergeMetadata(existingMetadata, newMetadata); MergeMetadata(existingMetadata, (ProjectMetadataElement) newMetadata.Clone());
} }
} }
@ -321,10 +540,28 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
public void MergeMetadata(ProjectMetadataElement existingMetadata, ProjectMetadataElement newMetadata) public void MergeMetadata(ProjectMetadataElement existingMetadata, ProjectMetadataElement newMetadata)
{ {
if (existingMetadata.Value != newMetadata.Value) if (existingMetadata.Value != newMetadata.Value)
{
if (existingMetadata.Name == "CopyToOutputDirectory" ||
existingMetadata.Name == "CopyToPublishDirectory")
{
existingMetadata.Value =
existingMetadata.Value == "Never" || newMetadata.Value == "Never" ?
"Never" :
"PreserveNewest";
}
else if (existingMetadata.Name == "Pack")
{
existingMetadata.Value =
existingMetadata.Value == "false" || newMetadata.Value == "false" ?
"false" :
"true";
}
else
{ {
existingMetadata.Value = string.Join(";", new [] { existingMetadata.Value, newMetadata.Value }); existingMetadata.Value = string.Join(";", new [] { existingMetadata.Value, newMetadata.Value });
} }
} }
}
private IEnumerable<ProjectItemElement> FindExistingItemsWithSameCondition( private IEnumerable<ProjectItemElement> FindExistingItemsWithSameCondition(
ProjectItemElement item, ProjectItemElement item,
@ -335,7 +572,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
.Where(i => i.Condition == item.Condition) .Where(i => i.Condition == item.Condition)
.Where(i => i.Parent.ConditionChainsAreEquivalent(destinationContainer)) .Where(i => i.Parent.ConditionChainsAreEquivalent(destinationContainer))
.Where(i => i.ItemType == item.ItemType) .Where(i => i.ItemType == item.ItemType)
.Where(i => i.IntersectIncludes(item).Any()); .Where(i => i.IntersectIncludes(item).Any() ||
i.IntersectUpdates(item).Any());
} }
private IEnumerable<ProjectItemElement> FindExistingItemsWithNoCondition( private IEnumerable<ProjectItemElement> FindExistingItemsWithNoCondition(
@ -346,7 +584,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
return project.Items return project.Items
.Where(i => !i.ConditionChain().Any()) .Where(i => !i.ConditionChain().Any())
.Where(i => i.ItemType == item.ItemType) .Where(i => i.ItemType == item.ItemType)
.Where(i => i.IntersectIncludes(item).Any()); .Where(i => i.IntersectIncludes(item).Any() ||
i.IntersectUpdates(item).Any());
} }
private IEnumerable<ProjectItemElement> FindExistingItemsWithACondition( private IEnumerable<ProjectItemElement> FindExistingItemsWithACondition(
@ -357,7 +596,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
return project.Items return project.Items
.Where(i => i.ConditionChain().Any()) .Where(i => i.ConditionChain().Any())
.Where(i => i.ItemType == item.ItemType) .Where(i => i.ItemType == item.ItemType)
.Where(i => i.IntersectIncludes(item).Any()); .Where(i => i.IntersectIncludes(item).Any() ||
i.IntersectUpdates(item).Any());
} }
private class MergeResult private class MergeResult

View file

@ -16,10 +16,13 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
itemName, itemName,
includeContext => string.Empty, includeContext => string.Empty,
includeContext => FormatGlobPatternsForMsbuild(includeContext.ExcludeFiles, includeContext.SourceBasePath), includeContext => FormatGlobPatternsForMsbuild(includeContext.ExcludeFiles, includeContext.SourceBasePath),
includeContext => FormatGlobPatternsForMsbuild(includeContext.IncludeFiles, includeContext.SourceBasePath), includeContext => FormatGlobPatternsForMsbuild(
includeContext.IncludeFiles.OrEmptyIfNull().Where(
pattern => !ExcludePatternRule(pattern)), includeContext.SourceBasePath),
includeContext => includeContext != null includeContext => includeContext != null
&& includeContext.IncludeFiles != null && includeContext.IncludeFiles != null
&& includeContext.IncludeFiles.Count > 0); && includeContext.IncludeFiles.Where(
pattern => !ExcludePatternRule(pattern)).Count() > 0);
protected override Func<string, AddItemTransform<IncludeContext>> IncludeExcludeTransformGetter => protected override Func<string, AddItemTransform<IncludeContext>> IncludeExcludeTransformGetter =>
(itemName) => new AddItemTransform<IncludeContext>( (itemName) => new AddItemTransform<IncludeContext>(
@ -39,24 +42,27 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
.Union(includeContext.BuiltInsInclude.OrEmptyIfNull()) .Union(includeContext.BuiltInsInclude.OrEmptyIfNull())
.Union(includeContext.CustomIncludePatterns.OrEmptyIfNull()); .Union(includeContext.CustomIncludePatterns.OrEmptyIfNull());
return FormatGlobPatternsForMsbuild(fullIncludeSet, includeContext.SourceBasePath); return FormatGlobPatternsForMsbuild(
fullIncludeSet.Where(pattern => !ExcludePatternRule(pattern)),
includeContext.SourceBasePath);
}, },
includeContext => includeContext =>
{ {
return includeContext != null && return includeContext != null &&includeContext.IncludePatterns.OrEmptyIfNull()
( .Union(includeContext.BuiltInsInclude.OrEmptyIfNull())
(includeContext.IncludePatterns != null && includeContext.IncludePatterns.Count > 0) .Union(includeContext.CustomIncludePatterns.OrEmptyIfNull())
|| .Where(pattern => !ExcludePatternRule(pattern)).Count() > 0;
(includeContext.BuiltInsInclude != null && includeContext.BuiltInsInclude.Count > 0)
||
(includeContext.CustomIncludePatterns != null && includeContext.CustomIncludePatterns.Count > 0)
);
}); });
public UpdateContextTransform( public UpdateContextTransform(
string itemName, string itemName,
bool transformMappings = true, bool transformMappings = true,
Func<IncludeContext, bool> condition = null) : base(itemName, transformMappings, condition) Func<IncludeContext, bool> condition = null,
Func<string, bool> excludePatternsRule = null) : base(
itemName,
transformMappings,
condition,
excludePatternsRule: excludePatternsRule)
{ {
} }
} }

View file

@ -1,123 +1,131 @@
Id,LtsVersion,CurrentVersion Id,LtsVersion,CurrentVersion
Microsoft.NETCore.App,1.0.3,1.1.0 Microsoft.NETCore.App,1.0.4,1.1.1
Microsoft.AspNetCore,1.0.3,1.1.0 Microsoft.AspNetCore,1.0.4,1.1.1
Microsoft.AspNetCore.Authentication,1.0.1,1.1.0 Microsoft.AspNetCore.Authentication,1.0.2,1.1.1
Microsoft.AspNetCore.Authentication.Cookies,1.0.1,1.1.0 Microsoft.AspNetCore.Authentication.Cookies,1.0.2,1.1.1
Microsoft.AspNetCore.Authentication.Facebook,1.0.1,1.1.0 Microsoft.AspNetCore.Authentication.Facebook,1.0.2,1.1.1
Microsoft.AspNetCore.Authentication.Google,1.0.1,1.1.0 Microsoft.AspNetCore.Authentication.Google,1.0.2,1.1.1
Microsoft.AspNetCore.Authentication.JwtBearer,1.0.1,1.1.0 Microsoft.AspNetCore.Authentication.JwtBearer,1.0.2,1.1.1
Microsoft.AspNetCore.Authentication.MicrosoftAccount,1.0.1,1.1.0 Microsoft.AspNetCore.Authentication.MicrosoftAccount,1.0.2,1.1.1
Microsoft.AspNetCore.Authentication.OAuth,1.0.1,1.1.0 Microsoft.AspNetCore.Authentication.OAuth,1.0.2,1.1.1
Microsoft.AspNetCore.Authentication.OpenIdConnect,1.0.1,1.1.0 Microsoft.AspNetCore.Authentication.OpenIdConnect,1.0.2,1.1.1
Microsoft.AspNetCore.Authentication.Twitter,1.0.1,1.1.0 Microsoft.AspNetCore.Authentication.Twitter,1.0.2,1.1.1
Microsoft.AspNetCore.CookiePolicy,1.0.1,1.1.0 Microsoft.AspNetCore.Buffering,0.1.2,0.2.1
Microsoft.AspNetCore.Cors,1.0.1,1.1.0 Microsoft.AspNetCore.CookiePolicy,1.0.2,1.1.1
Microsoft.AspNetCore.DataProtection,1.0.1,1.1.0 Microsoft.AspNetCore.Cors,1.0.2,1.1.1
Microsoft.AspNetCore.DataProtection.Extensions,1.0.1,1.1.0 Microsoft.AspNetCore.DataProtection,1.0.2,1.1.1
Microsoft.AspNetCore.DataProtection.SystemWeb,1.0.1,1.1.0 Microsoft.AspNetCore.DataProtection.Extensions,1.0.2,1.1.1
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore,1.0.1,1.1.0 Microsoft.AspNetCore.DataProtection.Redis,,0.1.1
Microsoft.AspNetCore.Hosting.WindowsServices,1.0.1,1.1.0 Microsoft.AspNetCore.DataProtection.SystemWeb,1.0.2,1.1.1
Microsoft.AspNetCore.Html.Abstractions,1.0.1,1.1.0 Microsoft.AspNetCore.DataProtection.Sources,1.0.2,1.1.1
Microsoft.AspNetCore.Identity.EntityFrameworkCore,1.0.1,1.1.0 Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore,1.0.2,1.1.1
Microsoft.AspNetCore.MiddlewareAnalysis,1.0.1,1.1.0 Microsoft.AspNetCore.Diagnostics.Elm,0.1.2,0.2.1
Microsoft.AspNetCore.Mvc,1.0.2,1.1.0 Microsoft.AspNetCore.Hosting.WindowsServices,1.0.2,1.1.1
Microsoft.AspNetCore.Mvc.Abstractions,1.0.2,1.1.0 Microsoft.AspNetCore.Html.Abstractions,1.0.2,1.1.1
Microsoft.AspNetCore.Mvc.ApiExplorer,1.0.2,1.1.0 Microsoft.AspNetCore.Identity.EntityFrameworkCore,1.0.2,1.1.1
Microsoft.AspNetCore.Mvc.Formatters.Xml,1.0.2,1.1.0 Microsoft.AspNetCore.MiddlewareAnalysis,1.0.2,1.1.1
Microsoft.AspNetCore.Mvc.WebApiCompatShim,1.0.2,1.1.0 Microsoft.AspNetCore.Mvc,1.0.3,1.1.2
Microsoft.AspNetCore.Owin,1.0.1,1.1.0 Microsoft.AspNetCore.Mvc.Abstractions,1.0.3,1.1.2
Microsoft.AspNetCore.Routing,1.0.2,1.1.0 Microsoft.AspNetCore.Mvc.ApiExplorer,1.0.3,1.1.2
Microsoft.AspNetCore.Routing.Abstractions,1.0.2,1.1.0 Microsoft.AspNetCore.Mvc.Formatters.Xml,1.0.3,1.1.2
Microsoft.AspNetCore.Server.Kestrel.Https,1.0.2,1.1.0 Microsoft.AspNetCore.Mvc.WebApiCompatShim,1.0.3,1.1.2
Microsoft.AspNetCore.Session,1.0.1,1.1.0 Microsoft.AspNetCore.Owin,1.0.2,1.1.1
Microsoft.AspNetCore.StaticFiles,1.0.1,1.1.0 Microsoft.AspNetCore.Routing,1.0.3,1.1.1
Microsoft.AspNetCore.TestHost,1.0.1,1.1.0 Microsoft.AspNetCore.Routing.Abstractions,1.0.3,1.1.1
Microsoft.AspNetCore.Routing.DecisionTree.Sources,1.0.3,1.1.1
Microsoft.AspNetCore.Server.Kestrel.Https,1.0.3,1.1.1
Microsoft.AspNetCore.Server.WebListener,1.0.2,1.1.1
Microsoft.AspNetCore.Session,1.0.2,1.1.1
Microsoft.AspNetCore.StaticFiles,1.0.2,1.1.1
Microsoft.AspNetCore.TestHost,1.0.2,1.1.1
Microsoft.AspNetCore.Testing,1.0.1,1.1.0-rtm-22752
Microsoft.AspNetCore.DiagnosticsViewPage.Sources,1.0.2,1.1.1
Microsoft.Data.Sqlite,1.0.1,1.1.0 Microsoft.Data.Sqlite,1.0.1,1.1.0
Microsoft.EntityFrameworkCore,1.0.2,1.1.0 Microsoft.EntityFrameworkCore,1.0.3,1.1.1
Microsoft.EntityFrameworkCore.Design,1.0.2,1.1.0 Microsoft.EntityFrameworkCore.Design,1.0.3,1.1.1
Microsoft.EntityFrameworkCore.InMemory,1.0.2,1.1.0 Microsoft.EntityFrameworkCore.InMemory,1.0.3,1.1.1
Microsoft.EntityFrameworkCore.Relational,1.0.2,1.1.0 Microsoft.EntityFrameworkCore.Relational,1.0.3,1.1.1
Microsoft.EntityFrameworkCore.Relational.Design,1.0.2,1.1.0 Microsoft.EntityFrameworkCore.Relational.Design,1.0.3,1.1.1
Microsoft.EntityFrameworkCore.Sqlite,1.0.2,1.1.0 Microsoft.EntityFrameworkCore.Sqlite,1.0.3,1.1.1
Microsoft.EntityFrameworkCore.Sqlite.Design,1.0.2,1.1.0 Microsoft.EntityFrameworkCore.Sqlite.Design,1.0.3,1.1.1
Microsoft.EntityFrameworkCore.SqlServer,1.0.2,1.1.0 Microsoft.EntityFrameworkCore.SqlServer,1.0.3,1.1.1
Microsoft.EntityFrameworkCore.SqlServer.Design,1.0.2,1.1.0 Microsoft.EntityFrameworkCore.SqlServer.Design,1.0.3,1.1.1
Microsoft.Extensions.Caching.Memory,1.0.1,1.1.0 Microsoft.Extensions.Caching.Memory,1.0.2,1.1.1
Microsoft.Extensions.Caching.Redis,1.0.1,1.1.0 Microsoft.Extensions.Caching.Redis,1.0.2,1.1.1
Microsoft.Extensions.Caching.SqlServer,1.0.1,1.1.0 Microsoft.Extensions.Caching.SqlServer,1.0.2,1.1.1
Microsoft.Extensions.CommandLineUtils,1.0.1,1.1.0 Microsoft.Extensions.CommandLineUtils,1.0.1,1.1.0
Microsoft.Extensions.Configuration,1.0.1,1.1.0 Microsoft.Extensions.Configuration,1.0.2,1.1.1
Microsoft.Extensions.Configuration.Binder,1.0.1,1.1.0 Microsoft.Extensions.Configuration.Binder,1.0.2,1.1.1
Microsoft.Extensions.Configuration.CommandLine,1.0.1,1.1.0 Microsoft.Extensions.Configuration.CommandLine,1.0.2,1.1.1
Microsoft.Extensions.Configuration.EnvironmentVariables,1.0.1,1.1.0 Microsoft.Extensions.Configuration.EnvironmentVariables,1.0.2,1.1.1
Microsoft.Extensions.Configuration.FileExtensions,1.0.1,1.1.0 Microsoft.Extensions.Configuration.FileExtensions,1.0.2,1.1.1
Microsoft.Extensions.Configuration.Ini,1.0.1,1.1.0 Microsoft.Extensions.Configuration.Ini,1.0.2,1.1.1
Microsoft.Extensions.Configuration.Json,1.0.1,1.1.0 Microsoft.Extensions.Configuration.Json,1.0.2,1.1.1
Microsoft.Extensions.Configuration.UserSecrets,1.0.1,1.1.0 Microsoft.Extensions.Configuration.UserSecrets,1.0.2,1.1.1
Microsoft.Extensions.Configuration.Xml,1.0.1,1.1.0 Microsoft.Extensions.Configuration.Xml,1.0.2,1.1.1
Microsoft.Extensions.DependencyInjection,1.0.1,1.1.0 Microsoft.Extensions.DependencyInjection,1.0.2,1.1.0
Microsoft.Extensions.DiagnosticAdapter,1.0.1,1.1.0 Microsoft.Extensions.DiagnosticAdapter,1.0.2,1.1.0
Microsoft.Extensions.FileProviders.Composite,1.0.1,1.1.0 Microsoft.Extensions.FileProviders.Composite,1.0.1,1.1.0
Microsoft.Extensions.FileProviders.Embedded,1.0.1,1.1.0 Microsoft.Extensions.FileProviders.Embedded,1.0.1,1.1.0
Microsoft.Extensions.FileProviders.Physical,1.0.1,1.1.0 Microsoft.Extensions.FileProviders.Physical,1.0.1,1.1.0
Microsoft.Extensions.FileSystemGlobbing,1.0.1,1.1.0 Microsoft.Extensions.FileSystemGlobbing,1.0.1,1.1.0
Microsoft.Extensions.Globalization.CultureInfoCache,1.0.1,1.1.0 Microsoft.Extensions.Globalization.CultureInfoCache,1.0.2,1.1.1
Microsoft.Extensions.Localization,1.0.1,1.1.0 Microsoft.Extensions.Localization,1.0.2,1.1.1
Microsoft.Extensions.Logging,1.0.1,1.1.0 Microsoft.Extensions.Logging,1.0.2,1.1.1
Microsoft.Extensions.Logging.Console,1.0.1,1.1.0 Microsoft.Extensions.Logging.Console,1.0.2,1.1.1
Microsoft.Extensions.Logging.Debug,1.0.1,1.1.0 Microsoft.Extensions.Logging.Debug,1.0.2,1.1.1
Microsoft.Extensions.Logging.Filter,1.0.1,1.1.0 Microsoft.Extensions.Logging.Filter,1.0.2,1.1.1
Microsoft.Extensions.Logging.TraceSource,1.0.1,1.1.0 Microsoft.Extensions.Logging.TraceSource,1.0.2,1.1.1
Microsoft.VisualStudio.Web.BrowserLink,1.0.0,1.0.0 Microsoft.Extensions.Logging.EventLog,1.0.2,1.1.1
Microsoft.VisualStudio.Web.BrowserLink.Loader,14.0.1,14.1.0 Microsoft.VisualStudio.Web.BrowserLink,1.0.1,1.1.0
Microsoft.AspNetCore.AzureAppServicesIntegration,,1.0.0 Microsoft.AspNetCore.AzureAppServicesIntegration,,1.0.1
Microsoft.AspNetCore.DataProtection.AzureStorage,,1.0.0 Microsoft.AspNetCore.DataProtection.AzureStorage,,1.0.1
Microsoft.AspNetCore.Localization.Routing,,1.1.0 Microsoft.AspNetCore.Localization.Routing,,1.1.1
Microsoft.AspNetCore.Rewrite,,1.0.0 Microsoft.AspNetCore.Rewrite,,1.0.1
Microsoft.AspNetCore.ResponseCaching,,1.1.0 Microsoft.AspNetCore.ResponseCaching,1.0.1,1.1.1
Microsoft.AspNetCore.ResponseCompression,,1.0.0 Microsoft.AspNetCore.ResponseCompression,,1.0.1
Microsoft.AspNetCore.WebSockets,,1.0.0 Microsoft.AspNetCore.WebSockets,,1.0.1
Microsoft.Extensions.Logging.AzureAppServices,,1.0.0 Microsoft.Extensions.Logging.AzureAppServices,,1.0.1
Microsoft.Extensions.Configuration.AzureKeyVault,,1.0.0 Microsoft.Extensions.Configuration.AzureKeyVault,,1.0.1
Microsoft.Extensions.Logging.EventSource,,1.1.0 Microsoft.Extensions.Logging.EventSource,,1.1.1
System.ServiceModel.Duplex,4.0.1,4.3.0 System.ServiceModel.Duplex,4.0.1,4.3.0
System.ServiceModel.Http,4.1.0,4.3.0 System.ServiceModel.Http,4.1.0,4.3.0
System.ServiceModel.NetTcp,4.1.0,4.3.0 System.ServiceModel.NetTcp,4.1.0,4.3.0
System.ServiceModel.Security,4.0.1,4.3.0 System.ServiceModel.Security,4.0.1,4.3.0
Libuv,1.9.1,1.9.1 Libuv,1.9.1,1.9.1
Microsoft.AspNet.WebApi.Client,5.2.2,5.2.2 Microsoft.AspNet.WebApi.Client,5.2.2,5.2.2
Microsoft.AspNetCore.Antiforgery,1.0.2,1.1.0 Microsoft.AspNetCore.Antiforgery,1.0.3,1.1.1
Microsoft.AspNetCore.Authorization,1.0.1,1.1.0 Microsoft.AspNetCore.Authorization,1.0.2,1.1.1
Microsoft.AspNetCore.Cryptography.Internal,1.0.1,1.1.0 Microsoft.AspNetCore.Cryptography.Internal,1.0.2,1.1.1
Microsoft.AspNetCore.Cryptography.KeyDerivation,1.0.1,1.1.0 Microsoft.AspNetCore.Cryptography.KeyDerivation,1.0.2,1.1.1
Microsoft.AspNetCore.DataProtection.Abstractions,1.0.1,1.1.0 Microsoft.AspNetCore.DataProtection.Abstractions,1.0.2,1.1.1
Microsoft.AspNetCore.Diagnostics,1.0.1,1.1.0 Microsoft.AspNetCore.Diagnostics,1.0.2,1.1.1
Microsoft.AspNetCore.Diagnostics.Abstractions,1.0.1,1.1.0 Microsoft.AspNetCore.Diagnostics.Abstractions,1.0.2,1.1.1
Microsoft.AspNetCore.Hosting,1.0.1,1.1.0 Microsoft.AspNetCore.Hosting,1.0.2,1.1.1
Microsoft.AspNetCore.Hosting.Abstractions,1.0.1,1.1.0 Microsoft.AspNetCore.Hosting.Abstractions,1.0.2,1.1.1
Microsoft.AspNetCore.Hosting.Server.Abstractions,1.0.1,1.1.0 Microsoft.AspNetCore.Hosting.Server.Abstractions,1.0.2,1.1.1
Microsoft.AspNetCore.Http,1.0.1,1.1.0 Microsoft.AspNetCore.Http,1.0.2,1.1.1
Microsoft.AspNetCore.Http.Abstractions,1.0.1,1.1.0 Microsoft.AspNetCore.Http.Abstractions,1.0.2,1.1.1
Microsoft.AspNetCore.Http.Extensions,1.0.1,1.1.0 Microsoft.AspNetCore.Http.Extensions,1.0.2,1.1.1
Microsoft.AspNetCore.Http.Features,1.0.1,1.1.0 Microsoft.AspNetCore.Http.Features,1.0.2,1.1.1
Microsoft.AspNetCore.HttpOverrides,1.0.1,1.1.0 Microsoft.AspNetCore.HttpOverrides,1.0.2,1.1.1
Microsoft.AspNetCore.Identity,1.0.1,1.1.0 Microsoft.AspNetCore.Identity,1.0.2,1.1.1
Microsoft.AspNetCore.JsonPatch,1.0.0,1.1.0 Microsoft.AspNetCore.JsonPatch,1.0.0,1.1.1
Microsoft.AspNetCore.Localization,1.0.1,1.1.0 Microsoft.AspNetCore.Localization,1.0.2,1.1.1
Microsoft.AspNetCore.Mvc.Core,1.0.2,1.1.0 Microsoft.AspNetCore.Mvc.Core,1.0.3,1.1.2
Microsoft.AspNetCore.Mvc.Cors,1.0.2,1.1.0 Microsoft.AspNetCore.Mvc.Cors,1.0.3,1.1.2
Microsoft.AspNetCore.Mvc.DataAnnotations,1.0.2,1.1.0 Microsoft.AspNetCore.Mvc.DataAnnotations,1.0.3,1.1.2
Microsoft.AspNetCore.Mvc.Formatters.Json,1.0.2,1.1.0 Microsoft.AspNetCore.Mvc.Formatters.Json,1.0.3,1.1.2
Microsoft.AspNetCore.Mvc.Localization,1.0.2,1.1.0 Microsoft.AspNetCore.Mvc.Localization,1.0.3,1.1.2
Microsoft.AspNetCore.Mvc.Razor,1.0.2,1.1.0 Microsoft.AspNetCore.Mvc.Razor,1.0.3,1.1.2
Microsoft.AspNetCore.Mvc.Razor.Host,1.0.2,1.1.0 Microsoft.AspNetCore.Mvc.Razor.Host,1.0.3,1.1.2
Microsoft.AspNetCore.Mvc.TagHelpers,1.0.2,1.1.0 Microsoft.AspNetCore.Mvc.TagHelpers,1.0.3,1.1.2
Microsoft.AspNetCore.Mvc.ViewFeatures,1.0.2,1.1.0 Microsoft.AspNetCore.Mvc.ViewFeatures,1.0.3,1.1.2
Microsoft.AspNetCore.Razor,1.0.1,1.1.0 Microsoft.AspNetCore.Razor,1.0.2,1.1.1
Microsoft.AspNetCore.Razor.Runtime,1.0.1,1.1.0 Microsoft.AspNetCore.Razor.Runtime,1.0.2,1.1.1
Microsoft.AspNetCore.Server.IISIntegration,1.0.1,1.1.0 Microsoft.AspNetCore.Server.IISIntegration,1.0.2,1.1.1
Microsoft.AspNetCore.Server.Kestrel,1.0.2,1.1.0 Microsoft.AspNetCore.Server.Kestrel,1.0.3,1.1.1
Microsoft.AspNetCore.WebUtilities,1.0.1,1.1.0 Microsoft.AspNetCore.WebUtilities,1.0.2,1.1.1
Microsoft.Bcl,1.1.9,1.1.9 Microsoft.Bcl,1.1.9,1.1.9
Microsoft.Bcl.Build,1.0.14,1.0.14 Microsoft.Bcl.Build,1.0.14,1.0.14
Microsoft.CodeAnalysis.Analyzers,1.1.0,1.1.0 Microsoft.CodeAnalysis.Analyzers,1.1.0,1.1.0
@ -126,25 +134,26 @@ Microsoft.CodeAnalysis.CSharp,1.3.0,1.3.0
Microsoft.CodeAnalysis.VisualBasic,1.3.0,1.3.0 Microsoft.CodeAnalysis.VisualBasic,1.3.0,1.3.0
Microsoft.CSharp,4.0.1,4.3.0 Microsoft.CSharp,4.0.1,4.3.0
Microsoft.DotNet.InternalAbstractions,1.0.0, Microsoft.DotNet.InternalAbstractions,1.0.0,
Microsoft.Extensions.Caching.Abstractions,1.0.1,1.1.0 Microsoft.Extensions.Caching.Abstractions,1.0.2,1.1.1
Microsoft.Extensions.Configuration.Abstractions,1.0.1,1.1.0 Microsoft.Extensions.Configuration.Abstractions,1.0.2,1.1.1
Microsoft.Extensions.DependencyInjection.Abstractions,1.0.1,1.1.0 Microsoft.Extensions.DependencyInjection.Abstractions,1.0.2,1.1.0
Microsoft.Extensions.DependencyModel,1.0.0,1.1.0 Microsoft.Extensions.DependencyModel,1.0.0,1.1.0
Microsoft.Extensions.FileProviders.Abstractions,1.0.1,1.1.0 Microsoft.Extensions.FileProviders.Abstractions,1.0.1,1.1.0
Microsoft.Extensions.Localization.Abstractions,1.0.1,1.1.0 Microsoft.Extensions.Localization.Abstractions,1.0.2,1.1.1
Microsoft.Extensions.Logging.Abstractions,1.0.1,1.1.0 Microsoft.Extensions.Logging.Abstractions,1.0.2,1.1.1
Microsoft.Extensions.ObjectPool,1.0.1,1.1.0 Microsoft.Extensions.ObjectPool,1.0.1,1.1.0
Microsoft.Extensions.Options,1.0.1,1.1.0 Microsoft.Extensions.Options,1.0.2,1.1.1
Microsoft.Extensions.Options.ConfigurationExtensions,1.0.1,1.1.0 Microsoft.Extensions.Options.ConfigurationExtensions,1.0.2,1.1.1
Microsoft.Extensions.PlatformAbstractions,1.0.0,1.1.0 Microsoft.Extensions.PlatformAbstractions,1.0.0,1.1.0
Microsoft.Extensions.Primitives,1.0.1,1.1.0 Microsoft.Extensions.Primitives,1.0.1,1.1.0
Microsoft.Extensions.WebEncoders,1.0.1,1.1.0 Microsoft.Extensions.WebEncoders,1.0.2,1.1.1
Microsoft.IdentityModel.Logging,1.0.0,1.1.0 Microsoft.IdentityModel.Logging,1.0.0,1.1.0
Microsoft.IdentityModel.Protocols,2.0.0,2.1.0 Microsoft.IdentityModel.Protocols,2.0.0,2.1.0
Microsoft.IdentityModel.Protocols.OpenIdConnect,2.0.0,2.1.0 Microsoft.IdentityModel.Protocols.OpenIdConnect,2.0.0,2.1.0
Microsoft.IdentityModel.Tokens,5.0.0,5.1.0 Microsoft.IdentityModel.Tokens,5.0.0,5.1.0
Microsoft.Net.Http,2.2.22,2.2.22 Microsoft.Net.Http,2.2.22,2.2.22
Microsoft.Net.Http.Headers,1.0.1,1.1.0 Microsoft.Net.Http.Headers,1.0.2,1.1.1
Microsoft.Net.Http.Server,1.0.2,1.1.1
Microsoft.NETCore.DotNetHost,1.0.1,1.1.0 Microsoft.NETCore.DotNetHost,1.0.1,1.1.0
Microsoft.NETCore.DotNetHostPolicy,1.0.3,1.1.0 Microsoft.NETCore.DotNetHostPolicy,1.0.3,1.1.0
Microsoft.NETCore.DotNetHostResolver,1.0.1,1.1.0 Microsoft.NETCore.DotNetHostResolver,1.0.1,1.1.0
@ -275,7 +284,7 @@ System.Xml.XmlDocument,4.0.1,4.3.0
System.Xml.XmlSerializer,4.0.11,4.3.0 System.Xml.XmlSerializer,4.0.11,4.3.0
System.Xml.XPath,4.0.1,4.0.1 System.Xml.XPath,4.0.1,4.0.1
System.Xml.XPath.XDocument,4.0.1,4.0.1 System.Xml.XPath.XDocument,4.0.1,4.0.1
Microsoft.AspNetCore.ResponseCaching.Abstractions,,1.1.0 Microsoft.AspNetCore.ResponseCaching.Abstractions,1.0.1,1.1.1
Microsoft.Azure.KeyVault,,2.0.2-preview Microsoft.Azure.KeyVault,,2.0.2-preview
Microsoft.Azure.KeyVault.WebKey,,2.0.0-preview Microsoft.Azure.KeyVault.WebKey,,2.0.0-preview
Microsoft.Data.Edm,,5.6.4 Microsoft.Data.Edm,,5.6.4

1 Id LtsVersion CurrentVersion
2 Microsoft.NETCore.App 1.0.3 1.0.4 1.1.0 1.1.1
3 Microsoft.AspNetCore 1.0.3 1.0.4 1.1.0 1.1.1
4 Microsoft.AspNetCore.Authentication 1.0.1 1.0.2 1.1.0 1.1.1
5 Microsoft.AspNetCore.Authentication.Cookies 1.0.1 1.0.2 1.1.0 1.1.1
6 Microsoft.AspNetCore.Authentication.Facebook 1.0.1 1.0.2 1.1.0 1.1.1
7 Microsoft.AspNetCore.Authentication.Google 1.0.1 1.0.2 1.1.0 1.1.1
8 Microsoft.AspNetCore.Authentication.JwtBearer 1.0.1 1.0.2 1.1.0 1.1.1
9 Microsoft.AspNetCore.Authentication.MicrosoftAccount 1.0.1 1.0.2 1.1.0 1.1.1
10 Microsoft.AspNetCore.Authentication.OAuth 1.0.1 1.0.2 1.1.0 1.1.1
11 Microsoft.AspNetCore.Authentication.OpenIdConnect 1.0.1 1.0.2 1.1.0 1.1.1
12 Microsoft.AspNetCore.Authentication.Twitter 1.0.1 1.0.2 1.1.0 1.1.1
13 Microsoft.AspNetCore.CookiePolicy Microsoft.AspNetCore.Buffering 1.0.1 0.1.2 1.1.0 0.2.1
14 Microsoft.AspNetCore.Cors Microsoft.AspNetCore.CookiePolicy 1.0.1 1.0.2 1.1.0 1.1.1
15 Microsoft.AspNetCore.DataProtection Microsoft.AspNetCore.Cors 1.0.1 1.0.2 1.1.0 1.1.1
16 Microsoft.AspNetCore.DataProtection.Extensions Microsoft.AspNetCore.DataProtection 1.0.1 1.0.2 1.1.0 1.1.1
17 Microsoft.AspNetCore.DataProtection.SystemWeb Microsoft.AspNetCore.DataProtection.Extensions 1.0.1 1.0.2 1.1.0 1.1.1
18 Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore Microsoft.AspNetCore.DataProtection.Redis 1.0.1 1.1.0 0.1.1
19 Microsoft.AspNetCore.Hosting.WindowsServices Microsoft.AspNetCore.DataProtection.SystemWeb 1.0.1 1.0.2 1.1.0 1.1.1
20 Microsoft.AspNetCore.Html.Abstractions Microsoft.AspNetCore.DataProtection.Sources 1.0.1 1.0.2 1.1.0 1.1.1
21 Microsoft.AspNetCore.Identity.EntityFrameworkCore Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore 1.0.1 1.0.2 1.1.0 1.1.1
22 Microsoft.AspNetCore.MiddlewareAnalysis Microsoft.AspNetCore.Diagnostics.Elm 1.0.1 0.1.2 1.1.0 0.2.1
23 Microsoft.AspNetCore.Mvc Microsoft.AspNetCore.Hosting.WindowsServices 1.0.2 1.1.0 1.1.1
24 Microsoft.AspNetCore.Mvc.Abstractions Microsoft.AspNetCore.Html.Abstractions 1.0.2 1.1.0 1.1.1
25 Microsoft.AspNetCore.Mvc.ApiExplorer Microsoft.AspNetCore.Identity.EntityFrameworkCore 1.0.2 1.1.0 1.1.1
26 Microsoft.AspNetCore.Mvc.Formatters.Xml Microsoft.AspNetCore.MiddlewareAnalysis 1.0.2 1.1.0 1.1.1
27 Microsoft.AspNetCore.Mvc.WebApiCompatShim Microsoft.AspNetCore.Mvc 1.0.2 1.0.3 1.1.0 1.1.2
28 Microsoft.AspNetCore.Owin Microsoft.AspNetCore.Mvc.Abstractions 1.0.1 1.0.3 1.1.0 1.1.2
29 Microsoft.AspNetCore.Routing Microsoft.AspNetCore.Mvc.ApiExplorer 1.0.2 1.0.3 1.1.0 1.1.2
30 Microsoft.AspNetCore.Routing.Abstractions Microsoft.AspNetCore.Mvc.Formatters.Xml 1.0.2 1.0.3 1.1.0 1.1.2
31 Microsoft.AspNetCore.Server.Kestrel.Https Microsoft.AspNetCore.Mvc.WebApiCompatShim 1.0.2 1.0.3 1.1.0 1.1.2
32 Microsoft.AspNetCore.Session Microsoft.AspNetCore.Owin 1.0.1 1.0.2 1.1.0 1.1.1
33 Microsoft.AspNetCore.StaticFiles Microsoft.AspNetCore.Routing 1.0.1 1.0.3 1.1.0 1.1.1
34 Microsoft.AspNetCore.TestHost Microsoft.AspNetCore.Routing.Abstractions 1.0.1 1.0.3 1.1.0 1.1.1
35 Microsoft.AspNetCore.Routing.DecisionTree.Sources 1.0.3 1.1.1
36 Microsoft.AspNetCore.Server.Kestrel.Https 1.0.3 1.1.1
37 Microsoft.AspNetCore.Server.WebListener 1.0.2 1.1.1
38 Microsoft.AspNetCore.Session 1.0.2 1.1.1
39 Microsoft.AspNetCore.StaticFiles 1.0.2 1.1.1
40 Microsoft.AspNetCore.TestHost 1.0.2 1.1.1
41 Microsoft.AspNetCore.Testing 1.0.1 1.1.0-rtm-22752
42 Microsoft.AspNetCore.DiagnosticsViewPage.Sources 1.0.2 1.1.1
43 Microsoft.Data.Sqlite 1.0.1 1.1.0
44 Microsoft.EntityFrameworkCore 1.0.2 1.0.3 1.1.0 1.1.1
45 Microsoft.EntityFrameworkCore.Design 1.0.2 1.0.3 1.1.0 1.1.1
46 Microsoft.EntityFrameworkCore.InMemory 1.0.2 1.0.3 1.1.0 1.1.1
47 Microsoft.EntityFrameworkCore.Relational 1.0.2 1.0.3 1.1.0 1.1.1
48 Microsoft.EntityFrameworkCore.Relational.Design 1.0.2 1.0.3 1.1.0 1.1.1
49 Microsoft.EntityFrameworkCore.Sqlite 1.0.2 1.0.3 1.1.0 1.1.1
50 Microsoft.EntityFrameworkCore.Sqlite.Design 1.0.2 1.0.3 1.1.0 1.1.1
51 Microsoft.EntityFrameworkCore.SqlServer 1.0.2 1.0.3 1.1.0 1.1.1
52 Microsoft.EntityFrameworkCore.SqlServer.Design 1.0.2 1.0.3 1.1.0 1.1.1
53 Microsoft.Extensions.Caching.Memory 1.0.1 1.0.2 1.1.0 1.1.1
54 Microsoft.Extensions.Caching.Redis 1.0.1 1.0.2 1.1.0 1.1.1
55 Microsoft.Extensions.Caching.SqlServer 1.0.1 1.0.2 1.1.0 1.1.1
56 Microsoft.Extensions.CommandLineUtils 1.0.1 1.1.0
57 Microsoft.Extensions.Configuration 1.0.1 1.0.2 1.1.0 1.1.1
58 Microsoft.Extensions.Configuration.Binder 1.0.1 1.0.2 1.1.0 1.1.1
59 Microsoft.Extensions.Configuration.CommandLine 1.0.1 1.0.2 1.1.0 1.1.1
60 Microsoft.Extensions.Configuration.EnvironmentVariables 1.0.1 1.0.2 1.1.0 1.1.1
61 Microsoft.Extensions.Configuration.FileExtensions 1.0.1 1.0.2 1.1.0 1.1.1
62 Microsoft.Extensions.Configuration.Ini 1.0.1 1.0.2 1.1.0 1.1.1
63 Microsoft.Extensions.Configuration.Json 1.0.1 1.0.2 1.1.0 1.1.1
64 Microsoft.Extensions.Configuration.UserSecrets 1.0.1 1.0.2 1.1.0 1.1.1
65 Microsoft.Extensions.Configuration.Xml 1.0.1 1.0.2 1.1.0 1.1.1
66 Microsoft.Extensions.DependencyInjection 1.0.1 1.0.2 1.1.0
67 Microsoft.Extensions.DiagnosticAdapter 1.0.1 1.0.2 1.1.0
68 Microsoft.Extensions.FileProviders.Composite 1.0.1 1.1.0
69 Microsoft.Extensions.FileProviders.Embedded 1.0.1 1.1.0
70 Microsoft.Extensions.FileProviders.Physical 1.0.1 1.1.0
71 Microsoft.Extensions.FileSystemGlobbing 1.0.1 1.1.0
72 Microsoft.Extensions.Globalization.CultureInfoCache 1.0.1 1.0.2 1.1.0 1.1.1
73 Microsoft.Extensions.Localization 1.0.1 1.0.2 1.1.0 1.1.1
74 Microsoft.Extensions.Logging 1.0.1 1.0.2 1.1.0 1.1.1
75 Microsoft.Extensions.Logging.Console 1.0.1 1.0.2 1.1.0 1.1.1
76 Microsoft.Extensions.Logging.Debug 1.0.1 1.0.2 1.1.0 1.1.1
77 Microsoft.Extensions.Logging.Filter 1.0.1 1.0.2 1.1.0 1.1.1
78 Microsoft.Extensions.Logging.TraceSource 1.0.1 1.0.2 1.1.0 1.1.1
79 Microsoft.VisualStudio.Web.BrowserLink Microsoft.Extensions.Logging.EventLog 1.0.0 1.0.2 1.0.0 1.1.1
80 Microsoft.VisualStudio.Web.BrowserLink.Loader Microsoft.VisualStudio.Web.BrowserLink 14.0.1 1.0.1 14.1.0 1.1.0
81 Microsoft.AspNetCore.AzureAppServicesIntegration 1.0.0 1.0.1
82 Microsoft.AspNetCore.DataProtection.AzureStorage 1.0.0 1.0.1
83 Microsoft.AspNetCore.Localization.Routing 1.1.0 1.1.1
84 Microsoft.AspNetCore.Rewrite 1.0.0 1.0.1
85 Microsoft.AspNetCore.ResponseCaching 1.0.1 1.1.0 1.1.1
86 Microsoft.AspNetCore.ResponseCompression 1.0.0 1.0.1
87 Microsoft.AspNetCore.WebSockets 1.0.0 1.0.1
88 Microsoft.Extensions.Logging.AzureAppServices 1.0.0 1.0.1
89 Microsoft.Extensions.Configuration.AzureKeyVault 1.0.0 1.0.1
90 Microsoft.Extensions.Logging.EventSource 1.1.0 1.1.1
91 System.ServiceModel.Duplex 4.0.1 4.3.0
92 System.ServiceModel.Http 4.1.0 4.3.0
93 System.ServiceModel.NetTcp 4.1.0 4.3.0
94 System.ServiceModel.Security 4.0.1 4.3.0
95 Libuv 1.9.1 1.9.1
96 Microsoft.AspNet.WebApi.Client 5.2.2 5.2.2
97 Microsoft.AspNetCore.Antiforgery 1.0.2 1.0.3 1.1.0 1.1.1
98 Microsoft.AspNetCore.Authorization 1.0.1 1.0.2 1.1.0 1.1.1
99 Microsoft.AspNetCore.Cryptography.Internal 1.0.1 1.0.2 1.1.0 1.1.1
100 Microsoft.AspNetCore.Cryptography.KeyDerivation 1.0.1 1.0.2 1.1.0 1.1.1
101 Microsoft.AspNetCore.DataProtection.Abstractions 1.0.1 1.0.2 1.1.0 1.1.1
102 Microsoft.AspNetCore.Diagnostics 1.0.1 1.0.2 1.1.0 1.1.1
103 Microsoft.AspNetCore.Diagnostics.Abstractions 1.0.1 1.0.2 1.1.0 1.1.1
104 Microsoft.AspNetCore.Hosting 1.0.1 1.0.2 1.1.0 1.1.1
105 Microsoft.AspNetCore.Hosting.Abstractions 1.0.1 1.0.2 1.1.0 1.1.1
106 Microsoft.AspNetCore.Hosting.Server.Abstractions 1.0.1 1.0.2 1.1.0 1.1.1
107 Microsoft.AspNetCore.Http 1.0.1 1.0.2 1.1.0 1.1.1
108 Microsoft.AspNetCore.Http.Abstractions 1.0.1 1.0.2 1.1.0 1.1.1
109 Microsoft.AspNetCore.Http.Extensions 1.0.1 1.0.2 1.1.0 1.1.1
110 Microsoft.AspNetCore.Http.Features 1.0.1 1.0.2 1.1.0 1.1.1
111 Microsoft.AspNetCore.HttpOverrides 1.0.1 1.0.2 1.1.0 1.1.1
112 Microsoft.AspNetCore.Identity 1.0.1 1.0.2 1.1.0 1.1.1
113 Microsoft.AspNetCore.JsonPatch 1.0.0 1.1.0 1.1.1
114 Microsoft.AspNetCore.Localization 1.0.1 1.0.2 1.1.0 1.1.1
115 Microsoft.AspNetCore.Mvc.Core 1.0.2 1.0.3 1.1.0 1.1.2
116 Microsoft.AspNetCore.Mvc.Cors 1.0.2 1.0.3 1.1.0 1.1.2
117 Microsoft.AspNetCore.Mvc.DataAnnotations 1.0.2 1.0.3 1.1.0 1.1.2
118 Microsoft.AspNetCore.Mvc.Formatters.Json 1.0.2 1.0.3 1.1.0 1.1.2
119 Microsoft.AspNetCore.Mvc.Localization 1.0.2 1.0.3 1.1.0 1.1.2
120 Microsoft.AspNetCore.Mvc.Razor 1.0.2 1.0.3 1.1.0 1.1.2
121 Microsoft.AspNetCore.Mvc.Razor.Host 1.0.2 1.0.3 1.1.0 1.1.2
122 Microsoft.AspNetCore.Mvc.TagHelpers 1.0.2 1.0.3 1.1.0 1.1.2
123 Microsoft.AspNetCore.Mvc.ViewFeatures 1.0.2 1.0.3 1.1.0 1.1.2
124 Microsoft.AspNetCore.Razor 1.0.1 1.0.2 1.1.0 1.1.1
125 Microsoft.AspNetCore.Razor.Runtime 1.0.1 1.0.2 1.1.0 1.1.1
126 Microsoft.AspNetCore.Server.IISIntegration 1.0.1 1.0.2 1.1.0 1.1.1
127 Microsoft.AspNetCore.Server.Kestrel 1.0.2 1.0.3 1.1.0 1.1.1
128 Microsoft.AspNetCore.WebUtilities 1.0.1 1.0.2 1.1.0 1.1.1
129 Microsoft.Bcl 1.1.9 1.1.9
130 Microsoft.Bcl.Build 1.0.14 1.0.14
131 Microsoft.CodeAnalysis.Analyzers 1.1.0 1.1.0
134 Microsoft.CodeAnalysis.VisualBasic 1.3.0 1.3.0
135 Microsoft.CSharp 4.0.1 4.3.0
136 Microsoft.DotNet.InternalAbstractions 1.0.0
137 Microsoft.Extensions.Caching.Abstractions 1.0.1 1.0.2 1.1.0 1.1.1
138 Microsoft.Extensions.Configuration.Abstractions 1.0.1 1.0.2 1.1.0 1.1.1
139 Microsoft.Extensions.DependencyInjection.Abstractions 1.0.1 1.0.2 1.1.0
140 Microsoft.Extensions.DependencyModel 1.0.0 1.1.0
141 Microsoft.Extensions.FileProviders.Abstractions 1.0.1 1.1.0
142 Microsoft.Extensions.Localization.Abstractions 1.0.1 1.0.2 1.1.0 1.1.1
143 Microsoft.Extensions.Logging.Abstractions 1.0.1 1.0.2 1.1.0 1.1.1
144 Microsoft.Extensions.ObjectPool 1.0.1 1.1.0
145 Microsoft.Extensions.Options 1.0.1 1.0.2 1.1.0 1.1.1
146 Microsoft.Extensions.Options.ConfigurationExtensions 1.0.1 1.0.2 1.1.0 1.1.1
147 Microsoft.Extensions.PlatformAbstractions 1.0.0 1.1.0
148 Microsoft.Extensions.Primitives 1.0.1 1.1.0
149 Microsoft.Extensions.WebEncoders 1.0.1 1.0.2 1.1.0 1.1.1
150 Microsoft.IdentityModel.Logging 1.0.0 1.1.0
151 Microsoft.IdentityModel.Protocols 2.0.0 2.1.0
152 Microsoft.IdentityModel.Protocols.OpenIdConnect 2.0.0 2.1.0
153 Microsoft.IdentityModel.Tokens 5.0.0 5.1.0
154 Microsoft.Net.Http 2.2.22 2.2.22
155 Microsoft.Net.Http.Headers 1.0.1 1.0.2 1.1.0 1.1.1
156 Microsoft.Net.Http.Server 1.0.2 1.1.1
157 Microsoft.NETCore.DotNetHost 1.0.1 1.1.0
158 Microsoft.NETCore.DotNetHostPolicy 1.0.3 1.1.0
159 Microsoft.NETCore.DotNetHostResolver 1.0.1 1.1.0
284 System.Xml.XmlSerializer 4.0.11 4.3.0
285 System.Xml.XPath 4.0.1 4.0.1
286 System.Xml.XPath.XDocument 4.0.1 4.0.1
287 Microsoft.AspNetCore.ResponseCaching.Abstractions 1.0.1 1.1.0 1.1.1
288 Microsoft.Azure.KeyVault 2.0.2-preview
289 Microsoft.Azure.KeyVault.WebKey 2.0.0-preview
290 Microsoft.Data.Edm 5.6.4

View file

@ -20,12 +20,12 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
new AddItemTransform<IncludeContext>( new AddItemTransform<IncludeContext>(
itemName, itemName,
includeContext => FormatGlobPatternsForMsbuild(includeContext.IncludeFiles.OrEmptyIfNull() includeContext => FormatGlobPatternsForMsbuild(includeContext.IncludeFiles.OrEmptyIfNull()
.Where((pattern) => !_excludePatternRule(pattern)), .Where((pattern) => !ExcludePatternRule(pattern)),
includeContext.SourceBasePath), includeContext.SourceBasePath),
includeContext => FormatGlobPatternsForMsbuild(includeContext.ExcludeFiles, includeContext.SourceBasePath), includeContext => FormatGlobPatternsForMsbuild(includeContext.ExcludeFiles, includeContext.SourceBasePath),
includeContext => includeContext != null includeContext => includeContext != null
&& includeContext.IncludeFiles != null && includeContext.IncludeFiles != null
&& includeContext.IncludeFiles.Where((pattern) => !_excludePatternRule(pattern)).Count() > 0); && includeContext.IncludeFiles.Where((pattern) => !ExcludePatternRule(pattern)).Count() > 0);
protected virtual Func<string, AddItemTransform<IncludeContext>> IncludeExcludeTransformGetter => protected virtual Func<string, AddItemTransform<IncludeContext>> IncludeExcludeTransformGetter =>
(itemName) => new AddItemTransform<IncludeContext>( (itemName) => new AddItemTransform<IncludeContext>(
@ -39,7 +39,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
fullIncludeSet = fullIncludeSet.Union(includeContext.BuiltInsInclude.OrEmptyIfNull()); fullIncludeSet = fullIncludeSet.Union(includeContext.BuiltInsInclude.OrEmptyIfNull());
} }
fullIncludeSet = fullIncludeSet.Where((pattern) => !_excludePatternRule(pattern)); fullIncludeSet = fullIncludeSet.Where((pattern) => !ExcludePatternRule(pattern));
return FormatGlobPatternsForMsbuild(fullIncludeSet, includeContext.SourceBasePath); return FormatGlobPatternsForMsbuild(fullIncludeSet, includeContext.SourceBasePath);
}, },
@ -55,9 +55,9 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
{ {
return includeContext != null && return includeContext != null &&
( (
(includeContext.IncludePatterns != null && includeContext.IncludePatterns.Where((pattern) => !_excludePatternRule(pattern)).Count() > 0) (includeContext.IncludePatterns != null && includeContext.IncludePatterns.Where((pattern) => !ExcludePatternRule(pattern)).Count() > 0)
|| ||
(includeContext.CustomIncludePatterns != null && includeContext.CustomIncludePatterns.Where((pattern) => !_excludePatternRule(pattern)).Count() > 0) (includeContext.CustomIncludePatterns != null && includeContext.CustomIncludePatterns.Where((pattern) => !ExcludePatternRule(pattern)).Count() > 0)
|| ||
(_emitBuiltInIncludes && (_emitBuiltInIncludes &&
includeContext.BuiltInsInclude != null && includeContext.BuiltInsInclude != null &&
@ -75,7 +75,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
private readonly string _itemName; private readonly string _itemName;
private bool _transformMappings; private bool _transformMappings;
private Func<string, bool> _excludePatternRule; protected Func<string, bool> ExcludePatternRule { get; }
private bool _emitBuiltInIncludes; private bool _emitBuiltInIncludes;
private readonly List<ItemMetadataValue<IncludeContext>> _metadata = new List<ItemMetadataValue<IncludeContext>>(); private readonly List<ItemMetadataValue<IncludeContext>> _metadata = new List<ItemMetadataValue<IncludeContext>>();
@ -89,7 +89,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
_itemName = itemName; _itemName = itemName;
_transformMappings = transformMappings; _transformMappings = transformMappings;
_emitBuiltInIncludes = emitBuiltInIncludes; _emitBuiltInIncludes = emitBuiltInIncludes;
_excludePatternRule = excludePatternsRule ?? ((pattern) => false); ExcludePatternRule = excludePatternsRule ?? ((pattern) => false);
_mappingsToTransfrom = (addItemTransform, targetPath) => _mappingsToTransfrom = (addItemTransform, targetPath) =>
{ {

View file

@ -19,7 +19,7 @@ namespace Microsoft.DotNet.Tests.EndToEnd
{ {
string projectDirectory = directory.Path; string projectDirectory = directory.Path;
string newArgs = "console --debug:ephemeral-hive"; string newArgs = "console -f netcoreapp1.1 --debug:ephemeral-hive";
new NewCommandShim() new NewCommandShim()
.WithWorkingDirectory(projectDirectory) .WithWorkingDirectory(projectDirectory)
.Execute(newArgs) .Execute(newArgs)
@ -112,7 +112,7 @@ namespace Microsoft.DotNet.Tests.EndToEnd
new DotnetCommand() new DotnetCommand()
.WithWorkingDirectory(testProjectDirectory) .WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput( .ExecuteWithCapturedOutput(
$"-d dependency-tool-invoker -c {configuration} -f netcoreapp1.0 portable") $"-d dependency-tool-invoker -c {configuration} -f netcoreapp1.1 portable")
.Should().Pass() .Should().Pass()
.And.HaveStdOutContaining("Hello Portable World!");; .And.HaveStdOutContaining("Hello Portable World!");;
} }

View file

@ -189,7 +189,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
.Should().Pass(); .Should().Pass();
var factory = new ProjectDependenciesCommandFactory( var factory = new ProjectDependenciesCommandFactory(
FrameworkConstants.CommonFrameworks.NetCoreApp10, FrameworkConstants.CommonFrameworks.NetCoreApp11,
configuration, configuration,
null, null,
null, null,
@ -198,7 +198,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
var command = factory.Create("dotnet-tool-with-output-name", null); var command = factory.Create("dotnet-tool-with-output-name", null);
command.CommandArgs.Should().Contain( command.CommandArgs.Should().Contain(
Path.Combine("toolwithoutputname", "1.0.0", "lib", "netcoreapp1.0", "dotnet-tool-with-output-name.dll")); Path.Combine("toolwithoutputname", "1.0.0", "lib", "netcoreapp1.1", "dotnet-tool-with-output-name.dll"));
} }
} }
} }

View file

@ -47,7 +47,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
CommandName = "dotnet-portable", CommandName = "dotnet-portable",
Configuration = "Debug", Configuration = "Debug",
ProjectDirectory = MSBuildTestProjectInstance.Root.FullName, ProjectDirectory = MSBuildTestProjectInstance.Root.FullName,
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10 Framework = FrameworkConstants.CommonFrameworks.NetCoreApp11
}; };
var result = projectDependenciesCommandResolver.Resolve(commandResolverArguments); var result = projectDependenciesCommandResolver.Resolve(commandResolverArguments);
@ -83,7 +83,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
CommandName = "dotnet-portable", CommandName = "dotnet-portable",
Configuration = "Debug", Configuration = "Debug",
ProjectDirectory = MSBuildTestProjectInstance.Root.FullName, ProjectDirectory = MSBuildTestProjectInstance.Root.FullName,
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10 Framework = FrameworkConstants.CommonFrameworks.NetCoreApp11
}; };
var result = projectDependenciesCommandResolver.Resolve(commandResolverArguments); var result = projectDependenciesCommandResolver.Resolve(commandResolverArguments);
@ -109,7 +109,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
CommandName = "nonexistent-command", CommandName = "nonexistent-command",
CommandArguments = null, CommandArguments = null,
ProjectDirectory = MSBuildTestProjectInstance.Root.FullName, ProjectDirectory = MSBuildTestProjectInstance.Root.FullName,
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10 Framework = FrameworkConstants.CommonFrameworks.NetCoreApp11
}; };
var result = projectDependenciesCommandResolver.Resolve(commandResolverArguments); var result = projectDependenciesCommandResolver.Resolve(commandResolverArguments);
@ -135,7 +135,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
CommandName = "dotnet-portable", CommandName = "dotnet-portable",
Configuration = "Debug", Configuration = "Debug",
ProjectDirectory = testInstance.Root.FullName, ProjectDirectory = testInstance.Root.FullName,
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10, Framework = FrameworkConstants.CommonFrameworks.NetCoreApp11,
OutputPath = outputDir.FullName OutputPath = outputDir.FullName
}; };

View file

@ -18,7 +18,7 @@ namespace Microsoft.DotNet.Tests
public class GivenAProjectToolsCommandResolver : TestBase public class GivenAProjectToolsCommandResolver : TestBase
{ {
private static readonly NuGetFramework s_toolPackageFramework = private static readonly NuGetFramework s_toolPackageFramework =
FrameworkConstants.CommonFrameworks.NetCoreApp10; FrameworkConstants.CommonFrameworks.NetCoreApp11;
private const string TestProjectName = "AppWithToolDependency"; private const string TestProjectName = "AppWithToolDependency";
@ -279,6 +279,7 @@ namespace Microsoft.DotNet.Tests
var projectToolsCommandResolver = SetupProjectToolsCommandResolver(); var projectToolsCommandResolver = SetupProjectToolsCommandResolver();
projectToolsCommandResolver.GenerateDepsJsonFile( projectToolsCommandResolver.GenerateDepsJsonFile(
lockFile, lockFile,
s_toolPackageFramework,
depsJsonFile, depsJsonFile,
new SingleProjectInfo("dotnet-portable", "1.0.0", Enumerable.Empty<ResourceAssemblyInfo>())); new SingleProjectInfo("dotnet-portable", "1.0.0", Enumerable.Empty<ResourceAssemblyInfo>()));

View file

@ -453,11 +453,34 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
mockProj.Properties.First(p => p.Name == "GenerateDocumentationFile").Value.Should().Be("true"); mockProj.Properties.First(p => p.Name == "GenerateDocumentationFile").Value.Should().Be("true");
} }
[Fact]
public void ExcludedPatternsAreNotEmittedOnNoneWhenBuildingAWebProject()
{
var mockProj = RunBuildOptionsRuleOnPj(@"
{
""buildOptions"": {
""emitEntryPoint"": true,
""copyToOutput"": {
""include"": [""wwwroot"", ""**/*.cshtml"", ""appsettings.json"", ""web.config""],
}
},
""dependencies"": {
""Microsoft.AspNetCore.Mvc"" : {
""version"": ""1.0.0""
}
},
""frameworks"": {
""netcoreapp1.0"": {}
}
}");
mockProj.Items.Count(i => i.ItemType.Equals("None", StringComparison.Ordinal)).Should().Be(0);
}
[Theory] [Theory]
[InlineData("compile", "Compile", 3, "")] [InlineData("compile", "Compile", 3, "")]
[InlineData("embed", "EmbeddedResource", 3, ";rootfile.cs")] [InlineData("embed", "EmbeddedResource", 3, ";rootfile.cs")]
[InlineData("copyToOutput", "Content", 2, ";rootfile.cs")] public void MigratingGroupIncludeExcludePopulatesAppropriateProjectItemElement(
private void MigratingGroupIncludeExcludePopulatesAppropriateProjectItemElement(
string group, string group,
string itemName, string itemName,
int expectedNumberOfCompileItems, int expectedNumberOfCompileItems,
@ -529,11 +552,75 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
} }
} }
[Fact]
public void MigratingCopyToOutputIncludeExcludePopulatesAppropriateProjectItemElement()
{
var testDirectory = Temp.CreateDirectory().Path;
WriteExtraFiles(testDirectory);
var pj = @"
{
""buildOptions"": {
""copyToOutput"": {
""include"": [""root"", ""src"", ""rootfile.cs""],
""exclude"": [""anothersource"", ""rootfile1.cs""],
""includeFiles"": [""src/file1.cs"", ""src/file2.cs""],
""excludeFiles"": [""src/file3.cs""]
}
}
}";
var mockProj = RunBuildOptionsRuleOnPj(pj,
testDirectory: testDirectory);
mockProj.Items.Count(i => i.ItemType.Equals("None", StringComparison.Ordinal))
.Should().Be(4);
var copyItems = mockProj.Items.Where(i =>
i.ItemType.Equals("None", StringComparison.Ordinal) &&
i.Metadata.Any(m => m.Name == "CopyToOutputDirectory" && m.Value == "PreserveNewest"));
copyItems.Count().Should().Be(2);
var excludeItems = mockProj.Items.Where(i =>
i.ItemType.Equals("None", StringComparison.Ordinal) &&
i.Metadata.Any(m => m.Name == "CopyToOutputDirectory" && m.Value == "Never"));
excludeItems.Count().Should().Be(2);
foreach (var item in copyItems)
{
VerifyContentMetadata(item);
if (item.Update.Contains(@"src\file1.cs"))
{
item.Update.Should().Be(@"src\file1.cs;src\file2.cs");
}
else
{
item.Update.Should().Be(@"root\**\*;src\**\*;rootfile.cs");
}
}
foreach (var item in excludeItems)
{
VerifyContentMetadata(item);
if (item.Update.Contains(@"src\file3.cs"))
{
item.Update.Should().Be(@"src\file3.cs");
}
else
{
item.Update.Should().Be(@"anothersource\**\*;rootfile1.cs");
}
}
}
[Theory] [Theory]
[InlineData("compile", "Compile", "")] [InlineData("compile", "Compile", "")]
[InlineData("embed", "EmbeddedResource", ";rootfile.cs")] [InlineData("embed", "EmbeddedResource", ";rootfile.cs")]
[InlineData("copyToOutput", "Content", ";rootfile.cs")] public void MigratingGroupIncludeOnlyPopulatesAppropriateProjectItemElement(
private void MigratingGroupIncludeOnlyPopulatesAppropriateProjectItemElement(
string group, string group,
string itemName, string itemName,
string expectedRootFiles) string expectedRootFiles)
@ -551,8 +638,6 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
var mockProj = RunBuildOptionsRuleOnPj(pj, var mockProj = RunBuildOptionsRuleOnPj(pj,
testDirectory: testDirectory); testDirectory: testDirectory);
Console.WriteLine(mockProj.RawXml);
mockProj.Items.Count(i => i.ItemType.Equals(itemName, StringComparison.Ordinal)).Should().Be(1); mockProj.Items.Count(i => i.ItemType.Equals(itemName, StringComparison.Ordinal)).Should().Be(1);
var defaultIncludePatterns = GetDefaultIncludePatterns(group); var defaultIncludePatterns = GetDefaultIncludePatterns(group);
@ -586,6 +671,31 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
} }
} }
[Theory]
[InlineData("copyToOutput", "None", ";rootfile.cs")]
public void MigratingCopyToOutputIncludeOnlyPopulatesAppropriateProjectItemElement(
string group,
string itemName,
string expectedRootFiles)
{
var testDirectory = Temp.CreateDirectory().Path;
WriteExtraFiles(testDirectory);
var pj = @"
{
""buildOptions"": {
""<group>"": [""root"", ""src"", ""rootfile.cs""]
}
}".Replace("<group>", group);
var mockProj = RunBuildOptionsRuleOnPj(pj,
testDirectory: testDirectory);
mockProj.Items.Count(i => i.ItemType.Equals(itemName, StringComparison.Ordinal)).Should().Be(1);
mockProj.Items.Single().Update.Should().Be($@"root\**\*;src\**\*{expectedRootFiles}");
}
[Fact] [Fact]
public void MigratingTestProjectAddsGenerateRuntimeConfigurationFiles() public void MigratingTestProjectAddsGenerateRuntimeConfigurationFiles()
{ {
@ -728,7 +838,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
private static void VerifyContentMetadata(ProjectItemElement item) private static void VerifyContentMetadata(ProjectItemElement item)
{ {
if (item.ItemType == "Content") if (item.ItemType == "None")
{ {
item.Metadata.Count(m => m.Name == "CopyToOutputDirectory").Should().Be(1); item.Metadata.Count(m => m.Name == "CopyToOutputDirectory").Should().Be(1);
} }
@ -738,12 +848,14 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
{ {
Directory.CreateDirectory(Path.Combine(directory, "root")); Directory.CreateDirectory(Path.Combine(directory, "root"));
Directory.CreateDirectory(Path.Combine(directory, "src")); Directory.CreateDirectory(Path.Combine(directory, "src"));
Directory.CreateDirectory(Path.Combine(directory, "anothersource"));
File.WriteAllText(Path.Combine(directory, "root", "file1.txt"), "content"); File.WriteAllText(Path.Combine(directory, "root", "file1.txt"), "content");
File.WriteAllText(Path.Combine(directory, "root", "file2.txt"), "content"); File.WriteAllText(Path.Combine(directory, "root", "file2.txt"), "content");
File.WriteAllText(Path.Combine(directory, "root", "file3.txt"), "content"); File.WriteAllText(Path.Combine(directory, "root", "file3.txt"), "content");
File.WriteAllText(Path.Combine(directory, "src", "file1.cs"), "content"); File.WriteAllText(Path.Combine(directory, "src", "file1.cs"), "content");
File.WriteAllText(Path.Combine(directory, "src", "file2.cs"), "content"); File.WriteAllText(Path.Combine(directory, "src", "file2.cs"), "content");
File.WriteAllText(Path.Combine(directory, "src", "file3.cs"), "content"); File.WriteAllText(Path.Combine(directory, "src", "file3.cs"), "content");
File.WriteAllText(Path.Combine(directory, "anothersource", "file4.cs"), "content");
File.WriteAllText(Path.Combine(directory, "rootfile.cs"), "content"); File.WriteAllText(Path.Combine(directory, "rootfile.cs"), "content");
} }

View file

@ -157,9 +157,9 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
""buildOptions"": { ""buildOptions"": {
""copyToOutput"": { ""copyToOutput"": {
""include"": [""src""], ""include"": [""src""],
""exclude"": [""src"", ""rootfile.cs""], ""exclude"": [""anothersource"", ""rootfile.cs""],
""includeFiles"": [""src/file1.cs"", ""src/file2.cs""], ""includeFiles"": [""src/file1.cs"", ""src/file2.cs""],
""excludeFiles"": [""src/file2.cs""] ""excludeFiles"": [""anothersource/file2.cs""]
} }
}, },
""configurations"": { ""configurations"": {
@ -167,34 +167,76 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
""buildOptions"": { ""buildOptions"": {
""copyToOutput"": { ""copyToOutput"": {
""include"": [""root"", ""src"", ""rootfile.cs""], ""include"": [""root"", ""src"", ""rootfile.cs""],
""exclude"": [""src"", ""root/rootfile.cs""], ""exclude"": [""anothersource"", ""root/rootfile.cs""],
""includeFiles"": [""src/file1.cs"", ""src/file2.cs""], ""includeFiles"": [""src/file1.cs"", ""src/file2.cs""],
""excludeFiles"": [""src/file2.cs""] ""excludeFiles"": [""src/file3.cs""]
} }
} }
} }
} }
}"); }");
var contentItems = mockProj.Items.Where(item => item.ItemType == "Content"); var contentItems = mockProj.Items.Where(item => item.ItemType == "None");
contentItems.Count().Should().Be(4); contentItems.Count().Should().Be(8);
// 2 for Base Build options contentItems.Where(i => i.ConditionChain().Count() == 0).Should().HaveCount(4);
contentItems.Where(i => i.ConditionChain().Count() == 0).Should().HaveCount(2);
// 2 for Configuration BuildOptions (1 Remove, 1 Include) contentItems.Where(i =>
contentItems.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(2); i.ConditionChain().Count() == 0 &&
i.Metadata.Any(m => m.Value == "PreserveNewest")).Should().HaveCount(2);
contentItems.Where(i =>
i.ConditionChain().Count() == 0 &&
i.Metadata.Any(m => m.Value == "Never")).Should().HaveCount(2);
var configIncludeContentItem = contentItems.First( contentItems.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(4);
item => item.ConditionChain().Count() > 0 && !string.IsNullOrEmpty(item.Include)); contentItems.Where(i =>
var configRemoveContentItem = contentItems.First( i.ConditionChain().Count() == 1 &&
item => item.ConditionChain().Count() > 0 && !string.IsNullOrEmpty(item.Remove)); i.Metadata.Any(m => m.Value == "PreserveNewest")).Should().HaveCount(1);
contentItems.Where(i =>
i.ConditionChain().Count() == 1 &&
i.Metadata.Any(m => m.Value == "Never")).Should().HaveCount(2);
// Directories are not converted to globs in the result because we did not write the directory contentItems.First(i =>
configRemoveContentItem.Remove.Should().Be(@"root;src;rootfile.cs"); i.ConditionChain().Count() == 1 &&
configIncludeContentItem.Include.Should().Be(@"root;src;rootfile.cs"); i.Metadata.Any(m => m.Value == "PreserveNewest") &&
configIncludeContentItem.Exclude.Should().Be(@"src;root\rootfile.cs;src\file2.cs"); !string.IsNullOrEmpty(i.Update)).Update.Should().Be(@"root;rootfile.cs");
contentItems.First(i =>
i.ConditionChain().Count() == 1 &&
i.Metadata.Any(m => m.Value == "Never") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Contains(@"src\file3.cs")).Update.Should().Be(@"src\file3.cs");
contentItems.First(i =>
i.ConditionChain().Count() == 1 &&
i.Metadata.Any(m => m.Value == "Never") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Contains(@"root\rootfile.cs")).Update.Should().Be(@"root\rootfile.cs");
contentItems.First(i =>
i.ConditionChain().Count() == 0 &&
i.Metadata.Any(m => m.Value == "PreserveNewest") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Contains(@"src\file1.cs")).Update.Should().Be(@"src\file1.cs;src\file2.cs");
contentItems.First(i =>
i.ConditionChain().Count() == 0 &&
i.Metadata.Any(m => m.Value == "PreserveNewest") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Equals(@"src")).Update.Should().Be(@"src");
contentItems.First(i =>
i.ConditionChain().Count() == 0 &&
i.Metadata.Any(m => m.Value == "Never") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Equals(@"anothersource\file2.cs")).Update.Should().Be(@"anothersource\file2.cs");
contentItems.First(i =>
i.ConditionChain().Count() == 0 &&
i.Metadata.Any(m => m.Value == "Never") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Equals(@"anothersource;rootfile.cs")).Update.Should().Be(@"anothersource;rootfile.cs");
} }
[Fact] [Fact]
@ -214,7 +256,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
""testconfig"": { ""testconfig"": {
""buildOptions"": { ""buildOptions"": {
""copyToOutput"": { ""copyToOutput"": {
""include"": [""root"", ""src"", ""rootfile.cs""], ""include"": [""root"", ""anothersource"", ""rootfile.cs""],
""exclude"": [""rootfile.cs"", ""someotherfile.cs""], ""exclude"": [""rootfile.cs"", ""someotherfile.cs""],
""includeFiles"": [""src/file1.cs"", ""src/file2.cs""], ""includeFiles"": [""src/file1.cs"", ""src/file2.cs""],
""excludeFiles"": [""src/file2.cs""] ""excludeFiles"": [""src/file2.cs""]
@ -224,37 +266,73 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
} }
}"); }");
var contentItems = mockProj.Items.Where(item => item.ItemType == "Content"); var contentItems = mockProj.Items.Where(item => item.ItemType == "None");
contentItems.Count().Should().Be(5); contentItems.Count().Should().Be(9);
contentItems.Where(i => i.ConditionChain().Count() == 0).Should().HaveCount(4);
contentItems.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(5);
// 2 for Base Build options contentItems.Where(i =>
contentItems.Where(i => i.ConditionChain().Count() == 0).Should().HaveCount(2); i.ConditionChain().Count() == 0 &&
i.Metadata.Any(m => m.Value == "PreserveNewest")).Should().HaveCount(2);
contentItems.Where(i =>
i.ConditionChain().Count() == 0 &&
i.Metadata.Any(m => m.Value == "Never")).Should().HaveCount(2);
// 3 for Configuration BuildOptions (1 Remove, 2 Include) contentItems.Where(i =>
contentItems.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(3); i.ConditionChain().Count() == 1 &&
i.Metadata.Any(m => m.Value == "PreserveNewest")).Should().HaveCount(1);
contentItems.Where(i =>
i.ConditionChain().Count() == 1 &&
i.Metadata.Any(m => m.Value == "Never")).Should().HaveCount(3);
var configIncludeContentItem = contentItems.First( contentItems.First(i =>
item => item.ConditionChain().Count() > 0 i.ConditionChain().Count() == 0 &&
&& item.Include.Contains("root")); i.Metadata.Any(m => m.Value == "PreserveNewest") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Contains(@"src\file1.cs")).Update.Should().Be(@"src\file1.cs;src\file2.cs");
var configIncludeContentItem2 = contentItems.First( contentItems.First(i =>
item => item.ConditionChain().Count() > 0 i.ConditionChain().Count() == 0 &&
&& item.Include.Contains(@"src\file1.cs")); i.Metadata.Any(m => m.Value == "PreserveNewest") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Equals(@"src")).Update.Should().Be(@"src");
var configRemoveContentItem = contentItems.First( contentItems.First(i =>
item => item.ConditionChain().Count() > 0 && !string.IsNullOrEmpty(item.Remove)); i.ConditionChain().Count() == 0 &&
i.Metadata.Any(m => m.Value == "Never") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Equals(@"src\file3.cs")).Update.Should().Be(@"src\file3.cs");
// Directories are not converted to globs in the result because we did not write the directory contentItems.First(i =>
configRemoveContentItem.Removes() i.ConditionChain().Count() == 0 &&
.Should().BeEquivalentTo("root", "src", "rootfile.cs", @"src\file1.cs", @"src\file2.cs"); i.Metadata.Any(m => m.Value == "Never") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Equals(@"rootfile.cs")).Update.Should().Be(@"rootfile.cs");
configIncludeContentItem.Includes().Should().BeEquivalentTo("root", "src", "rootfile.cs"); contentItems.First(i =>
configIncludeContentItem.Excludes() i.ConditionChain().Count() == 1 &&
.Should().BeEquivalentTo("rootfile.cs", "someotherfile.cs", @"src\file2.cs"); i.Metadata.Any(m => m.Value == "PreserveNewest") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Contains(@"root;anothersource")).Update.Should().Be(@"root;anothersource");
configIncludeContentItem2.Includes().Should().BeEquivalentTo(@"src\file1.cs", @"src\file2.cs"); contentItems.First(i =>
configIncludeContentItem2.Excludes().Should().BeEquivalentTo(@"src\file2.cs"); i.ConditionChain().Count() == 1 &&
i.Metadata.Any(m => m.Value == "Never") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Contains(@"src\file2.cs")).Update.Should().Be(@"src\file2.cs");
contentItems.First(i =>
i.ConditionChain().Count() == 1 &&
i.Metadata.Any(m => m.Value == "Never") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Contains(@"rootfile.cs")).Update.Should().Be(@"rootfile.cs");
contentItems.First(i =>
i.ConditionChain().Count() == 1 &&
i.Metadata.Any(m => m.Value == "Never") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Contains(@"someotherfile.cs")).Update.Should().Be(@"someotherfile.cs");
} }
[Fact] [Fact]
@ -280,37 +358,46 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
} }
}"); }");
var contentItems = mockProj.Items.Where(item => item.ItemType == "Content"); var contentItems = mockProj.Items.Where(item => item.ItemType == "None");
contentItems.Count().Should().Be(2); contentItems.Count().Should().Be(5);
contentItems.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(2); contentItems.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(5);
var configIncludeContentItem = contentItems.First( var configIncludeContentItem = contentItems.First(item => item.Update.Contains("root"));
item => item.ConditionChain().Count() > 0 var configIncludeContentItem2 = contentItems.First(item => item.Update.Contains(@"src\file1.cs"));
&& item.Include.Contains("root")); var configIncludeContentItem3 = contentItems.First(item => item.Update.Contains(@"src\file2.cs"));
var configIncludeContentItem4 = contentItems.First(item => item.Update.Equals(@"src"));
var configIncludeContentItem2 = contentItems.First( var configIncludeContentItem5 = contentItems.First(item => item.Update.Contains(@"rootfile.cs"));
item => item.ConditionChain().Count() > 0
&& item.Include.Contains(@"src\file1.cs"));
configIncludeContentItem.Includes().Should().BeEquivalentTo("root", "src");
configIncludeContentItem.Excludes()
.Should().BeEquivalentTo("rootfile.cs", "src", @"src\file2.cs");
configIncludeContentItem.Updates().Should().BeEquivalentTo("root");
configIncludeContentItem.GetMetadataWithName("Link").Should().NotBeNull(); configIncludeContentItem.GetMetadataWithName("Link").Should().NotBeNull();
configIncludeContentItem.GetMetadataWithName("Link").Value.Should().Be("/some/dir/%(FileName)%(Extension)"); configIncludeContentItem.GetMetadataWithName("Link").Value.Should().Be("/some/dir/%(FileName)%(Extension)");
configIncludeContentItem.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull(); configIncludeContentItem.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull();
configIncludeContentItem.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("PreserveNewest"); configIncludeContentItem.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("PreserveNewest");
configIncludeContentItem2.Includes().Should().BeEquivalentTo(@"src\file1.cs", @"src\file2.cs"); configIncludeContentItem2.Updates().Should().BeEquivalentTo(@"src\file1.cs");
configIncludeContentItem2.Excludes().Should().BeEquivalentTo(@"src\file2.cs");
configIncludeContentItem2.GetMetadataWithName("Link").Should().NotBeNull(); configIncludeContentItem2.GetMetadataWithName("Link").Should().NotBeNull();
configIncludeContentItem2.GetMetadataWithName("Link").Value.Should().Be("/some/dir/%(FileName)%(Extension)"); configIncludeContentItem2.GetMetadataWithName("Link").Value.Should().Be("/some/dir/%(FileName)%(Extension)");
configIncludeContentItem2.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull(); configIncludeContentItem2.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull();
configIncludeContentItem2.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("PreserveNewest"); configIncludeContentItem2.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("PreserveNewest");
configIncludeContentItem3.Updates().Should().BeEquivalentTo(@"src\file2.cs");
configIncludeContentItem3.GetMetadataWithName("Link").Should().NotBeNull();
configIncludeContentItem3.GetMetadataWithName("Link").Value.Should().Be("/some/dir/%(FileName)%(Extension)");
configIncludeContentItem3.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull();
configIncludeContentItem3.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("Never");
configIncludeContentItem4.Updates().Should().BeEquivalentTo(@"src");
configIncludeContentItem4.GetMetadataWithName("Link").Should().NotBeNull();
configIncludeContentItem4.GetMetadataWithName("Link").Value.Should().Be("/some/dir/%(FileName)%(Extension)");
configIncludeContentItem4.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull();
configIncludeContentItem4.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("Never");
configIncludeContentItem5.Updates().Should().BeEquivalentTo(@"rootfile.cs");
configIncludeContentItem5.GetMetadataWithName("Link").Should().NotBeNull();
configIncludeContentItem5.GetMetadataWithName("Link").Value.Should().Be("/some/dir/%(FileName)%(Extension)");
configIncludeContentItem5.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull();
configIncludeContentItem5.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("Never");
} }
[Fact] [Fact]
@ -338,47 +425,65 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
} }
}"); }");
var contentItems = mockProj.Items.Where(item => item.ItemType == "Content"); var contentItems = mockProj.Items.Where(item => item.ItemType == "None");
contentItems.Count().Should().Be(3); contentItems.Count().Should().Be(6);
contentItems.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(3); contentItems.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(6);
var configIncludeContentItem = contentItems.First( var configIncludeContentItem = contentItems.First(
item => item.ConditionChain().Count() > 0 item => item.ConditionChain().Count() > 0
&& item.Include == "root"); && item.Update == "root");
var configIncludeContentItem2 = contentItems.First( var configIncludeContentItem2 = contentItems.First(
item => item.ConditionChain().Count() > 0 item => item.ConditionChain().Count() > 0
&& item.Include == "src"); && item.Update == "src");
var configIncludeContentItem3 = contentItems.First( var configIncludeContentItem3 = contentItems.First(
item => item.ConditionChain().Count() > 0 item => item.ConditionChain().Count() > 0
&& item.Include.Contains(@"src\file1.cs")); && item.Update.Contains(@"src\file1.cs"));
// Directories are not converted to globs in the result because we did not write the directory var configIncludeContentItem4 = contentItems.First(
item => item.ConditionChain().Count() > 0
&& item.Update.Contains(@"src\file2.cs"));
configIncludeContentItem.Includes().Should().BeEquivalentTo("root"); var configIncludeContentItem5 = contentItems.First(
configIncludeContentItem.Excludes() item => item.ConditionChain().Count() > 0
.Should().BeEquivalentTo("rootfile.cs", "src", @"src\file2.cs"); && item.Update.Equals(@"rootfile.cs"));
var configIncludeContentItem6 = contentItems.First(
item => item.ConditionChain().Count() > 0
&& item.Update.Equals(@"src\rootfile.cs"));
configIncludeContentItem.Updates().Should().BeEquivalentTo("root");
configIncludeContentItem.GetMetadataWithName("Link").Should().BeNull(); configIncludeContentItem.GetMetadataWithName("Link").Should().BeNull();
configIncludeContentItem.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull(); configIncludeContentItem.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull();
configIncludeContentItem.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("PreserveNewest"); configIncludeContentItem.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("PreserveNewest");
configIncludeContentItem2.Include.Should().Be("src"); configIncludeContentItem2.Update.Should().Be("src");
configIncludeContentItem2.Excludes().Should().BeEquivalentTo("src", "rootfile.cs", @"src\rootfile.cs", @"src\file2.cs");
configIncludeContentItem2.GetMetadataWithName("Link").Should().NotBeNull(); configIncludeContentItem2.GetMetadataWithName("Link").Should().NotBeNull();
configIncludeContentItem2.GetMetadataWithName("Link").Value.Should().Be("/some/dir/%(FileName)%(Extension)"); configIncludeContentItem2.GetMetadataWithName("Link").Value.Should().Be("/some/dir/%(FileName)%(Extension)");
configIncludeContentItem2.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull(); configIncludeContentItem2.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull();
configIncludeContentItem2.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("PreserveNewest"); configIncludeContentItem2.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("Never");
configIncludeContentItem3.Includes().Should().BeEquivalentTo(@"src\file1.cs");
configIncludeContentItem3.Exclude.Should().Be(@"src\file2.cs");
configIncludeContentItem3.Updates().Should().BeEquivalentTo(@"src\file1.cs");
configIncludeContentItem3.GetMetadataWithName("Link").Should().BeNull(); configIncludeContentItem3.GetMetadataWithName("Link").Should().BeNull();
configIncludeContentItem3.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull(); configIncludeContentItem3.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull();
configIncludeContentItem3.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("PreserveNewest"); configIncludeContentItem3.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("PreserveNewest");
configIncludeContentItem4.Updates().Should().BeEquivalentTo(@"src\file2.cs");
configIncludeContentItem4.GetMetadataWithName("Link").Should().BeNull();
configIncludeContentItem4.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull();
configIncludeContentItem4.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("Never");
configIncludeContentItem5.Updates().Should().BeEquivalentTo(@"rootfile.cs");
configIncludeContentItem5.GetMetadataWithName("Link").Should().BeNull();
configIncludeContentItem5.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull();
configIncludeContentItem5.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("Never");
configIncludeContentItem6.Updates().Should().BeEquivalentTo(@"src\rootfile.cs");
configIncludeContentItem6.GetMetadataWithName("Link").Value.Should().Be("/some/dir/%(FileName)%(Extension)");
configIncludeContentItem6.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull();
configIncludeContentItem6.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("Never");
} }
[Fact] [Fact]
@ -410,38 +515,67 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
} }
}"); }");
var contentItems = mockProj.Items.Where(item => item.ItemType == "Content"); var contentItems = mockProj.Items.Where(item => item.ItemType == "None");
contentItems.Count().Should().Be(4); contentItems.Count().Should().Be(8);
var rootBuildOptionsContentItems = contentItems.Where(i => i.ConditionChain().Count() == 0).ToList(); var rootBuildOptionsContentItems = contentItems.Where(i => i.ConditionChain().Count() == 0).ToList();
rootBuildOptionsContentItems.Count().Should().Be(2); rootBuildOptionsContentItems.Count().Should().Be(5);
foreach (var buildOptionContentItem in rootBuildOptionsContentItems) foreach (var buildOptionContentItem in rootBuildOptionsContentItems)
{ {
buildOptionContentItem.GetMetadataWithName("Link").Should().BeNull(); buildOptionContentItem.GetMetadataWithName("Link").Should().BeNull();
buildOptionContentItem.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("PreserveNewest");
} }
contentItems.First(i =>
i.ConditionChain().Count() == 0 &&
i.Metadata.Any(m => m.Value == "PreserveNewest") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Equals(@"src\file1.cs")).Update.Should().Be(@"src\file1.cs");
contentItems.First(i =>
i.ConditionChain().Count() == 0 &&
i.Metadata.Any(m => m.Value == "PreserveNewest") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Equals(@"root")).Update.Should().Be(@"root");
contentItems.First(i =>
i.ConditionChain().Count() == 0 &&
i.Metadata.Any(m => m.Value == "Never") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Equals(@"src\file2.cs")).Update.Should().Be(@"src\file2.cs");
contentItems.First(i =>
i.ConditionChain().Count() == 0 &&
i.Metadata.Any(m => m.Value == "Never") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Equals(@"src")).Update.Should().Be(@"src");
contentItems.First(i =>
i.ConditionChain().Count() == 0 &&
i.Metadata.Any(m => m.Value == "Never") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Equals(@"rootfile.cs")).Update.Should().Be(@"rootfile.cs");
var configItems = contentItems.Where(i => i.ConditionChain().Count() == 1); var configItems = contentItems.Where(i => i.ConditionChain().Count() == 1);
configItems.Should().HaveCount(2); configItems.Should().HaveCount(3);
var configIncludeContentItem = contentItems.First( var configIncludeContentItem = contentItems.First(
item => item.ConditionChain().Count() > 0 item => item.ConditionChain().Count() > 0
&& item.Include.Contains("src")); && item.Update.Contains("src"));
var configRemoveContentItem = contentItems.First( var configRemoveContentItem = contentItems.First(
item => item.ConditionChain().Count() > 0 item => item.ConditionChain().Count() > 0
&& !string.IsNullOrEmpty(item.Remove)); && !string.IsNullOrEmpty(item.Remove));
configIncludeContentItem.Include.Should().Be("src"); configIncludeContentItem.Update.Should().Be("src");
configIncludeContentItem.GetMetadataWithName("Link").Should().NotBeNull(); configIncludeContentItem.GetMetadataWithName("Link").Should().NotBeNull();
configIncludeContentItem.GetMetadataWithName("Link").Value.Should().Be("/some/dir/%(FileName)%(Extension)"); configIncludeContentItem.GetMetadataWithName("Link").Value.Should().Be("/some/dir/%(FileName)%(Extension)");
configIncludeContentItem.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull(); configIncludeContentItem.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull();
configIncludeContentItem.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("PreserveNewest"); configIncludeContentItem.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("Never");
configRemoveContentItem.Remove.Should().Be("src"); configRemoveContentItem.Remove.Should().Be("src;rootfile.cs");
} }
[Fact] [Fact]
@ -477,47 +611,42 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
} }
}"); }");
var contentItems = mockProj.Items.Where(item => item.ItemType == "Content"); var contentItems = mockProj.Items.Where(item => item.ItemType == "None");
contentItems.Count().Should().Be(5); contentItems.Count().Should().Be(9);
contentItems.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(3); contentItems.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(4);
var rootBuildOptionsContentItems = contentItems.Where(i => i.ConditionChain().Count() == 0).ToList(); var rootBuildOptionsContentItems = contentItems.Where(i => i.ConditionChain().Count() == 0).ToList();
rootBuildOptionsContentItems.Count().Should().Be(2); rootBuildOptionsContentItems.Count().Should().Be(5);
foreach (var buildOptionContentItem in rootBuildOptionsContentItems) foreach (var buildOptionContentItem in rootBuildOptionsContentItems)
{ {
buildOptionContentItem.GetMetadataWithName("Link").Should().BeNull(); buildOptionContentItem.GetMetadataWithName("Link").Should().BeNull();
buildOptionContentItem.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("PreserveNewest");
} }
var configIncludeEncompassedItem = contentItems.FirstOrDefault( var configIncludeEncompassedItem = contentItems.FirstOrDefault(
item => item.ConditionChain().Count() > 0 item => item.ConditionChain().Count() > 0
&& item.Include == "root"); && item.Update == "root");
configIncludeEncompassedItem.Should().BeNull(); configIncludeEncompassedItem.Should().BeNull();
var configIncludeContentItem = contentItems.First( var configIncludeContentItem = contentItems.First(
item => item.ConditionChain().Count() > 0 item => item.ConditionChain().Count() > 0
&& item.Include == "src"); && item.Update == "src");
var configIncludeContentItem2 = contentItems.First( var configIncludeContentItem2 = contentItems.First(
item => item.ConditionChain().Count() > 0 item => item.ConditionChain().Count() > 0
&& item.Include.Contains(@"src\file3.cs")); && item.Update.Contains(@"src\file3.cs"));
var configRemoveContentItem = contentItems.First( var configRemoveContentItem = contentItems.First(
item => item.ConditionChain().Count() > 0 item => item.ConditionChain().Count() > 0
&& !string.IsNullOrEmpty(item.Remove)); && !string.IsNullOrEmpty(item.Remove));
configIncludeContentItem.Include.Should().Be("src"); configIncludeContentItem.Update.Should().Be("src");
configIncludeContentItem.Excludes().Should().BeEquivalentTo("src", "rootfile.cs", @"src\rootfile.cs", @"src\file2.cs");
configIncludeContentItem.GetMetadataWithName("Link").Should().NotBeNull(); configIncludeContentItem.GetMetadataWithName("Link").Should().NotBeNull();
configIncludeContentItem.GetMetadataWithName("Link").Value.Should().Be("/some/dir/%(FileName)%(Extension)"); configIncludeContentItem.GetMetadataWithName("Link").Value.Should().Be("/some/dir/%(FileName)%(Extension)");
configIncludeContentItem.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull(); configIncludeContentItem.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull();
configIncludeContentItem.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("PreserveNewest"); configIncludeContentItem.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("Never");
configIncludeContentItem2.Includes().Should().BeEquivalentTo(@"src\file3.cs");
configIncludeContentItem2.Exclude.Should().Be(@"src\file2.cs");
configIncludeContentItem2.Updates().Should().BeEquivalentTo(@"src\file3.cs");
configIncludeContentItem2.GetMetadataWithName("Link").Should().BeNull(); configIncludeContentItem2.GetMetadataWithName("Link").Should().BeNull();
configIncludeContentItem2.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull(); configIncludeContentItem2.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull();
configIncludeContentItem2.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("PreserveNewest"); configIncludeContentItem2.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("PreserveNewest");

View file

@ -15,7 +15,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
public class GivenThatIWantToMigratePackOptions : TestBase public class GivenThatIWantToMigratePackOptions : TestBase
{ {
[Fact] [Fact]
public void It_does_not_migrate_Summary() public void ItDoesNotMigrateSummary()
{ {
var mockProj = RunPackOptionsRuleOnPj(@" var mockProj = RunPackOptionsRuleOnPj(@"
{ {
@ -28,7 +28,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
} }
[Fact] [Fact]
public void It_does_not_migrate_Owner() public void ItDoesNotMigrateOwner()
{ {
var mockProj = RunPackOptionsRuleOnPj(@" var mockProj = RunPackOptionsRuleOnPj(@"
{ {
@ -41,7 +41,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
} }
[Fact] [Fact]
public void Migrating__empty_tags_does_not_populate_PackageTags() public void MigratingEmptyTagsDoesNotPopulatePackageTags()
{ {
var mockProj = RunPackOptionsRuleOnPj(@" var mockProj = RunPackOptionsRuleOnPj(@"
{ {
@ -54,7 +54,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
} }
[Fact] [Fact]
public void Migrating_tags_populates_PackageTags_semicolon_delimited() public void MigratingTagsPopulatesPackageTagsSemicolonDelimited()
{ {
var mockProj = RunPackOptionsRuleOnPj(@" var mockProj = RunPackOptionsRuleOnPj(@"
{ {
@ -68,7 +68,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
} }
[Fact] [Fact]
public void Migrating_ReleaseNotes_populates_PackageReleaseNotes() public void MigratingReleaseNotesPopulatesPackageReleaseNotes()
{ {
var mockProj = RunPackOptionsRuleOnPj(@" var mockProj = RunPackOptionsRuleOnPj(@"
{ {
@ -83,7 +83,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
} }
[Fact] [Fact]
public void Migrating_IconUrl_populates_PackageIconUrl() public void MigratingIconUrlPopulatesPackageIconUrl()
{ {
var mockProj = RunPackOptionsRuleOnPj(@" var mockProj = RunPackOptionsRuleOnPj(@"
{ {
@ -98,7 +98,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
} }
[Fact] [Fact]
public void Migrating_ProjectUrl_populates_PackageProjectUrl() public void MigratingProjectUrlPopulatesPackageProjectUrl()
{ {
var mockProj = RunPackOptionsRuleOnPj(@" var mockProj = RunPackOptionsRuleOnPj(@"
{ {
@ -113,7 +113,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
} }
[Fact] [Fact]
public void Migrating_LicenseUrl_populates_PackageLicenseUrl() public void MigratingLicenseUrlPopulatesPackageLicenseUrl()
{ {
var mockProj = RunPackOptionsRuleOnPj(@" var mockProj = RunPackOptionsRuleOnPj(@"
{ {
@ -128,7 +128,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
} }
[Fact] [Fact]
public void Migrating_RequireLicenseAcceptance_populates_PackageRequireLicenseAcceptance() public void MigratingRequireLicenseAcceptancePopulatesPackageRequireLicenseAcceptance()
{ {
var mockProj = RunPackOptionsRuleOnPj(@" var mockProj = RunPackOptionsRuleOnPj(@"
{ {
@ -142,7 +142,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
} }
[Fact] [Fact]
public void Migrating_RequireLicenseAcceptance_populates_PackageRequireLicenseAcceptance_even_if_its_value_is_false() public void MigratingRequireLicenseAcceptancePopulatesPackageRequireLicenseAcceptanceEvenIfItsValueIsFalse()
{ {
var mockProj = RunPackOptionsRuleOnPj(@" var mockProj = RunPackOptionsRuleOnPj(@"
{ {
@ -156,7 +156,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
} }
[Fact] [Fact]
public void Migrating_Repository_Type_populates_RepositoryType() public void MigratingRepositoryTypePopulatesRepositoryType()
{ {
var mockProj = RunPackOptionsRuleOnPj(@" var mockProj = RunPackOptionsRuleOnPj(@"
{ {
@ -172,7 +172,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
} }
[Fact] [Fact]
public void Migrating_Repository_Url_populates_RepositoryUrl() public void MigratingRepositoryUrlPopulatesRepositoryUrl()
{ {
var mockProj = RunPackOptionsRuleOnPj(@" var mockProj = RunPackOptionsRuleOnPj(@"
{ {
@ -188,7 +188,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
} }
[Fact] [Fact]
public void Migrating_Files_without_mappings_populates_content_with_same_path_as_include_and_pack_true() public void MigratingFilesWithoutMappingsPopulatesContentWithSamePathAsIncludeAndPackTrue()
{ {
var mockProj = RunPackOptionsRuleOnPj(@" var mockProj = RunPackOptionsRuleOnPj(@"
{ {
@ -200,15 +200,57 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}"); }");
var contentItems = mockProj.Items var contentItems = mockProj.Items
.Where(item => item.ItemType.Equals("Content", StringComparison.Ordinal)) .Where(item => item.ItemType.Equals("None", StringComparison.Ordinal))
.Where(item => item.GetMetadataWithName("Pack").Value == "true"); .Where(item => item.GetMetadataWithName("Pack").Value == "true");
contentItems.Count().Should().Be(1); contentItems.Count().Should().Be(1);
contentItems.First().Include.Should().Be(@"path\to\some\file.cs;path\to\some\other\file.cs"); contentItems.First().Update.Should().Be(@"path\to\some\file.cs;path\to\some\other\file.cs");
} }
[Fact] [Fact]
public void Migrating_Files_with_mappings_populates_content_PackagePath_metadata() public void MigratingFilesWithExcludePopulatesNoneWithPackFalseForTheExcludedFiles()
{
var mockProj = RunPackOptionsRuleOnPj(@"
{
""packOptions"": {
""files"": {
""include"": [""path/to/some/file.cs"", ""path/to/some/other/file.cs""],
""exclude"": [""path/to/file/to/exclude.cs""]
}
}
}");
foreach (var item in mockProj.Items.Where(i => i.ItemType.Equals("None", StringComparison.Ordinal)))
{
Console.WriteLine($"Update: {item.Update}, Include: {item.Include}, Remove: {item.Remove}");
foreach(var meta in item.Metadata)
{
Console.WriteLine($"\tMetadata: Name: {meta.Name}, Value: {meta.Value}");
}
foreach(var condition in item.ConditionChain())
{
Console.WriteLine($"\tCondition: {condition}");
}
}
var contentItemsToInclude = mockProj.Items
.Where(item => item.ItemType.Equals("None", StringComparison.Ordinal))
.Where(item => item.GetMetadataWithName("Pack").Value == "true");
contentItemsToInclude.Count().Should().Be(1);
contentItemsToInclude.First().Update.Should().Be(@"path\to\some\file.cs;path\to\some\other\file.cs");
var contentItemsToExclude = mockProj.Items
.Where(item => item.ItemType.Equals("None", StringComparison.Ordinal))
.Where(item => item.GetMetadataWithName("Pack").Value == "false");
contentItemsToExclude.Count().Should().Be(1);
contentItemsToExclude.First().Update.Should().Be(@"path\to\file\to\exclude.cs");
}
[Fact]
public void MigratingFilesWithMappingsPopulatesContentPackagePathMetadata()
{ {
var mockProj = RunPackOptionsRuleOnPj(@" var mockProj = RunPackOptionsRuleOnPj(@"
{ {
@ -223,19 +265,19 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}"); }");
var contentItems = mockProj.Items var contentItems = mockProj.Items
.Where(item => item.ItemType.Equals("Content", StringComparison.Ordinal)) .Where(item => item.ItemType.Equals("None", StringComparison.Ordinal))
.Where(item => .Where(item =>
item.GetMetadataWithName("Pack").Value == "true" && item.GetMetadataWithName("Pack").Value == "true" &&
item.GetMetadataWithName("PackagePath") != null); item.GetMetadataWithName("PackagePath") != null);
contentItems.Count().Should().Be(1); contentItems.Count().Should().Be(1);
contentItems.First().Include.Should().Be(@"path\to\some\file.cs"); contentItems.First().Update.Should().Be(@"path\to\some\file.cs");
contentItems.First().GetMetadataWithName("PackagePath").Value.Should().Be( contentItems.First().GetMetadataWithName("PackagePath").Value.Should().Be(
Path.Combine("some", "other", "path")); Path.Combine("some", "other", "path"));
} }
[Fact] [Fact]
public void Migrating_Files_with_mappings_to_root_populates_content_PackagePath_metadata_but_leaves_it_empty() public void MigratingFilesWithMappingsToRootPopulatesContentPackagePathMetadataButLeavesItEmpty()
{ {
var mockProj = RunPackOptionsRuleOnPj(@" var mockProj = RunPackOptionsRuleOnPj(@"
{ {
@ -250,18 +292,18 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}"); }");
var contentItems = mockProj.Items var contentItems = mockProj.Items
.Where(item => item.ItemType.Equals("Content", StringComparison.Ordinal)) .Where(item => item.ItemType.Equals("None", StringComparison.Ordinal))
.Where(item => .Where(item =>
item.GetMetadataWithName("Pack").Value == "true" && item.GetMetadataWithName("Pack").Value == "true" &&
item.GetMetadataWithName("PackagePath") != null); item.GetMetadataWithName("PackagePath") != null);
contentItems.Count().Should().Be(1); contentItems.Count().Should().Be(1);
contentItems.First().Include.Should().Be(@"path\to\some\file.cs"); contentItems.First().Update.Should().Be(@"path\to\some\file.cs");
contentItems.First().GetMetadataWithName("PackagePath").Value.Should().BeEmpty(); contentItems.First().GetMetadataWithName("PackagePath").Value.Should().BeEmpty();
} }
[Fact] [Fact]
public void Migrating_same_file_with_multiple_mappings_string_joins_the_mappings_in_PackagePath() public void MigratingSameFileWithMultipleMappingsStringJoinsTheMappingsInPackagePath()
{ {
var mockProj = RunPackOptionsRuleOnPj(@" var mockProj = RunPackOptionsRuleOnPj(@"
{ {
@ -284,13 +326,13 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}); });
var contentItems = mockProj.Items var contentItems = mockProj.Items
.Where(item => item.ItemType.Equals("Content", StringComparison.Ordinal)) .Where(item => item.ItemType.Equals("None", StringComparison.Ordinal))
.Where(item => .Where(item =>
item.GetMetadataWithName("Pack").Value == "true" && item.GetMetadataWithName("Pack").Value == "true" &&
item.GetMetadataWithName("PackagePath") != null); item.GetMetadataWithName("PackagePath") != null);
contentItems.Count().Should().Be(1); contentItems.Count().Should().Be(1);
contentItems.First().Include.Should().Be(@"path\to\some\file.cs"); contentItems.First().Update.Should().Be(@"path\to\some\file.cs");
contentItems.First().GetMetadataWithName("PackagePath").Value.Should().Be(expectedPackagePath); contentItems.First().GetMetadataWithName("PackagePath").Value.Should().Be(expectedPackagePath);
} }

View file

@ -414,7 +414,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
mockProj.Items.Should().NotContain( mockProj.Items.Should().NotContain(
i => i.Include == "Microsoft.NETCore.App" && i.ItemType == "PackageReference"); i => i.Include == "Microsoft.NETCore.App" && i.ItemType == "PackageReference");
mockProj.Properties.Should().ContainSingle(p => p.Name == "RuntimeFrameworkVersion").Which.Value.Should().Be("1.1.0"); mockProj.Properties.Should().ContainSingle(p => p.Name == "RuntimeFrameworkVersion").Which.Value.Should().Be("1.1.1");
} }
[Fact] [Fact]
@ -436,7 +436,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
mockProj.Items.Should().NotContain( mockProj.Items.Should().NotContain(
i => i.Include == "Microsoft.NETCore.App" && i.ItemType == "PackageReference"); i => i.Include == "Microsoft.NETCore.App" && i.ItemType == "PackageReference");
var runtimeFrameworkVersion = mockProj.Properties.Should().ContainSingle(p => p.Name == "RuntimeFrameworkVersion").Which; var runtimeFrameworkVersion = mockProj.Properties.Should().ContainSingle(p => p.Name == "RuntimeFrameworkVersion").Which;
runtimeFrameworkVersion.Value.Should().Be("1.1.0"); runtimeFrameworkVersion.Value.Should().Be("1.1.1");
runtimeFrameworkVersion.Condition.Should().Contain("netcoreapp1.0"); runtimeFrameworkVersion.Condition.Should().Contain("netcoreapp1.0");
} }
@ -457,7 +457,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
mockProj.Items.Should().NotContain( mockProj.Items.Should().NotContain(
i => i.Include == "Microsoft.NETCore.App" && i.ItemType == "PackageReference"); i => i.Include == "Microsoft.NETCore.App" && i.ItemType == "PackageReference");
var runtimeFrameworkVersion = mockProj.Properties.Should().ContainSingle(p => p.Name == "RuntimeFrameworkVersion").Which; var runtimeFrameworkVersion = mockProj.Properties.Should().ContainSingle(p => p.Name == "RuntimeFrameworkVersion").Which;
runtimeFrameworkVersion.Value.Should().Be("1.1.0"); runtimeFrameworkVersion.Value.Should().Be("1.1.1");
runtimeFrameworkVersion.Condition.Should().BeEmpty(); runtimeFrameworkVersion.Condition.Should().BeEmpty();
} }

View file

@ -9,11 +9,13 @@ using System;
namespace Microsoft.DotNet.ProjectJsonMigration.Tests namespace Microsoft.DotNet.ProjectJsonMigration.Tests
{ {
public class GivenThatIWantToMigratePackagesToTheirLTSVersions : PackageDependenciesTestBase public class GivenThatIWantToMigratePackagesToTheirLTSAndFTSVersions : PackageDependenciesTestBase
{ {
[Theory] [Theory]
[InlineData("1.0.0", "1.0.3")] [InlineData("1.0.0", "1.0.4")]
[InlineData("1.0.3-preview2", "1.0.3")] [InlineData("1.0.3-preview2", "1.0.4")]
[InlineData("1.1.0", "1.1.1")]
[InlineData("1.1.1-preview2", "1.1.1")]
public void ItUpliftsMicrosoftNETCoreAppMetaPackages( public void ItUpliftsMicrosoftNETCoreAppMetaPackages(
string sourceVersion, string sourceVersion,
string targetVersion) string targetVersion)
@ -74,6 +76,25 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
[InlineData("Microsoft.AspNetCore.Routing.Abstractions", "1.0.0", "Microsoft.AspNetCore.Routing.Abstractions", ConstantPackageVersions.AspNetLTSPackagesVersion)] [InlineData("Microsoft.AspNetCore.Routing.Abstractions", "1.0.0", "Microsoft.AspNetCore.Routing.Abstractions", ConstantPackageVersions.AspNetLTSPackagesVersion)]
[InlineData("Microsoft.AspNetCore.Server.Kestrel", "1.0.0", "Microsoft.AspNetCore.Server.Kestrel", ConstantPackageVersions.AspNetLTSPackagesVersion)] [InlineData("Microsoft.AspNetCore.Server.Kestrel", "1.0.0", "Microsoft.AspNetCore.Server.Kestrel", ConstantPackageVersions.AspNetLTSPackagesVersion)]
[InlineData("Microsoft.AspNetCore.Server.Kestrel.Https", "1.0.0", "Microsoft.AspNetCore.Server.Kestrel.Https", ConstantPackageVersions.AspNetLTSPackagesVersion)] [InlineData("Microsoft.AspNetCore.Server.Kestrel.Https", "1.0.0", "Microsoft.AspNetCore.Server.Kestrel.Https", ConstantPackageVersions.AspNetLTSPackagesVersion)]
[InlineData("Microsoft.AspNetCore.Antiforgery", "1.1.0", "Microsoft.AspNetCore.Antiforgery", "1.1.1")]
[InlineData("Microsoft.AspNetCore.Mvc", "1.1.0", "Microsoft.AspNetCore.Mvc", "1.1.2")]
[InlineData("Microsoft.AspNetCore.Mvc.Abstractions", "1.1.0", "Microsoft.AspNetCore.Mvc.Abstractions", "1.1.2")]
[InlineData("Microsoft.AspNetCore.Mvc.ApiExplorer", "1.1.0", "Microsoft.AspNetCore.Mvc.ApiExplorer", "1.1.2")]
[InlineData("Microsoft.AspNetCore.Mvc.Core", "1.1.0", "Microsoft.AspNetCore.Mvc.Core", "1.1.2")]
[InlineData("Microsoft.AspNetCore.Mvc.Cors", "1.1.0", "Microsoft.AspNetCore.Mvc.Cors", "1.1.2")]
[InlineData("Microsoft.AspNetCore.Mvc.DataAnnotations", "1.1.0", "Microsoft.AspNetCore.Mvc.DataAnnotations", "1.1.2")]
[InlineData("Microsoft.AspNetCore.Mvc.Formatters.Json", "1.1.0", "Microsoft.AspNetCore.Mvc.Formatters.Json", "1.1.2")]
[InlineData("Microsoft.AspNetCore.Mvc.Formatters.Xml", "1.1.0", "Microsoft.AspNetCore.Mvc.Formatters.Xml", "1.1.2")]
[InlineData("Microsoft.AspNetCore.Mvc.Localization", "1.1.0", "Microsoft.AspNetCore.Mvc.Localization", "1.1.2")]
[InlineData("Microsoft.AspNetCore.Mvc.Razor", "1.1.0", "Microsoft.AspNetCore.Mvc.Razor", "1.1.2")]
[InlineData("Microsoft.AspNetCore.Mvc.Razor.Host", "1.1.0", "Microsoft.AspNetCore.Mvc.Razor.Host", "1.1.2")]
[InlineData("Microsoft.AspNetCore.Mvc.TagHelpers", "1.1.0", "Microsoft.AspNetCore.Mvc.TagHelpers", "1.1.2")]
[InlineData("Microsoft.AspNetCore.Mvc.ViewFeatures", "1.1.0", "Microsoft.AspNetCore.Mvc.ViewFeatures", "1.1.2")]
[InlineData("Microsoft.AspNetCore.Mvc.WebApiCompatShim", "1.1.0", "Microsoft.AspNetCore.Mvc.WebApiCompatShim", "1.1.2")]
[InlineData("Microsoft.AspNetCore.Routing", "1.1.0", "Microsoft.AspNetCore.Routing", "1.1.1")]
[InlineData("Microsoft.AspNetCore.Routing.Abstractions", "1.1.0", "Microsoft.AspNetCore.Routing.Abstractions", "1.1.1")]
[InlineData("Microsoft.AspNetCore.Server.Kestrel", "1.1.0", "Microsoft.AspNetCore.Server.Kestrel", "1.1.1")]
[InlineData("Microsoft.AspNetCore.Server.Kestrel.Https", "1.1.0", "Microsoft.AspNetCore.Server.Kestrel.Https", "1.1.1")]
public void ItUpliftsAspNetCorePackages( public void ItUpliftsAspNetCorePackages(
string sourcePackageName, string sourcePackageName,
string sourceVersion, string sourceVersion,
@ -92,6 +113,14 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
[InlineData("Microsoft.EntityFrameworkCore.Sqlite.Design", "1.0.0", "Microsoft.EntityFrameworkCore.Sqlite.Design", ConstantPackageVersions.EntityFrameworkLTSPackagesVersion)] [InlineData("Microsoft.EntityFrameworkCore.Sqlite.Design", "1.0.0", "Microsoft.EntityFrameworkCore.Sqlite.Design", ConstantPackageVersions.EntityFrameworkLTSPackagesVersion)]
[InlineData("Microsoft.EntityFrameworkCore.SqlServer", "1.0.0", "Microsoft.EntityFrameworkCore.SqlServer", ConstantPackageVersions.EntityFrameworkLTSPackagesVersion)] [InlineData("Microsoft.EntityFrameworkCore.SqlServer", "1.0.0", "Microsoft.EntityFrameworkCore.SqlServer", ConstantPackageVersions.EntityFrameworkLTSPackagesVersion)]
[InlineData("Microsoft.EntityFrameworkCore.SqlServer.Design", "1.0.0", "Microsoft.EntityFrameworkCore.SqlServer.Design", ConstantPackageVersions.EntityFrameworkLTSPackagesVersion)] [InlineData("Microsoft.EntityFrameworkCore.SqlServer.Design", "1.0.0", "Microsoft.EntityFrameworkCore.SqlServer.Design", ConstantPackageVersions.EntityFrameworkLTSPackagesVersion)]
[InlineData("Microsoft.EntityFrameworkCore", "1.1.0", "Microsoft.EntityFrameworkCore", "1.1.1")]
[InlineData("Microsoft.EntityFrameworkCore.InMemory", "1.1.0", "Microsoft.EntityFrameworkCore.InMemory", "1.1.1")]
[InlineData("Microsoft.EntityFrameworkCore.Relational", "1.1.0", "Microsoft.EntityFrameworkCore.Relational", "1.1.1")]
[InlineData("Microsoft.EntityFrameworkCore.Relational.Design", "1.1.0", "Microsoft.EntityFrameworkCore.Relational.Design", "1.1.1")]
[InlineData("Microsoft.EntityFrameworkCore.Sqlite", "1.1.0", "Microsoft.EntityFrameworkCore.Sqlite", "1.1.1")]
[InlineData("Microsoft.EntityFrameworkCore.Sqlite.Design", "1.1.0", "Microsoft.EntityFrameworkCore.Sqlite.Design", "1.1.1")]
[InlineData("Microsoft.EntityFrameworkCore.SqlServer", "1.1.0", "Microsoft.EntityFrameworkCore.SqlServer", "1.1.1")]
[InlineData("Microsoft.EntityFrameworkCore.SqlServer.Design", "1.1.0", "Microsoft.EntityFrameworkCore.SqlServer.Design", "1.1.1")]
public void ItUpliftsEntityFrameworkCorePackages( public void ItUpliftsEntityFrameworkCorePackages(
string sourcePackageName, string sourcePackageName,
string sourceVersion, string sourceVersion,
@ -228,11 +257,17 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
} }
[Theory] [Theory]
[InlineData("Microsoft.Extensions.Logging", "1.0.0", "Microsoft.Extensions.Logging", "1.0.1")] [InlineData("Microsoft.Extensions.Logging", "1.0.0", "Microsoft.Extensions.Logging", "1.0.2")]
[InlineData("Microsoft.Extensions.Logging.Console", "1.0.0", "Microsoft.Extensions.Logging.Console", "1.0.1")] [InlineData("Microsoft.Extensions.Logging.Console", "1.0.0", "Microsoft.Extensions.Logging.Console", "1.0.2")]
[InlineData("Microsoft.Extensions.Logging.Debug", "1.0.0", "Microsoft.Extensions.Logging.Debug", "1.0.1")] [InlineData("Microsoft.Extensions.Logging.Debug", "1.0.0", "Microsoft.Extensions.Logging.Debug", "1.0.2")]
[InlineData("Microsoft.Extensions.Configuration.Json", "1.0.0", "Microsoft.Extensions.Configuration.Json", "1.0.1")] [InlineData("Microsoft.Extensions.Configuration.Json", "1.0.0", "Microsoft.Extensions.Configuration.Json", "1.0.2")]
[InlineData("Microsoft.Extensions.Configuration.UserSecrets", "1.0.0", "Microsoft.Extensions.Configuration.UserSecrets", "1.0.1")] [InlineData("Microsoft.Extensions.Configuration.UserSecrets", "1.0.0", "Microsoft.Extensions.Configuration.UserSecrets", "1.0.2")]
[InlineData("Microsoft.Extensions.Logging", "1.1.0", "Microsoft.Extensions.Logging", "1.1.1")]
[InlineData("Microsoft.Extensions.Logging.Console", "1.1.0", "Microsoft.Extensions.Logging.Console", "1.1.1")]
[InlineData("Microsoft.Extensions.Logging.Debug", "1.1.0", "Microsoft.Extensions.Logging.Debug", "1.1.1")]
[InlineData("Microsoft.Extensions.Configuration.Json", "1.1.0", "Microsoft.Extensions.Configuration.Json", "1.1.1")]
[InlineData("Microsoft.Extensions.Configuration.UserSecrets", "1.1.0", "Microsoft.Extensions.Configuration.UserSecrets", "1.1.1")]
[InlineData("Microsoft.Extensions.Logging.AzureAppServices", "1.0.0-preview2", "Microsoft.Extensions.Logging.AzureAppServices", "1.0.1")]
public void ItUpliftsMicrosoftExtensionsPackages( public void ItUpliftsMicrosoftExtensionsPackages(
string sourcePackageName, string sourcePackageName,
string sourceVersion, string sourceVersion,

View file

@ -32,24 +32,39 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}", }",
testDirectory: testDirectory); testDirectory: testDirectory);
mockProj.Items.Count(i => i.ItemType.Equals("Content", StringComparison.Ordinal)).Should().Be(2); mockProj.Items.Count(i => i.ItemType.Equals("None", StringComparison.Ordinal)).Should().Be(4);
foreach (var item in mockProj.Items.Where(i => i.ItemType.Equals("Content", StringComparison.Ordinal))) foreach (var item in mockProj.Items.Where(i => i.ItemType.Equals("None", StringComparison.Ordinal)))
{ {
item.Metadata.Count(m => m.Name == "CopyToPublishDirectory").Should().Be(1); item.Metadata.Count(m => m.Name == "CopyToPublishDirectory").Should().Be(1);
if (item.Include.Contains(@"src\file1.cs")) if (item.Update.Contains(@"src\file1.cs"))
{ {
item.Include.Should().Be(@"src\file1.cs;src\file2.cs"); item.Update.Should().Be(@"src\file1.cs");
item.Exclude.Should().Be(@"src\file2.cs"); item.Exclude.Should().BeEmpty();
item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "PreserveNewest").Should().Be(1);
}
else if (item.Update.Contains(@"src\file2.cs"))
{
item.Update.Should().Be(@"src\file2.cs");
item.Exclude.Should().BeEmpty();
item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "Never").Should().Be(1);
}
else if (item.Update.Contains(@"root\**\*"))
{
item.Update.Should().Be(@"root\**\*");
item.Exclude.Should().BeEmpty();
item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "PreserveNewest").Should().Be(1);
} }
else else
{ {
item.Include.Should() item.Update.Should().Be(@"src\**\*;rootfile.cs");
.Be(@"root\**\*;src\**\*;rootfile.cs"); item.Exclude.Should().BeEmpty();
item.Metadata.Count(m =>
item.Exclude.Should() m.Name == "CopyToPublishDirectory" && m.Value == "Never").Should().Be(1);
.Be(@"src\**\*;rootfile.cs;src\file2.cs");
} }
} }
} }
@ -82,21 +97,39 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}", }",
testDirectory: testDirectory); testDirectory: testDirectory);
mockProj.Items.Count(i => i.ItemType.Equals("Content", StringComparison.Ordinal)).Should().Be(2); mockProj.Items.Count(i => i.ItemType.Equals("None", StringComparison.Ordinal)).Should().Be(4);
foreach (var item in mockProj.Items.Where(i => i.ItemType.Equals("Content", StringComparison.Ordinal))) foreach (var item in mockProj.Items.Where(i => i.ItemType.Equals("None", StringComparison.Ordinal)))
{ {
item.Metadata.Count(m => m.Name == "CopyToPublishDirectory").Should().Be(1); item.Metadata.Count(m => m.Name == "CopyToPublishDirectory").Should().Be(1);
if (item.Update.Contains(@"src\file1.cs")) if (item.Update.Contains(@"src\file1.cs"))
{ {
item.Update.Should().Be(@"src\file1.cs;src\file2.cs"); item.Update.Should().Be(@"src\file1.cs");
item.Exclude.Should().BeEmpty(); item.Exclude.Should().BeEmpty();
item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "PreserveNewest").Should().Be(1);
}
else if (item.Update.Contains(@"src\file2.cs"))
{
item.Update.Should().Be(@"src\file2.cs");
item.Exclude.Should().BeEmpty();
item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "Never").Should().Be(1);
}
else if (item.Update.Contains(@"root\**\*"))
{
item.Update.Should().Be(@"root\**\*");
item.Exclude.Should().BeEmpty();
item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "PreserveNewest").Should().Be(1);
} }
else else
{ {
item.Update.Should().Be(@"root\**\*;src\**\*;rootfile.cs"); item.Update.Should().Be(@"src\**\*;rootfile.cs");
item.Exclude.Should().BeEmpty(); item.Exclude.Should().BeEmpty();
item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "Never").Should().Be(1);
} }
} }
} }
@ -126,31 +159,46 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}", }",
testDirectory: testDirectory); testDirectory: testDirectory);
mockProj.Items.Count(i => i.ItemType.Equals("Content", StringComparison.Ordinal)).Should().Be(3); mockProj.Items.Count(i => i.ItemType.Equals("None", StringComparison.Ordinal)).Should().Be(5);
// From ProjectReader #L725 (Both are empty) foreach (var item in mockProj.Items.Where(i => i.ItemType.Equals("None", StringComparison.Ordinal)))
var defaultIncludePatterns = Enumerable.Empty<string>();
var defaultExcludePatterns = Enumerable.Empty<string>();
foreach (var item in mockProj.Items.Where(i => i.ItemType.Equals("Content", StringComparison.Ordinal)))
{ {
if (item.Include.Contains(@"root\**\*")) if (item.Update.Contains(@"root\**\*"))
{ {
item.Include.Should().Be(@"root\**\*"); item.Update.Should().Be(@"root\**\*");
item.Exclude.Should().Be(@"src\**\*;rootfile.cs;src\file3.cs"); item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "PreserveNewest").Should().Be(1);
} }
else if (item.Include.Contains(@"src\file1.cs")) else if (item.Update.Contains(@"src\file1.cs"))
{ {
item.Include.Should().Be(@"src\file1.cs;src\file2.cs"); item.Update.Should().Be(@"src\file1.cs");
item.Exclude.Should().Be(@"src\file2.cs;src\file3.cs"); item.Metadata.Count(m =>
m.Name == "CopyToOutputDirectory" && m.Value == "PreserveNewest").Should().Be(1);
item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "PreserveNewest").Should().Be(1);
}
else if (item.Update.Contains(@"src\file2.cs"))
{
item.Update.Should().Be(@"src\file2.cs");
item.Metadata.Count(m =>
m.Name == "CopyToOutputDirectory" && m.Value == "Never").Should().Be(1);
item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "PreserveNewest").Should().Be(1);
}
else if (item.Update.Contains(@"src\file3.cs"))
{
item.Update.Should().Be(@"src\file3.cs");
item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "Never").Should().Be(1);
} }
else else
{ {
item.Include.Should() item.Update.Should()
.Be(@"src\**\*;rootfile.cs"); .Be(@"src\**\*;rootfile.cs");
item.Metadata.Count(m =>
item.Exclude.Should() m.Name == "CopyToOutputDirectory" && m.Value == "Never").Should().Be(1);
.Be(@"src\**\*;rootfile.cs;src\file2.cs;src\file3.cs"); item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "Never").Should().Be(1);
} }
} }
} }
@ -189,35 +237,84 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}", }",
testDirectory: testDirectory); testDirectory: testDirectory);
mockProj.Items.Count(i => i.ItemType.Equals("Content", StringComparison.Ordinal)).Should().Be(4); mockProj.Items.Count(i => i.ItemType.Equals("None", StringComparison.Ordinal)).Should().Be(5);
// From ProjectReader #L725 (Both are empty) // From ProjectReader #L725 (Both are empty)
var defaultIncludePatterns = Enumerable.Empty<string>(); var defaultIncludePatterns = Enumerable.Empty<string>();
var defaultExcludePatterns = Enumerable.Empty<string>(); var defaultExcludePatterns = Enumerable.Empty<string>();
foreach (var item in mockProj.Items.Where(i => i.ItemType.Equals("Content", StringComparison.Ordinal))) foreach (var item in mockProj.Items.Where(i => i.ItemType.Equals("None", StringComparison.Ordinal)))
{ {
var metadata = string.Join(",", item.Metadata.Select(m => m.Name)); var metadata = string.Join(",", item.Metadata.Select(m => m.Name));
Console.WriteLine($"LICAVALC: Update: {item.Update}, Include: {item.Include}, Metadata: {metadata}");
if (item.Update.Contains(@"root\**\*")) if (item.Update.Contains(@"root\**\*"))
{ {
item.Update.Should().Be(@"root\**\*;src\**\*;rootfile.cs"); item.Update.Should().Be(@"root\**\*");
item.Exclude.Should().BeEmpty(); item.Exclude.Should().BeEmpty();
item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "PreserveNewest").Should().Be(1);
} }
else if (item.Update.Contains(@"src\file1.cs")) else if (item.Update.Contains(@"src\file1.cs"))
{ {
item.Update.Should().Be(@"src\file1.cs;src\file2.cs"); item.Update.Should().Be(@"src\file1.cs");
item.Exclude.Should().BeEmpty(); item.Exclude.Should().BeEmpty();
item.Metadata.Count(m =>
m.Name == "CopyToOutputDirectory" && m.Value == "PreserveNewest").Should().Be(1);
item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "PreserveNewest").Should().Be(1);
}
else if (item.Update.Contains(@"src\file2.cs"))
{
item.Update.Should().Be(@"src\file2.cs");
item.Exclude.Should().BeEmpty();
item.Metadata.Count(m =>
m.Name == "CopyToOutputDirectory" && m.Value == "Never").Should().Be(1);
item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "PreserveNewest").Should().Be(1);
}
else if (item.Update.Contains(@"src\file3.cs"))
{
item.Update.Should().Be(@"src\file3.cs");
item.Exclude.Should().BeEmpty();
item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "Never").Should().Be(1);
} }
else else
{ {
item.Update.Should().Be(@"src\**\*;rootfile.cs"); item.Update.Should().Be(@"src\**\*;rootfile.cs");
item.Exclude.Should().BeEmpty(); item.Exclude.Should().BeEmpty();
item.Metadata.Count(m =>
m.Name == "CopyToOutputDirectory" && m.Value == "Never").Should().Be(1);
item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "Never").Should().Be(1);
} }
} }
} }
[Fact]
public void ExcludedPatternsAreNotEmittedOnNoneWhenBuildingAWebProject()
{
var mockProj = RunPublishOptionsRuleOnPj(@"
{
""buildOptions"": {
""emitEntryPoint"": true
},
""publishOptions"": {
""include"": [""wwwroot"", ""**/*.cshtml"", ""appsettings.json"", ""web.config""],
},
""dependencies"": {
""Microsoft.AspNetCore.Mvc"" : {
""version"": ""1.0.0""
}
},
""frameworks"": {
""netcoreapp1.0"": {}
}
}");
mockProj.Items.Count(i => i.ItemType.Equals("None", StringComparison.Ordinal)).Should().Be(0);
}
private void WriteFilesInProjectDirectory(string testDirectory) private void WriteFilesInProjectDirectory(string testDirectory)
{ {
Directory.CreateDirectory(Path.Combine(testDirectory, "root")); Directory.CreateDirectory(Path.Combine(testDirectory, "root"));

View file

@ -69,7 +69,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
} }
[Fact] [Fact]
public void MigratingCoreAndDesktopTFMsAddsAllRuntimeIdentifiersIfTheProjectDoesNothaveAnyAlready() public void MigratingCoreAndDesktopTFMsDoesNoAddRuntimeIdentifiersOrRuntimeIdentifierWhenTheProjectDoesNothaveAnyAlready()
{ {
var testDirectory = Temp.CreateDirectory().Path; var testDirectory = Temp.CreateDirectory().Path;
var testPJ = new ProjectJsonBuilder(TestAssets) var testPJ = new ProjectJsonBuilder(TestAssets)
@ -88,35 +88,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
new MigrateTFMRule().Apply(migrationSettings, migrationInputs); new MigrateTFMRule().Apply(migrationSettings, migrationInputs);
mockProj.Properties.Count(p => p.Name == "RuntimeIdentifiers").Should().Be(1); mockProj.Properties.Count(p => p.Name == "RuntimeIdentifiers").Should().Be(0);
mockProj.Properties.First(p => p.Name == "RuntimeIdentifiers") mockProj.Properties.Count(p => p.Name == "RuntimeIdentifier").Should().Be(0);
.Value.Should().Be("win7-x64;win7-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");
}
[Fact]
public void MigratingCoreAndDesktopTFMsAddsRuntimeIdentifierWithWin7x86ConditionOnAllFullFrameworksWhenNoRuntimesExistAlready()
{
var testDirectory = Temp.CreateDirectory().Path;
var testPJ = new ProjectJsonBuilder(TestAssets)
.FromTestAssetBase("PJAppWithMultipleFrameworks")
.SaveToDisk(testDirectory);
var projectContexts = ProjectContext.CreateContextForEachFramework(testDirectory);
var mockProj = ProjectRootElement.Create();
var migrationSettings = MigrationSettings.CreateMigrationSettingsTestHook(testDirectory, testDirectory, mockProj);
var migrationInputs = new MigrationRuleInputs(
projectContexts,
mockProj,
mockProj.AddItemGroup(),
mockProj.AddPropertyGroup());
new MigrateTFMRule().Apply(migrationSettings, migrationInputs);
mockProj.Properties.Count(p => p.Name == "RuntimeIdentifier").Should().Be(1);
var runtimeIdentifier = mockProj.Properties.First(p => p.Name == "RuntimeIdentifier");
runtimeIdentifier.Value.Should().Be("win7-x86");
runtimeIdentifier.Condition.Should().Be(" '$(TargetFramework)' == 'net20' OR '$(TargetFramework)' == 'net35' OR '$(TargetFramework)' == 'net40' OR '$(TargetFramework)' == 'net461' ");
} }
[Fact] [Fact]
@ -144,7 +117,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
} }
[Fact] [Fact]
public void MigratingProjectWithFullFrameworkTFMsOnlyAddsARuntimeIdentifierWin7x86WhenNoRuntimesExistAlready() public void MigratingProjectWithFullFrameworkTFMsDoesNotAddRuntimeIdentifiersOrRuntimeIdentiferWhenNoRuntimesExistAlready()
{ {
var testDirectory = Temp.CreateDirectory().Path; var testDirectory = Temp.CreateDirectory().Path;
var testPJ = new ProjectJsonBuilder(TestAssets) var testPJ = new ProjectJsonBuilder(TestAssets)
@ -165,8 +138,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
new MigrateTFMRule().Apply(migrationSettings, migrationInputs); new MigrateTFMRule().Apply(migrationSettings, migrationInputs);
mockProj.Properties.Count(p => p.Name == "RuntimeIdentifiers").Should().Be(0); mockProj.Properties.Count(p => p.Name == "RuntimeIdentifiers").Should().Be(0);
mockProj.Properties.Where(p => p.Name == "RuntimeIdentifier").Should().HaveCount(1); mockProj.Properties.Where(p => p.Name == "RuntimeIdentifier").Should().HaveCount(0);
mockProj.Properties.Single(p => p.Name == "RuntimeIdentifier").Value.Should().Be("win7-x86");
} }
[Fact] [Fact]

View file

@ -19,6 +19,10 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
[InlineData("Microsoft.VisualStudio.Web.CodeGenerators.Mvc", "1.0.0-preview3-final", "Microsoft.VisualStudio.Web.CodeGeneration.Design", ConstantPackageVersions.AspNetToolsVersion)] [InlineData("Microsoft.VisualStudio.Web.CodeGenerators.Mvc", "1.0.0-preview3-final", "Microsoft.VisualStudio.Web.CodeGeneration.Design", ConstantPackageVersions.AspNetToolsVersion)]
[InlineData("Microsoft.VisualStudio.Web.CodeGenerators.Mvc", "1.1.0-preview4-final", "Microsoft.VisualStudio.Web.CodeGeneration.Design", ConstantPackageVersions.AspNet110ToolsVersion)] [InlineData("Microsoft.VisualStudio.Web.CodeGenerators.Mvc", "1.1.0-preview4-final", "Microsoft.VisualStudio.Web.CodeGeneration.Design", ConstantPackageVersions.AspNet110ToolsVersion)]
[InlineData("Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design", "1.1.0-preview4-final", "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation", ConstantPackageVersions.AspNet110ToolsVersion)] [InlineData("Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design", "1.1.0-preview4-final", "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation", ConstantPackageVersions.AspNet110ToolsVersion)]
[InlineData("Microsoft.VisualStudio.Web.BrowserLink.Loader", "14.0.0-preview2-final", "Microsoft.VisualStudio.Web.BrowserLink", "1.0.1")]
[InlineData("Microsoft.VisualStudio.Web.BrowserLink.Loader", "14.0.0-*", "Microsoft.VisualStudio.Web.BrowserLink", "1.0.1")]
[InlineData("Microsoft.VisualStudio.Web.BrowserLink.Loader", "14.0.1", "Microsoft.VisualStudio.Web.BrowserLink", "1.0.1")]
[InlineData("Microsoft.VisualStudio.Web.BrowserLink.Loader", "14.1.0-preview4-final", "Microsoft.VisualStudio.Web.BrowserLink", "1.1.0")]
public void ItMigratesProjectDependenciesToANewNameAndVersion( public void ItMigratesProjectDependenciesToANewNameAndVersion(
string sourceToolName, string sourceToolName,
string sourceVersion, string sourceVersion,

View file

@ -0,0 +1,27 @@
// 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.PlatformAbstractions;
namespace Microsoft.DotNet.Tools.Test.Utilities
{
public static class EnvironmentInfo
{
public static bool HasSharedFramework(string framework)
{
if (framework == "netcoreapp1.0")
{
string rid = RuntimeEnvironment.GetRuntimeIdentifier();
switch (rid)
{
case "fedora.24-x64":
case "opensuse.42.1-x64":
case "ubuntu.16.10-x64":
return false;
}
}
return true;
}
}
}

View file

@ -0,0 +1,18 @@
// 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 Xunit;
namespace Microsoft.DotNet.Tools.Test.Utilities
{
public class RequiresSpecificFrameworkFactAttribute : FactAttribute
{
public RequiresSpecificFrameworkFactAttribute(string framework)
{
if (!EnvironmentInfo.HasSharedFramework(framework))
{
this.Skip = $"This test requires a shared framework that isn't present: {framework}";
}
}
}
}

View file

@ -19,6 +19,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
{ {
protected const string DefaultFramework = "netcoreapp1.0"; protected const string DefaultFramework = "netcoreapp1.0";
protected const string DefaultLibraryFramework = "netstandard1.5"; protected const string DefaultLibraryFramework = "netstandard1.5";
protected const string ConsoleLoggerOutputNormal = "--logger:console;verbosity=normal";
private TempRoot _temp; private TempRoot _temp;
private static TestAssets s_testAssets; private static TestAssets s_testAssets;

View file

@ -28,7 +28,7 @@ namespace Microsoft.DotNet.Cli.Build.Tests
var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug"; var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
var outputDll = testInstance.Root.GetDirectory("bin", configuration, "netcoreapp1.0") var outputDll = testInstance.Root.GetDirectory("bin", configuration, "netcoreapp1.1")
.GetFile($"{testAppName}.dll"); .GetFile($"{testAppName}.dll");
var outputRunCommand = new TestCommand("dotnet"); var outputRunCommand = new TestCommand("dotnet");
@ -46,7 +46,7 @@ namespace Microsoft.DotNet.Cli.Build.Tests
string dir = "pkgs"; string dir = "pkgs";
string args = $"--packages {dir}"; string args = $"--packages {dir}";
string newArgs = $"console -o \"{rootPath}\" --debug:ephemeral-hive"; string newArgs = $"console -f netcoreapp1.1 -o \"{rootPath}\" --debug:ephemeral-hive";
new NewCommandShim() new NewCommandShim()
.WithWorkingDirectory(rootPath) .WithWorkingDirectory(rootPath)
.Execute(newArgs) .Execute(newArgs)
@ -65,7 +65,12 @@ namespace Microsoft.DotNet.Cli.Build.Tests
.Execute() .Execute()
.Should().Pass(); .Should().Pass();
var outputDll = Directory.EnumerateFiles(Path.Combine(rootPath, "bin"), "*.dll", SearchOption.AllDirectories).Single(); var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
var outputDll = Directory.EnumerateFiles(
Path.Combine(rootPath, "bin", configuration, "netcoreapp1.1"), "*.dll",
SearchOption.TopDirectoryOnly)
.Single();
var outputRunCommand = new TestCommand("dotnet"); var outputRunCommand = new TestCommand("dotnet");

View file

@ -0,0 +1,127 @@
// 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.Build.Construction;
using Microsoft.DotNet.TestFramework;
using Microsoft.DotNet.Tools.Common;
using Microsoft.DotNet.Tools.Test.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;
using Xunit;
using FluentAssertions;
using System.IO;
using Microsoft.DotNet.Tools.Migrate;
using BuildCommand = Microsoft.DotNet.Tools.Test.Utilities.BuildCommand;
using System.Runtime.Loader;
using Newtonsoft.Json.Linq;
using MigrateCommand = Microsoft.DotNet.Tools.Migrate.MigrateCommand;
namespace Microsoft.DotNet.Migration.Tests
{
public class GivenThatIWantMigratedAppsToBinplaceContent : TestBase
{
[Fact(Skip="Unblocking CI")]
public void ItBinplacesContentOnBuildForConsoleApps()
{
var projectDirectory = TestAssets
.GetProjectJson("TestAppWithContents")
.CreateInstance()
.WithSourceFiles()
.WithRestoreFiles()
.WithEmptyGlobalJson()
.Root;
new TestCommand("dotnet")
.WithForwardingToConsole()
.Execute($"migrate {projectDirectory.FullName}")
.Should()
.Pass();
var command = new RestoreCommand()
.WithWorkingDirectory(projectDirectory)
.Execute()
.Should()
.Pass();
var result = new BuildCommand()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput()
.Should()
.Pass();
var outputDir = projectDirectory.GetDirectory("bin", "Debug", "netcoreapp1.0");
outputDir.Should().Exist().And.HaveFile("testcontentfile.txt");
outputDir.GetDirectory("dir").Should().Exist().And.HaveFile("mappingfile.txt");
}
[Fact(Skip="Unblocking CI")]
public void ItBinplacesContentOnPublishForConsoleApps()
{
var projectDirectory = TestAssets
.GetProjectJson("TestAppWithContents")
.CreateInstance()
.WithSourceFiles()
.WithRestoreFiles()
.WithEmptyGlobalJson()
.Root;
new TestCommand("dotnet")
.WithForwardingToConsole()
.Execute($"migrate {projectDirectory.FullName}")
.Should()
.Pass();
var command = new RestoreCommand()
.WithWorkingDirectory(projectDirectory)
.Execute()
.Should()
.Pass();
var result = new PublishCommand()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput()
.Should()
.Pass();
var publishDir = projectDirectory.GetDirectory("bin", "Debug", "netcoreapp1.0", "publish");
publishDir.Should().Exist().And.HaveFile("testcontentfile.txt");
publishDir.GetDirectory("dir").Should().Exist().And.HaveFile("mappingfile.txt");
}
[Fact(Skip="CI does not have NPM, which is required for the publish of this app.")]
public void ItBinplacesContentOnPublishForWebApps()
{
var projectDirectory = TestAssets
.GetProjectJson("ProjectJsonWebTemplate")
.CreateInstance()
.WithSourceFiles()
.WithRestoreFiles()
.WithEmptyGlobalJson()
.Root;
new TestCommand("dotnet")
.WithForwardingToConsole()
.Execute($"migrate {projectDirectory.FullName}")
.Should()
.Pass();
var command = new RestoreCommand()
.WithWorkingDirectory(projectDirectory)
.Execute()
.Should()
.Pass();
var result = new PublishCommand()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput()
.Should()
.Pass();
var publishDir = projectDirectory.GetDirectory("bin", "Debug", "netcoreapp1.0", "publish");
publishDir.Should().Exist().And.HaveFile("README.md");
publishDir.GetDirectory("wwwroot").Should().Exist();
}
}
}

View file

@ -0,0 +1,62 @@
// 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.Build.Construction;
using Microsoft.DotNet.TestFramework;
using Microsoft.DotNet.Tools.Common;
using Microsoft.DotNet.Tools.Test.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;
using Xunit;
using FluentAssertions;
using System.IO;
using System.IO.Compression;
using Microsoft.DotNet.Tools.Migrate;
using BuildCommand = Microsoft.DotNet.Tools.Test.Utilities.BuildCommand;
using System.Runtime.Loader;
using Newtonsoft.Json.Linq;
using MigrateCommand = Microsoft.DotNet.Tools.Migrate.MigrateCommand;
namespace Microsoft.DotNet.Migration.Tests
{
public class GivenThatIWantMigratedAppsToPackContent : TestBase
{
[Fact(Skip="Unblocking CI")]
public void ItPacksContentForLibraries()
{
var projectDirectory = TestAssets
.GetProjectJson("PJTestLibraryWithConfiguration")
.CreateInstance()
.WithSourceFiles()
.WithRestoreFiles()
.WithEmptyGlobalJson()
.Root;
new TestCommand("dotnet")
.WithForwardingToConsole()
.Execute($"migrate {projectDirectory.FullName}")
.Should()
.Pass();
var command = new RestoreCommand()
.WithWorkingDirectory(projectDirectory)
.Execute()
.Should()
.Pass();
var result = new PackCommand()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput()
.Should()
.Pass();
using (var archive = ZipFile.OpenRead(
Path.Combine(projectDirectory.FullName, "bin", "debug", "PJTestLibraryWithConfiguration.1.0.0.nupkg")))
{
archive.Entries.Select(e => e.FullName).Should().Contain("dir/contentitem.txt");
}
}
}
}

View file

@ -224,10 +224,10 @@ namespace Microsoft.DotNet.Migration.Tests
outputDir.Should().Exist() outputDir.Should().Exist()
.And.HaveFiles(new[] .And.HaveFiles(new[]
{ {
"ContentFile1.txt", "ContentFile1.txt1",
"ContentFile2.txt", "ContentFile2.txt1",
"ContentFileBuiltIn1.txt", "ContentFileBuiltIn1.txt1",
"ContentFileBuiltIn2.txt", "ContentFileBuiltIn2.txt1",
"IncludeThis.txt", "IncludeThis.txt",
}); });
Directory.Exists(Path.Combine(outputDir.FullName, "ExcludeThis1.txt")).Should().BeFalse(); Directory.Exists(Path.Combine(outputDir.FullName, "ExcludeThis1.txt")).Should().BeFalse();
@ -237,10 +237,10 @@ namespace Microsoft.DotNet.Migration.Tests
publishDir.Should().Exist() publishDir.Should().Exist()
.And.HaveFiles(new[] .And.HaveFiles(new[]
{ {
"ContentFile1.txt", "ContentFile1.txt1",
"ContentFile2.txt", "ContentFile2.txt1",
"ContentFileBuiltIn1.txt", "ContentFileBuiltIn1.txt1",
"ContentFileBuiltIn2.txt", "ContentFileBuiltIn2.txt1",
"IncludeThis.txt", "IncludeThis.txt",
}); });
Directory.Exists(Path.Combine(publishDir.FullName, "ExcludeThis1.txt")).Should().BeFalse(); Directory.Exists(Path.Combine(publishDir.FullName, "ExcludeThis1.txt")).Should().BeFalse();
@ -431,6 +431,12 @@ namespace Microsoft.DotNet.Migration.Tests
.Execute("build -c Debug") .Execute("build -c Debug")
.Should().Pass(); .Should().Pass();
if (!EnvironmentInfo.HasSharedFramework("netcoreapp1.0"))
{
// running the app requires netcoreapp1.0
return;
}
var cmd = new DotnetCommand() var cmd = new DotnetCommand()
.WithWorkingDirectory(projectDirectory) .WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput("run -c Debug"); .ExecuteWithCapturedOutput("run -c Debug");
@ -483,6 +489,12 @@ namespace Microsoft.DotNet.Migration.Tests
.Execute("build -c Debug") .Execute("build -c Debug")
.Should().Pass(); .Should().Pass();
if (!EnvironmentInfo.HasSharedFramework("netcoreapp1.0"))
{
// running the app requires netcoreapp1.0
return;
}
var cmd = new DotnetCommand() var cmd = new DotnetCommand()
.WithWorkingDirectory(projectDirectory) .WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput("run -c Debug"); .ExecuteWithCapturedOutput("run -c Debug");
@ -534,6 +546,12 @@ namespace Microsoft.DotNet.Migration.Tests
.Execute("build -c Debug") .Execute("build -c Debug")
.Should().Pass(); .Should().Pass();
if (!EnvironmentInfo.HasSharedFramework("netcoreapp1.0"))
{
// running the app requires netcoreapp1.0
return;
}
var cmd = new DotnetCommand() var cmd = new DotnetCommand()
.WithWorkingDirectory(projectDirectory) .WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput("run -c Debug"); .ExecuteWithCapturedOutput("run -c Debug");

View file

@ -95,7 +95,7 @@ namespace Microsoft.DotNet.Migration.Tests
{ {
MigrateAndBuild( MigrateAndBuild(
"NonRestoredTestProjects", "NonRestoredTestProjects",
"PJAppWithSlnAndXprojRefThatRefsCsprojWhereSlnDoesNotRefCsproj"); "PJAppWithSlnThatDoesNotRefCsproj");
} }
[Fact] [Fact]
@ -229,11 +229,10 @@ namespace Microsoft.DotNet.Migration.Tests
.Execute($"restore \"{solutionRelPath}\"") .Execute($"restore \"{solutionRelPath}\"")
.Should().Pass(); .Should().Pass();
//ISSUE: https://github.com/dotnet/cli/issues/5205 new DotnetCommand()
//new DotnetCommand() .WithWorkingDirectory(projectDirectory)
// .WithWorkingDirectory(projectDirectory) .Execute($"build \"{solutionRelPath}\"")
// .Execute($"build \"{solutionRelPath}\"") .Should().Pass();
// .Should().Pass();
} }
private void MigrateAndBuild(string groupName, string projectName, [CallerMemberName] string callingMethod = "", string identifier = "") private void MigrateAndBuild(string groupName, string projectName, [CallerMemberName] string callingMethod = "", string identifier = "")
@ -257,11 +256,10 @@ namespace Microsoft.DotNet.Migration.Tests
.Execute($"restore \"{solutionRelPath}\"") .Execute($"restore \"{solutionRelPath}\"")
.Should().Pass(); .Should().Pass();
//ISSUE: https://github.com/dotnet/cli/issues/5205 new DotnetCommand()
//new DotnetCommand() .WithWorkingDirectory(projectDirectory)
// .WithWorkingDirectory(projectDirectory) .Execute($"build \"{solutionRelPath}\"")
// .Execute($"build \"{solutionRelPath}\"") .Should().Pass();
// .Should().Pass();
SlnFile slnFile = SlnFile.Read(Path.Combine(projectDirectory.FullName, solutionRelPath)); SlnFile slnFile = SlnFile.Read(Path.Combine(projectDirectory.FullName, solutionRelPath));

View file

@ -543,7 +543,7 @@ namespace Microsoft.DotNet.Migration.Tests
.And.Contain("Migration failed."); .And.Contain("Migration failed.");
} }
[Fact] [RequiresSpecificFrameworkFact("netcoreapp1.0")]
public void ItMigratesAndPublishesProjectsWithRuntimes() public void ItMigratesAndPublishesProjectsWithRuntimes()
{ {
var projectName = "PJTestAppSimple"; var projectName = "PJTestAppSimple";
@ -745,6 +745,12 @@ namespace Microsoft.DotNet.Migration.Tests
private void VerifyAllMSBuildOutputsRunnable(DirectoryInfo projectDirectory) private void VerifyAllMSBuildOutputsRunnable(DirectoryInfo projectDirectory)
{ {
if (!EnvironmentInfo.HasSharedFramework("netcoreapp1.0"))
{
// running the apps requires netcoreapp1.0
return;
}
var dllFileName = Path.GetFileName(projectDirectory.FullName) + ".dll"; var dllFileName = Path.GetFileName(projectDirectory.FullName) + ".dll";
var runnableDlls = projectDirectory var runnableDlls = projectDirectory

View file

@ -8,5 +8,6 @@
<add key="aspnet101" value="https://www.myget.org/F/aspnet101/api/v3/index.json" /> <add key="aspnet101" value="https://www.myget.org/F/aspnet101/api/v3/index.json" />
<add key="dotnet-web" value="https://dotnet.myget.org/F/dotnet-web/api/v3/index.json" /> <add key="dotnet-web" value="https://dotnet.myget.org/F/dotnet-web/api/v3/index.json" />
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" /> <add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="AspNetCurrent" value="https://dotnet.myget.org/F/aspnet-feb2017-patch/api/v3/index.json" />
</packageSources> </packageSources>
</configuration> </configuration>

View file

@ -7,5 +7,6 @@
<add key="aspnet101" value="https://www.myget.org/F/aspnet101/api/v3/index.json" /> <add key="aspnet101" value="https://www.myget.org/F/aspnet101/api/v3/index.json" />
<add key="dotnet-web" value="https://dotnet.myget.org/F/dotnet-web/api/v3/index.json" /> <add key="dotnet-web" value="https://dotnet.myget.org/F/dotnet-web/api/v3/index.json" />
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" /> <add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="AspNetCurrent" value="https://dotnet.myget.org/F/aspnet-feb2017-patch/api/v3/index.json" />
</packageSources> </packageSources>
</configuration> </configuration>

View file

@ -32,11 +32,11 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
new PublishCommand() new PublishCommand()
.WithWorkingDirectory(testProjectDirectory) .WithWorkingDirectory(testProjectDirectory)
.Execute("--framework netcoreapp1.0") .Execute("--framework netcoreapp1.1")
.Should().Pass(); .Should().Pass();
var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug"; var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
var outputDll = Path.Combine(testProjectDirectory, "bin", configuration, "netcoreapp1.0", "publish", $"{testAppName}.dll"); var outputDll = Path.Combine(testProjectDirectory, "bin", configuration, "netcoreapp1.1", "publish", $"{testAppName}.dll");
new TestCommand("dotnet") new TestCommand("dotnet")
.ExecuteWithCapturedOutput(outputDll) .ExecuteWithCapturedOutput(outputDll)
@ -59,7 +59,7 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
var rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier(); var rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier();
new PublishCommand() new PublishCommand()
.WithFramework("netcoreapp1.0") .WithFramework("netcoreapp1.1")
.WithRuntime(rid) .WithRuntime(rid)
.WithWorkingDirectory(testProjectDirectory) .WithWorkingDirectory(testProjectDirectory)
//Workaround for https://github.com/dotnet/cli/issues/4501 //Workaround for https://github.com/dotnet/cli/issues/4501
@ -70,7 +70,7 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug"; var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
var outputProgram = testProjectDirectory var outputProgram = testProjectDirectory
.GetDirectory("bin", configuration, "netcoreapp1.0", rid, "publish", $"{testAppName}{Constants.ExeSuffix}") .GetDirectory("bin", configuration, "netcoreapp1.1", rid, "publish", $"{testAppName}{Constants.ExeSuffix}")
.FullName; .FullName;
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
@ -94,7 +94,7 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
string dir = "pkgs"; string dir = "pkgs";
string args = $"--packages {dir}"; string args = $"--packages {dir}";
string newArgs = $"console -o \"{rootPath}\""; string newArgs = $"console -f netcoreapp1.1 -o \"{rootPath}\"";
new NewCommandShim() new NewCommandShim()
.WithWorkingDirectory(rootPath) .WithWorkingDirectory(rootPath)
.Execute(newArgs) .Execute(newArgs)

View file

@ -75,7 +75,7 @@ namespace Microsoft.DotNet.Cli.Run.Tests
new RunCommand() new RunCommand()
.WithWorkingDirectory(testProjectDirectory) .WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput("--framework netcoreapp1.0") .ExecuteWithCapturedOutput("--framework netcoreapp1.1")
.Should().Pass() .Should().Pass()
.And.HaveStdOutContaining("Hello World!"); .And.HaveStdOutContaining("Hello World!");
} }
@ -126,7 +126,7 @@ namespace Microsoft.DotNet.Cli.Run.Tests
string dir = "pkgs"; string dir = "pkgs";
string args = $"--packages {dir}"; string args = $"--packages {dir}";
string newArgs = $"console -o \"{rootPath}\""; string newArgs = $"console -f netcoreapp1.1 -o \"{rootPath}\"";
new NewCommandShim() new NewCommandShim()
.WithWorkingDirectory(rootPath) .WithWorkingDirectory(rootPath)
.Execute(newArgs) .Execute(newArgs)

Some files were not shown because too many files have changed in this diff Show more