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:
commit
3a9525b5ac
105 changed files with 1994 additions and 706 deletions
|
@ -1 +1 @@
|
|||
1.0.0-preview3-003930
|
||||
1.0.0-preview2-1-003177
|
||||
|
|
|
@ -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
|
|
@ -9,5 +9,6 @@
|
|||
<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="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>
|
||||
</configuration>
|
||||
|
|
|
@ -23,8 +23,7 @@ There are a couple of things to keep in mind:
|
|||
|
||||
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
|
||||
to see the workarounds.
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
|
|
|
@ -31,9 +31,13 @@ specific language governing permissions and limitations under the License.
|
|||
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
|
||||
---------------------------
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp1.0;net451</TargetFrameworks>
|
||||
<TargetFrameworks>netcoreapp1.1;net451</TargetFrameworks>
|
||||
<OutputType>Exe</OutputType>
|
||||
<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>
|
||||
|
@ -11,11 +11,6 @@
|
|||
<Version>1.0.0-*</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">
|
||||
<PackageReference Include="Microsoft.NETCore.App">
|
||||
<Version>1.0.3</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
|
||||
<Reference Include="System" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
|
@ -25,7 +20,4 @@
|
|||
<Version>1.0.0-*</Version>
|
||||
</DotNetCliToolReference>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -4,6 +4,7 @@
|
|||
<AssemblyName>AppWithRedirectsAndConfig</AssemblyName>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RuntimeIdentifiers>win7-x64;win7-x86</RuntimeIdentifiers>
|
||||
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<AssemblyName>AppWithRedirectsNoConfig</AssemblyName>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RuntimeIdentifiers>win7-x64;win7-x86</RuntimeIdentifiers>
|
||||
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
<PropertyGroup>
|
||||
<TargetFrameworks>netstandard1.6;net451</TargetFrameworks>
|
||||
<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>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp1.0</TargetFramework>
|
||||
<TargetFramework>netcoreapp1.1</TargetFramework>
|
||||
<AssemblyName>dotnet-throwingtool</AssemblyName>
|
||||
<PackageId>$(AssemblyName)</PackageId>
|
||||
</PropertyGroup>
|
||||
|
@ -13,10 +13,4 @@
|
|||
</BuiltProjectOutputGroupOutput>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NETCore.App">
|
||||
<Version>1.0.3</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -2,15 +2,10 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp1.0</TargetFramework>
|
||||
<TargetFramework>netcoreapp1.1</TargetFramework>
|
||||
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NETCore.App">
|
||||
<Version>1.0.3</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<DotNetCliToolReference Include="dotnet-throwingtool">
|
||||
<Version>1.0.0</Version>
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
"version": "1.0.0-*",
|
||||
"content": "*.txt",
|
||||
"contentExclude": "ExcludeThis1.txt",
|
||||
"contentFiles": [ "../ContentFile1.txt", "../ContentFile2.txt" ],
|
||||
"contentBuiltIn": [ "../ContentFileBuiltIn1.txt", "../ContentFileBuiltIn2.txt" ],
|
||||
"contentFiles": [ "ContentFile1.txt1", "ContentFile2.txt1" ],
|
||||
"contentBuiltIn": [ "ContentFileBuiltIn1.txt1", "ContentFileBuiltIn2.txt1" ],
|
||||
"publishExclude": "ExcludeThis2.txt",
|
||||
"buildOptions": {
|
||||
"debugType": "portable",
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp1.0</TargetFramework>
|
||||
<TargetFramework>netcoreapp1.1</TargetFramework>
|
||||
<GeneratedPackageId>random-name</GeneratedPackageId>
|
||||
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NETCore.App" Version="1.0.3" />
|
||||
<DotNetCliToolReference Include="$(GeneratedPackageId)">
|
||||
<Version>1.0.0</Version>
|
||||
</DotNetCliToolReference>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp1.0</TargetFramework>
|
||||
<TargetFramework>netcoreapp1.1</TargetFramework>
|
||||
<GeneratedPackageId>random-name</GeneratedPackageId>
|
||||
<PackageId>$(GeneratedPackageId)</PackageId>
|
||||
<AssemblyName>dotnet-randompackage</AssemblyName>
|
||||
|
@ -14,8 +14,4 @@
|
|||
</BuiltProjectOutputGroupOutput>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NETCore.App" Version="1.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -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>
|
||||
<TargetFramework>netcoreapp1.0</TargetFramework>
|
||||
<TargetFramework>netcoreapp1.1</TargetFramework>
|
||||
<AssemblyName>dotnet-tool-with-output-name</AssemblyName>
|
||||
<PackageId>ToolWithOutputName</PackageId>
|
||||
<OutputType>Exe</OutputType>
|
||||
|
@ -12,13 +12,4 @@
|
|||
</BuiltProjectOutputGroupOutput>
|
||||
</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>
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<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>
|
||||
<VersionPrefix>1.0.0-rc</VersionPrefix>
|
||||
<TargetFramework>netcoreapp1.0</TargetFramework>
|
||||
|
@ -18,7 +20,7 @@
|
|||
<Version>1.0.4</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyModel">
|
||||
<Version>1.0.1-beta-000933</Version>
|
||||
<Version>$(DependencyModelVersion)</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>1.0.0-rc</VersionPrefix>
|
||||
<TargetFramework>netcoreapp1.0</TargetFramework>
|
||||
<TargetFramework>netcoreapp1.1</TargetFramework>
|
||||
<AssemblyName>dotnet-dependency-tool-invoker</AssemblyName>
|
||||
<OutputType>Exe</OutputType>
|
||||
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);portable-net45+win8;dnxcore50</PackageTargetFallback>
|
||||
|
@ -23,9 +23,6 @@
|
|||
</BuiltProjectOutputGroupOutput>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NETCore.App">
|
||||
<Version>1.0.4</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="NuGet.Frameworks">
|
||||
<Version>$(CLI_NuGet_Version)</Version>
|
||||
</PackageReference>
|
||||
|
@ -33,8 +30,4 @@
|
|||
<Version>$(SdkNugetVersion)</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
|
@ -1,24 +1,18 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>1.0.0-rc</VersionPrefix>
|
||||
<TargetFrameworks>netcoreapp1.0;net451</TargetFrameworks>
|
||||
<TargetFrameworks>netcoreapp1.1;net451</TargetFrameworks>
|
||||
<AssemblyName>dotnet-desktop-and-portable</AssemblyName>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RuntimeIdentifiers>win7-x64;win7-x86</RuntimeIdentifiers>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.1' ">
|
||||
<BuiltProjectOutputGroupOutput Include="$(ProjectRuntimeConfigFilePath)">
|
||||
<FinalOutputPath>$(ProjectRuntimeConfigFilePath)</FinalOutputPath>
|
||||
</BuiltProjectOutputGroupOutput>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">
|
||||
<PackageReference Include="Microsoft.NETCore.App">
|
||||
<Version>1.0.4</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
|
||||
<Reference Include="System" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp1.0</TargetFramework>
|
||||
<TargetFramework>netcoreapp1.1</TargetFramework>
|
||||
<AssemblyName>dotnet-portable</AssemblyName>
|
||||
<OutputType>Exe</OutputType>
|
||||
<VersionSuffix></VersionSuffix>
|
||||
|
@ -13,14 +13,4 @@
|
|||
<FinalOutputPath>$(ProjectRuntimeConfigFilePath)</FinalOutputPath>
|
||||
</BuiltProjectOutputGroupOutput>
|
||||
</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>
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp1.0</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -14,7 +15,4 @@
|
|||
<Version>1.0.0</Version>
|
||||
</DotNetCliToolReference>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -14,4 +15,4 @@
|
|||
<Version>1.0.0</Version>
|
||||
</DotNetCliToolReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
@ -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>
|
||||
<TargetFramework>netcoreapp1.0</TargetFramework>
|
||||
<TargetFramework>netcoreapp1.1</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ToolWithOutputName">
|
||||
<Version>1.0.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.NETCore.App">
|
||||
<Version>1.0.3</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<DotNetCliToolReference Include="dotnet-dependency-tool-invoker">
|
||||
<Version>1.0.0-*</Version>
|
||||
</DotNetCliToolReference>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFrameworks>net451;netcoreapp1.0</TargetFrameworks>
|
||||
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp1.0</TargetFramework>
|
||||
<TargetFramework>netcoreapp1.1</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NETCore.App">
|
||||
<Version>1.0.3</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<DotNetCliToolReference Include="dotnet-portable">
|
||||
<Version>1.0.0</Version>
|
||||
|
@ -17,7 +13,4 @@
|
|||
<Version>1.0.0</Version>
|
||||
</DotNetCliToolReference>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFrameworks>net451;netcoreapp1.0</TargetFrameworks>
|
||||
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Random content.
|
|
@ -17,5 +17,13 @@
|
|||
},
|
||||
"frameworks": {
|
||||
"netstandard1.5": {}
|
||||
},
|
||||
"packOptions": {
|
||||
"files": {
|
||||
"include": ["contentitem.txt"],
|
||||
"mappings": {
|
||||
"dir/contentitem.txt": "contentitem.txt"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -97,7 +97,8 @@
|
|||
"wwwroot",
|
||||
"**/*.cshtml",
|
||||
"appsettings.json",
|
||||
"web.config"
|
||||
"web.config",
|
||||
"README.md"
|
||||
]
|
||||
},
|
||||
|
||||
|
|
|
@ -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>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp1.0</TargetFramework>
|
||||
<TargetFramework>netcoreapp1.1</TargetFramework>
|
||||
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NETCore.App">
|
||||
<Version>1.0.3</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="dotnet-portable">
|
||||
<Version>1.0.0</Version>
|
||||
<PrivateAssets>All</PrivateAssets>
|
||||
|
|
|
@ -2,13 +2,11 @@
|
|||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp1.0</TargetFramework>
|
||||
<TargetFramework>netcoreapp1.1</TargetFramework>
|
||||
<DisableImplicitFrameworkReferences>false</DisableImplicitFrameworkReferences>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NETCore.App">
|
||||
<Version>1.0.3</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="MSTest.TestFramework">
|
||||
<Version>1.0.6-preview</Version>
|
||||
</PackageReference>
|
||||
|
|
|
@ -2,13 +2,11 @@
|
|||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp1.0</TargetFramework>
|
||||
<TargetFramework>netcoreapp1.1</TargetFramework>
|
||||
<DisableImplicitFrameworkReferences>false</DisableImplicitFrameworkReferences>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NETCore.App">
|
||||
<Version>1.0.3</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk">
|
||||
<Version>$(CLI_TestPlatform_Version)</Version>
|
||||
</PackageReference>
|
||||
|
|
|
@ -45,11 +45,10 @@
|
|||
<ReplaceFileContents
|
||||
InputFile="$(DebianConfigTemplateFile)"
|
||||
DestinationFile="$(DebianConfigJsonFile)"
|
||||
ReplacementPatterns="@(DebianConfigTokenValues -> '%(Identity)')"
|
||||
ReplacementStrings="@(DebianConfigTokenValues -> '%(ReplacementString)')" />
|
||||
ReplacementItems="@(DebianConfigTokenValues)" />
|
||||
|
||||
<!-- Build SDK Deb package -->
|
||||
<DotNetDebTool ToolPath="$(Stage0PjDirectory)"
|
||||
<DotNetDebTool ToolPath="$(Stage0Directory)"
|
||||
InputDirectory="$(LayoutDirectory)"
|
||||
OutputDirectory="$(DotNetDebToolOutputDirectory)"
|
||||
PackageName="$(SdkDebianPackageName)"
|
||||
|
@ -75,8 +74,10 @@
|
|||
<Exec Command="sudo dpkg -r $(SharedFxDebianPackageName)" />
|
||||
<Exec Command="sudo dpkg -r $(HostFxrDebianPackageName)" />
|
||||
|
||||
<Exec Command="sudo dpkg -r $(AdditionalSharedFxDebianPackageName)" />
|
||||
<Exec Command="sudo dpkg -r $(AdditionalHostFxrDebianPackageName)" />
|
||||
<Exec Command="sudo dpkg -r $(AdditionalSharedFxDebianPackageName)"
|
||||
Condition="'$(IncludeAdditionalSharedFrameworks)' == 'true'" />
|
||||
<Exec Command="sudo dpkg -r $(AdditionalHostFxrDebianPackageName)"
|
||||
Condition="'$(IncludeAdditionalSharedFrameworks)' == 'true'" />
|
||||
|
||||
<Exec Command="sudo dpkg -r $(HostDebianPackageName)" />
|
||||
</Target>
|
||||
|
@ -90,9 +91,12 @@
|
|||
Outputs="$(DebianTestResultsXmlFile)" >
|
||||
|
||||
<!-- Install Dependencies and SDK Packages -->
|
||||
<Exec Command="sudo dpkg -i $(AdditionalDownloadedSharedHostInstallerFile)" />
|
||||
<Exec Command="sudo dpkg -i $(AdditionalDownloadedHostFxrInstallerFile)" />
|
||||
<Exec Command="sudo dpkg -i $(AdditionalDownloadedSharedFrameworkInstallerFile)" />
|
||||
<Exec Command="sudo dpkg -i $(AdditionalDownloadedSharedHostInstallerFile)"
|
||||
Condition="'$(IncludeAdditionalSharedFrameworks)' == 'true'" />
|
||||
<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 $(DownloadedHostFxrInstallerFile)" />
|
||||
|
@ -113,8 +117,10 @@
|
|||
<Exec Command="sudo dpkg -r $(SharedFxDebianPackageName)" />
|
||||
<Exec Command="sudo dpkg -r $(HostFxrDebianPackageName)" />
|
||||
|
||||
<Exec Command="sudo dpkg -r $(AdditionalSharedFxDebianPackageName)" />
|
||||
<Exec Command="sudo dpkg -r $(AdditionalHostFxrDebianPackageName)" />
|
||||
<Exec Command="sudo dpkg -r $(AdditionalSharedFxDebianPackageName)"
|
||||
Condition="'$(IncludeAdditionalSharedFrameworks)' == 'true'" />
|
||||
<Exec Command="sudo dpkg -r $(AdditionalHostFxrDebianPackageName)"
|
||||
Condition="'$(IncludeAdditionalSharedFrameworks)' == 'true'" />
|
||||
|
||||
<Exec Command="sudo dpkg -r $(HostDebianPackageName)" />
|
||||
</Target>
|
||||
|
@ -148,23 +154,19 @@
|
|||
</Target>
|
||||
|
||||
<Target Name="PrepareDotnetDebTool"
|
||||
DependsOnTargets="WriteDotnetDebToolProjectJson;">
|
||||
DependsOnTargets="WriteDotnetDebToolProject">
|
||||
|
||||
<DotNetRestorePj FallbackSource="$(DotnetDebToolPackageSource)"
|
||||
ToolPath="$(Stage0PjDirectory)"
|
||||
WorkingDirectory="$(DotnetDebToolDir)" />
|
||||
<DotNetRestore ToolPath="$(Stage0Directory)"
|
||||
WorkingDirectory="$(DotnetDebToolDir)" />
|
||||
</Target>
|
||||
|
||||
<Target Name="WriteDotnetDebToolProjectJson"
|
||||
Inputs="$(MSBuildThisFile);$(MSBuildThisFileDirectory)/Installer.DEB.props"
|
||||
Outputs="$(DotnetDebToolDir)/project.json">
|
||||
|
||||
<MakeDir Condition=" !Exists($(DotnetDebToolDir)) "
|
||||
Directories="$(DotnetDebToolDir)" />
|
||||
<Copy SourceFiles="$(MSBuildThisFileDirectory)/$(DotnetDebToolConsumerProjectName)"
|
||||
DestinationFiles="$(DotnetDebToolDir)/$(DotnetDebToolConsumerProjectName)" />
|
||||
|
||||
<WriteLinesToFile File="$(DotnetDebToolDir)/project.json"
|
||||
Lines="@(DotnetDebToolProjectJsonLines)"
|
||||
Overwrite="True" />
|
||||
</Target>
|
||||
|
||||
<Target Name="TestDebuild">
|
||||
|
|
8
build/package/dotnet-deb-tool-consumer.csproj
Normal file
8
build/package/dotnet-deb-tool-consumer.csproj
Normal 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>
|
|
@ -20,7 +20,7 @@
|
|||
<Version>4.1.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions">
|
||||
<Version>1.0.1-beta-000933</Version>
|
||||
<Version>$(PlatformAbstractionsVersion)</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -18,6 +18,9 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
{
|
||||
}
|
||||
|
||||
[Required]
|
||||
public string SDKVersion { get; set; }
|
||||
|
||||
[Required]
|
||||
public string ToolPath { get; set; }
|
||||
|
||||
|
@ -75,6 +78,8 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
Directory.Delete(targetDir, true);
|
||||
}
|
||||
|
||||
dataToHash += SDKVersion;
|
||||
|
||||
Log.LogMessage($"NuGet Packages Archive Data To Hash: '{dataToHash}'");
|
||||
|
||||
var sha256 = SHA256.Create();
|
||||
|
|
|
@ -9,7 +9,12 @@ using Microsoft.Build.Framework;
|
|||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
/// <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)
|
||||
/// item in ReplacementStrings.
|
||||
///
|
||||
|
@ -27,14 +32,23 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
[Required]
|
||||
public string DestinationFile { get; set; }
|
||||
|
||||
[Required]
|
||||
public ITaskItem[] ReplacementItems { get; set; }
|
||||
|
||||
public ITaskItem[] ReplacementPatterns { get; set; }
|
||||
|
||||
[Required]
|
||||
public ITaskItem[] ReplacementStrings { get; set; }
|
||||
|
||||
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)
|
||||
{
|
||||
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;
|
||||
|
||||
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)
|
||||
{
|
||||
var replacementPattern = ReplacementPatterns[i].ItemSpec;
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
<Version>$(CLI_MSBuild_Version)</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions">
|
||||
<Version>1.0.1-beta-000933</Version>
|
||||
<Version>$(PlatformAbstractionsVersion)</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -38,7 +38,7 @@
|
|||
<Version>7.2.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions">
|
||||
<Version>1.0.1-beta-000933</Version>
|
||||
<Version>$(PlatformAbstractionsVersion)</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
},
|
||||
|
||||
"debian_dependencies":{
|
||||
"%SHARED_FRAMEWORK_DEBIAN_PACKAGE_NAME%" : {},
|
||||
"%SHARED_FRAMEWORK_DEBIAN_PACKAGE_NAME_ADDITIONAL%" : {}
|
||||
"%SHARED_FRAMEWORK_DEBIAN_PACKAGE_NAME%" : {}%SHARED_FRAMEWORK_DEBIAN_PACKAGE_ADDITIONAL_DEPENDENCY%
|
||||
}
|
||||
}
|
||||
|
|
28
scripts/docker/fedora.24/Dockerfile
Normal file
28
scripts/docker/fedora.24/Dockerfile
Normal 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
|
50
scripts/docker/opensuse.42.1/Dockerfile
Normal file
50
scripts/docker/opensuse.42.1/Dockerfile
Normal 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
|
63
scripts/docker/ubuntu.16.10/Dockerfile
Normal file
63
scripts/docker/ubuntu.16.10/Dockerfile
Normal 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
|
|
@ -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.
|
||||
|
||||
## 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.
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using NuGet.Frameworks;
|
||||
using NuGet.ProjectModel;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Utils
|
||||
|
@ -22,6 +23,8 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
|
||||
string FullOutputPath { get; }
|
||||
|
||||
NuGetFramework DotnetCliToolTargetFramework { get; }
|
||||
|
||||
Dictionary<string, string> EnvironmentVariables { get; }
|
||||
}
|
||||
}
|
|
@ -13,6 +13,8 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
{
|
||||
internal class MSBuildProject : IProject
|
||||
{
|
||||
private static readonly NuGetFramework s_toolPackageFramework = FrameworkConstants.CommonFrameworks.NetCoreApp10;
|
||||
|
||||
private Project _project;
|
||||
|
||||
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
|
||||
{
|
||||
get
|
||||
|
|
|
@ -21,8 +21,6 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
{
|
||||
private const string ProjectToolsCommandResolverName = "projecttoolscommandresolver";
|
||||
|
||||
private static readonly NuGetFramework s_toolPackageFramework = FrameworkConstants.CommonFrameworks.NetCoreApp10;
|
||||
|
||||
private static readonly CommandResolutionStrategy s_commandResolutionStrategy =
|
||||
CommandResolutionStrategy.ProjectToolsPackage;
|
||||
|
||||
|
@ -136,8 +134,14 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
ProjectToolsCommandResolverName,
|
||||
string.Join(Environment.NewLine, possiblePackageRoots.Select((p) => $"- {p}"))));
|
||||
|
||||
var toolPackageFramework = project.DotnetCliToolTargetFramework;
|
||||
|
||||
string nugetPackagesRoot;
|
||||
var toolLockFile = GetToolLockFile(toolLibraryRange, possiblePackageRoots, out nugetPackagesRoot);
|
||||
var toolLockFile = GetToolLockFile(
|
||||
toolLibraryRange,
|
||||
toolPackageFramework,
|
||||
possiblePackageRoots,
|
||||
out nugetPackagesRoot);
|
||||
|
||||
if (toolLockFile == null)
|
||||
{
|
||||
|
@ -150,7 +154,7 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
toolLockFile.Path));
|
||||
|
||||
var toolLibrary = toolLockFile.Targets
|
||||
.FirstOrDefault(t => s_toolPackageFramework == t.TargetFramework)
|
||||
.FirstOrDefault(t => toolPackageFramework == t.TargetFramework)
|
||||
?.Libraries.FirstOrDefault(
|
||||
l => StringComparer.OrdinalIgnoreCase.Equals(l.Name, toolLibraryRange.Name));
|
||||
if (toolLibrary == null)
|
||||
|
@ -164,7 +168,11 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
|
||||
var depsFileRoot = Path.GetDirectoryName(toolLockFile.Path);
|
||||
|
||||
var depsFilePath = GetToolDepsFilePath(toolLibraryRange, toolLockFile, depsFileRoot);
|
||||
var depsFilePath = GetToolDepsFilePath(
|
||||
toolLibraryRange,
|
||||
toolPackageFramework,
|
||||
toolLockFile,
|
||||
depsFileRoot);
|
||||
|
||||
var normalizedNugetPackagesRoot = PathUtility.EnsureNoTrailingDirectorySeparator(nugetPackagesRoot);
|
||||
|
||||
|
@ -206,12 +214,13 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
|
||||
private LockFile GetToolLockFile(
|
||||
SingleProjectInfo toolLibrary,
|
||||
NuGetFramework framework,
|
||||
IEnumerable<string> possibleNugetPackagesRoot,
|
||||
out string nugetPackagesRoot)
|
||||
{
|
||||
foreach (var packagesRoot in possibleNugetPackagesRoot)
|
||||
{
|
||||
if (TryGetToolLockFile(toolLibrary, packagesRoot, out LockFile lockFile))
|
||||
if (TryGetToolLockFile(toolLibrary, framework, packagesRoot, out LockFile lockFile))
|
||||
{
|
||||
nugetPackagesRoot = packagesRoot;
|
||||
return lockFile;
|
||||
|
@ -233,11 +242,12 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
|
||||
private bool TryGetToolLockFile(
|
||||
SingleProjectInfo toolLibrary,
|
||||
NuGetFramework framework,
|
||||
string nugetPackagesRoot,
|
||||
out LockFile lockFile)
|
||||
{
|
||||
lockFile = null;
|
||||
var lockFilePath = GetToolLockFilePath(toolLibrary, nugetPackagesRoot);
|
||||
var lockFilePath = GetToolLockFilePath(toolLibrary, framework, nugetPackagesRoot);
|
||||
|
||||
if (!FileExistsWithLock(lockFilePath).Result)
|
||||
{
|
||||
|
@ -260,6 +270,7 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
|
||||
private string GetToolLockFilePath(
|
||||
SingleProjectInfo toolLibrary,
|
||||
NuGetFramework framework,
|
||||
string nugetPackagesRoot)
|
||||
{
|
||||
var toolPathCalculator = new ToolPathCalculator(nugetPackagesRoot);
|
||||
|
@ -267,11 +278,12 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
return toolPathCalculator.GetBestLockFilePath(
|
||||
toolLibrary.Name,
|
||||
VersionRange.Parse(toolLibrary.Version),
|
||||
s_toolPackageFramework);
|
||||
framework);
|
||||
}
|
||||
|
||||
private string GetToolDepsFilePath(
|
||||
SingleProjectInfo toolLibrary,
|
||||
NuGetFramework framework,
|
||||
LockFile toolLockFile,
|
||||
string depsPathRoot)
|
||||
{
|
||||
|
@ -284,24 +296,26 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
ProjectToolsCommandResolverName,
|
||||
depsJsonPath));
|
||||
|
||||
EnsureToolJsonDepsFileExists(toolLockFile, depsJsonPath, toolLibrary);
|
||||
EnsureToolJsonDepsFileExists(toolLockFile, framework, depsJsonPath, toolLibrary);
|
||||
|
||||
return depsJsonPath;
|
||||
}
|
||||
|
||||
private void EnsureToolJsonDepsFileExists(
|
||||
LockFile toolLockFile,
|
||||
NuGetFramework framework,
|
||||
string depsPath,
|
||||
SingleProjectInfo toolLibrary)
|
||||
{
|
||||
if (!File.Exists(depsPath))
|
||||
{
|
||||
GenerateDepsJsonFile(toolLockFile, depsPath, toolLibrary);
|
||||
GenerateDepsJsonFile(toolLockFile, framework, depsPath, toolLibrary);
|
||||
}
|
||||
}
|
||||
|
||||
internal void GenerateDepsJsonFile(
|
||||
LockFile toolLockFile,
|
||||
NuGetFramework framework,
|
||||
string depsPath,
|
||||
SingleProjectInfo toolLibrary)
|
||||
{
|
||||
|
@ -310,7 +324,7 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
depsPath));
|
||||
|
||||
var dependencyContext = new DepsJsonBuilder()
|
||||
.Build(toolLibrary, null, toolLockFile, s_toolPackageFramework, null);
|
||||
.Build(toolLibrary, null, toolLockFile, framework, null);
|
||||
|
||||
var tempDepsFile = Path.GetTempFileName();
|
||||
using (var fileStream = File.Open(tempDepsFile, FileMode.Open, FileAccess.Write))
|
||||
|
|
|
@ -7,8 +7,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration
|
|||
{
|
||||
public const string AspNetToolsVersion = "1.0.0";
|
||||
public const string AspNet110ToolsVersion = "1.1.0";
|
||||
public const string AspNetLTSPackagesVersion = "1.0.2";
|
||||
public const string EntityFrameworkLTSPackagesVersion = "1.0.2";
|
||||
public const string AspNetLTSPackagesVersion = "1.0.3";
|
||||
public const string EntityFrameworkLTSPackagesVersion = "1.0.3";
|
||||
public const string TestSdkPackageVersion = "15.0.0-preview-20170106-08";
|
||||
public const string XUnitPackageVersion = "2.2.0-beta5-build3474";
|
||||
public const string XUnitRunnerPackageVersion = "2.2.0-beta5-build1225";
|
||||
|
|
|
@ -23,6 +23,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration
|
|||
var values = line.Split(',');
|
||||
var packageName = values[0];
|
||||
var ltsVersion = values[1];
|
||||
var ftsVersion = values[2];
|
||||
|
||||
if (HasVersion(ltsVersion))
|
||||
{
|
||||
|
@ -38,6 +39,22 @@ namespace Microsoft.DotNet.ProjectJsonMigration
|
|||
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
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,6 +71,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration
|
|||
|
||||
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 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 ItemTransformApplicatorEncompassedUpdates = "{0}: encompassed updates {1}";
|
||||
|
||||
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} }}";
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration
|
|||
public static IEnumerable<string> GetEncompassedIncludes(this ProjectItemElement item,
|
||||
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())))
|
||||
{
|
||||
return otherItem.IntersectIncludes(item);
|
||||
|
@ -23,6 +23,18 @@ namespace Microsoft.DotNet.ProjectJsonMigration
|
|||
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)
|
||||
{
|
||||
// Different includes
|
||||
|
@ -32,6 +44,12 @@ namespace Microsoft.DotNet.ProjectJsonMigration
|
|||
return false;
|
||||
}
|
||||
|
||||
if (item.IntersectUpdates(otherItem).Count() != item.Updates().Count())
|
||||
{
|
||||
trace?.WriteLine(String.Format(LocalizableStrings.UpdatesNotEquivalent, nameof(MSBuildExtensions), nameof(IsEquivalentTo)));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Different Excludes
|
||||
if (item.IntersectExcludes(otherItem).Count() != item.Excludes().Count())
|
||||
{
|
||||
|
@ -39,10 +57,10 @@ namespace Microsoft.DotNet.ProjectJsonMigration
|
|||
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
|
||||
if (item.Remove != otherItem.Remove)
|
||||
|
@ -119,6 +137,12 @@ namespace Microsoft.DotNet.ProjectJsonMigration
|
|||
return SplitSemicolonDelimitedValues(item.Include);
|
||||
}
|
||||
|
||||
public static IEnumerable<string> Updates(
|
||||
this ProjectItemElement item)
|
||||
{
|
||||
return SplitSemicolonDelimitedValues(item.Update);
|
||||
}
|
||||
|
||||
public static IEnumerable<string> Excludes(
|
||||
this ProjectItemElement item)
|
||||
{
|
||||
|
@ -141,6 +165,11 @@ namespace Microsoft.DotNet.ProjectJsonMigration
|
|||
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)
|
||||
{
|
||||
return item.Excludes().Intersect(otherItem.Excludes());
|
||||
|
@ -151,6 +180,11 @@ namespace Microsoft.DotNet.ProjectJsonMigration
|
|||
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)
|
||||
{
|
||||
item.Include = string.Join(";", item.Includes().Union(includesToAdd));
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -39,6 +39,7 @@ namespace Microsoft.DotNet.Internal.ProjectModel.Files
|
|||
CustomRemovePatterns = new List<string>();
|
||||
SourceBasePath = sourceBasePath;
|
||||
Option = option;
|
||||
RawObject = rawObject;
|
||||
var token = rawObject.Value<JToken>(option);
|
||||
|
||||
if (token == null)
|
||||
|
@ -117,19 +118,21 @@ namespace Microsoft.DotNet.Internal.ProjectModel.Files
|
|||
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -147,11 +147,18 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
|
|||
new RemoveContextTransform("EmbeddedResource", condition: ic => ic != null);
|
||||
|
||||
private IncludeContextTransform CopyToOutputFilesTransform =>
|
||||
new IncludeContextTransform("Content", transformMappings: true)
|
||||
new UpdateContextTransform("None", transformMappings: true)
|
||||
.WithMetadata("CopyToOutputDirectory", "PreserveNewest");
|
||||
|
||||
private IncludeContextTransform DoNotCopyToOutputFilesTransform =>
|
||||
new UpdateContextTransform("None", transformMappings: true)
|
||||
.WithMetadata("CopyToOutputDirectory", "Never");
|
||||
|
||||
private IncludeContextTransform CopyToOutputFilesTransformForWeb =>
|
||||
new UpdateContextTransform("Content", transformMappings: true)
|
||||
new UpdateContextTransform(
|
||||
"None",
|
||||
transformMappings: true,
|
||||
excludePatternsRule: pattern => ItemsIncludedInTheWebSDK.HasContent(pattern))
|
||||
.WithMetadata("CopyToOutputDirectory", "PreserveNewest");
|
||||
|
||||
private AddPropertyTransform<Project> GenerateRuntimeConfigurationFilesTransform =>
|
||||
|
@ -194,6 +201,12 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
|
|||
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 ProjectPropertyGroupElement _configurationPropertyGroup;
|
||||
|
@ -265,7 +278,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
|
|||
{
|
||||
CompileFilesTransformExecute,
|
||||
EmbedFilesTransformExecute,
|
||||
CopyToOutputFilesTransformExecute
|
||||
CopyToOutputFilesTransformExecute,
|
||||
DoNotCopyToOutputFilesTransformExecute
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -528,6 +542,28 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
|
|||
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)
|
||||
{
|
||||
if (langVersion.StartsWith("csharp", StringComparison.OrdinalIgnoreCase))
|
||||
|
|
|
@ -57,10 +57,17 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
|
|||
packOptions => !string.IsNullOrEmpty(packOptions.RepositoryUrl));
|
||||
|
||||
private IncludeContextTransform PackFilesTransform =>
|
||||
new IncludeContextTransform("Content", transformMappings: true)
|
||||
new UpdateContextTransform("None", transformMappings: true)
|
||||
.WithMetadata("Pack", "true")
|
||||
.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 =>
|
||||
(addItemTransform, targetPath) =>
|
||||
{
|
||||
|
@ -115,7 +122,28 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
|
|||
|
||||
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())
|
||||
{
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
// 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.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.Build.Construction;
|
||||
using Microsoft.DotNet.Internal.ProjectModel.Files;
|
||||
using Microsoft.DotNet.ProjectJsonMigration.Transforms;
|
||||
|
||||
namespace Microsoft.DotNet.ProjectJsonMigration.Rules
|
||||
|
@ -28,7 +31,31 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
|
|||
CopyToPublishDirectoryTransformForWeb :
|
||||
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())
|
||||
{
|
||||
|
@ -41,11 +68,18 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
|
|||
}
|
||||
|
||||
private IncludeContextTransform CopyToPublishDirectoryTransform =>
|
||||
new IncludeContextTransform("Content", transformMappings: true)
|
||||
new UpdateContextTransform("None", transformMappings: true)
|
||||
.WithMetadata("CopyToPublishDirectory", "PreserveNewest");
|
||||
|
||||
private IncludeContextTransform DoNotCopyToPublishDirectoryTransform =>
|
||||
new UpdateContextTransform("None", transformMappings: true)
|
||||
.WithMetadata("CopyToPublishDirectory", "Never");
|
||||
|
||||
private IncludeContextTransform CopyToPublishDirectoryTransformForWeb =>
|
||||
new UpdateContextTransform("Content", transformMappings: true)
|
||||
new UpdateContextTransform(
|
||||
"None",
|
||||
transformMappings: true,
|
||||
excludePatternsRule: pattern => ItemsIncludedInTheWebSDK.HasContent(pattern))
|
||||
.WithMetadata("CopyToPublishDirectory", "PreserveNewest");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,15 +50,6 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
|
|||
propertyGroup,
|
||||
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)
|
||||
|
@ -127,36 +118,5 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
|
|||
"TargetFramework",
|
||||
framework => framework.GetShortFolderName(),
|
||||
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;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -188,6 +188,30 @@ namespace Microsoft.DotNet.ProjectJsonMigration
|
|||
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
|
||||
{
|
||||
|
|
|
@ -19,12 +19,18 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
|
|||
{
|
||||
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))
|
||||
{
|
||||
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)
|
||||
|
@ -40,8 +46,18 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
|
|||
var item = element as ProjectItemElement;
|
||||
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(LocalizableStrings.ItemTransformApplicatorItemGroup, nameof(ItemTransformApplicator), destinationItemGroup.Condition));
|
||||
MigrationTrace.Instance.WriteLine(String.Format(
|
||||
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)
|
||||
{
|
||||
|
@ -49,7 +65,9 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
|
|||
item = MergeWithExistingItemsWithSameCondition(item, destinationItemGroup);
|
||||
if (item == null)
|
||||
{
|
||||
MigrationTrace.Instance.WriteLine(String.Format(LocalizableStrings.ItemTransformAppliatorItemCompletelyMerged, nameof(ItemTransformApplicator)));
|
||||
MigrationTrace.Instance.WriteLine(String.Format(
|
||||
LocalizableStrings.ItemTransformAppliatorItemCompletelyMerged,
|
||||
nameof(ItemTransformApplicator)));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -57,14 +75,18 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
|
|||
item = MergeWithExistingItemsWithNoCondition(item, destinationItemGroup);
|
||||
if (item == null)
|
||||
{
|
||||
MigrationTrace.Instance.WriteLine(String.Format(LocalizableStrings.ItemTransformAppliatorItemCompletelyMerged, nameof(ItemTransformApplicator)));
|
||||
MigrationTrace.Instance.WriteLine(String.Format(
|
||||
LocalizableStrings.ItemTransformAppliatorItemCompletelyMerged,
|
||||
nameof(ItemTransformApplicator)));
|
||||
return;
|
||||
}
|
||||
|
||||
item = MergeWithExistingItemsWithACondition(item, destinationItemGroup);
|
||||
if (item == null)
|
||||
{
|
||||
MigrationTrace.Instance.WriteLine(String.Format(LocalizableStrings.ItemTransformAppliatorItemCompletelyMerged, nameof(ItemTransformApplicator)));
|
||||
MigrationTrace.Instance.WriteLine(String.Format(
|
||||
LocalizableStrings.ItemTransformAppliatorItemCompletelyMerged,
|
||||
nameof(ItemTransformApplicator)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -88,13 +110,22 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
|
|||
var outputItem = itemGroup.ContainingProject.CreateItemElement("___TEMP___");
|
||||
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);
|
||||
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
|
||||
if (item.ConditionChain().Any() || destinationItemGroup.ConditionChain().Any())
|
||||
|
@ -105,63 +136,156 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
|
|||
var existingItemsWithACondition =
|
||||
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)
|
||||
{
|
||||
// If this item is encompassing items in a condition, remove the encompassed includes from the existing item
|
||||
var encompassedIncludes = item.GetEncompassedIncludes(existingItem, MigrationTrace.Instance);
|
||||
if (encompassedIncludes.Any())
|
||||
if (!string.IsNullOrEmpty(item.Include))
|
||||
{
|
||||
MigrationTrace.Instance.WriteLine(String.Format(LocalizableStrings.ItemTransformApplicatorEncompassedIncludes, nameof(ItemTransformApplicator), string.Join(", ", encompassedIncludes)));
|
||||
existingItem.RemoveIncludes(encompassedIncludes);
|
||||
MergeOnIncludesWithExistingItemsWithACondition(item, existingItem, destinationItemGroup);
|
||||
}
|
||||
|
||||
// continue if the existing item is now empty
|
||||
if (!existingItem.Includes().Any())
|
||||
if (!string.IsNullOrEmpty(item.Update))
|
||||
{
|
||||
MigrationTrace.Instance.WriteLine(String.Format(LocalizableStrings.ItemTransformApplicatorRemovingItem, nameof(ItemTransformApplicator), existingItem.ItemType, existingItem.Condition, existingItem.Include, existingItem.Exclude));
|
||||
existingItem.Parent.RemoveChild(existingItem);
|
||||
continue;
|
||||
}
|
||||
|
||||
// If we haven't continued, the existing item may have includes
|
||||
// that need to be removed before being redefined, to avoid duplicate includes
|
||||
// Create or merge with existing remove
|
||||
var remainingIntersectedIncludes = existingItem.IntersectIncludes(item);
|
||||
|
||||
if (remainingIntersectedIncludes.Any())
|
||||
{
|
||||
var existingRemoveItem = destinationItemGroup.Items
|
||||
.Where(i =>
|
||||
string.IsNullOrEmpty(i.Include)
|
||||
&& string.IsNullOrEmpty(i.Exclude)
|
||||
&& !string.IsNullOrEmpty(i.Remove))
|
||||
.FirstOrDefault();
|
||||
|
||||
if (existingRemoveItem != null)
|
||||
{
|
||||
var removes = new HashSet<string>(existingRemoveItem.Remove.Split(';'));
|
||||
foreach (var include in remainingIntersectedIncludes)
|
||||
{
|
||||
removes.Add(include);
|
||||
}
|
||||
existingRemoveItem.Remove = string.Join(";", removes);
|
||||
}
|
||||
else
|
||||
{
|
||||
var clearPreviousItem = _projectElementGenerator.CreateItemElement(item.ItemType);
|
||||
clearPreviousItem.Remove = string.Join(";", remainingIntersectedIncludes);
|
||||
|
||||
AddItemToItemGroup(clearPreviousItem, existingItem.Parent as ProjectItemGroupElement);
|
||||
}
|
||||
MergeOnUpdatesWithExistingItemsWithACondition(item, existingItem, destinationItemGroup);
|
||||
}
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
private ProjectItemElement MergeWithExistingItemsWithNoCondition(ProjectItemElement item, ProjectItemGroupElement destinationItemGroup)
|
||||
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
|
||||
var encompassedIncludes = item.GetEncompassedIncludes(existingItem, MigrationTrace.Instance);
|
||||
if (encompassedIncludes.Any())
|
||||
{
|
||||
MigrationTrace.Instance.WriteLine(String.Format(
|
||||
LocalizableStrings.ItemTransformApplicatorEncompassedIncludes,
|
||||
nameof(ItemTransformApplicator),
|
||||
string.Join(", ", encompassedIncludes)));
|
||||
existingItem.RemoveIncludes(encompassedIncludes);
|
||||
}
|
||||
|
||||
// continue if the existing item is now empty
|
||||
if (!existingItem.Includes().Any())
|
||||
{
|
||||
MigrationTrace.Instance.WriteLine(String.Format(
|
||||
LocalizableStrings.ItemTransformApplicatorRemovingItem,
|
||||
nameof(ItemTransformApplicator),
|
||||
existingItem.ItemType,
|
||||
existingItem.Condition,
|
||||
existingItem.Include,
|
||||
existingItem.Exclude));
|
||||
existingItem.Parent.RemoveChild(existingItem);
|
||||
return;
|
||||
}
|
||||
|
||||
// If we haven't continued, the existing item may have includes
|
||||
// that need to be removed before being redefined, to avoid duplicate includes
|
||||
// Create or merge with existing remove
|
||||
var remainingIntersectedIncludes = existingItem.IntersectIncludes(item);
|
||||
|
||||
if (remainingIntersectedIncludes.Any())
|
||||
{
|
||||
var existingRemoveItem = destinationItemGroup.Items
|
||||
.Where(i =>
|
||||
string.IsNullOrEmpty(i.Include)
|
||||
&& string.IsNullOrEmpty(i.Exclude)
|
||||
&& !string.IsNullOrEmpty(i.Remove))
|
||||
.FirstOrDefault();
|
||||
|
||||
if (existingRemoveItem != null)
|
||||
{
|
||||
var removes = new HashSet<string>(existingRemoveItem.Remove.Split(';'));
|
||||
foreach (var include in remainingIntersectedIncludes)
|
||||
{
|
||||
removes.Add(include);
|
||||
}
|
||||
existingRemoveItem.Remove = string.Join(";", removes);
|
||||
}
|
||||
else
|
||||
{
|
||||
var clearPreviousItem = _projectElementGenerator.CreateItemElement(item.ItemType);
|
||||
clearPreviousItem.Remove = string.Join(";", remainingIntersectedIncludes);
|
||||
|
||||
AddItemToItemGroup(clearPreviousItem, existingItem.Parent as ProjectItemGroupElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
// 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
|
||||
if (!item.ConditionChain().Any() && !destinationItemGroup.ConditionChain().Any())
|
||||
|
@ -172,22 +296,67 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
|
|||
var existingItemsWithNoCondition =
|
||||
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()));
|
||||
|
||||
// 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)
|
||||
if (!string.IsNullOrEmpty(item.Include))
|
||||
{
|
||||
var encompassedIncludes = existingItem.GetEncompassedIncludes(item, MigrationTrace.Instance);
|
||||
if (encompassedIncludes.Any())
|
||||
// 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)
|
||||
{
|
||||
MigrationTrace.Instance.WriteLine(String.Format(LocalizableStrings.ItemTransformApplicatorEncompassedIncludes, nameof(ItemTransformApplicator), string.Join(", ", encompassedIncludes)));
|
||||
item.RemoveIncludes(encompassedIncludes);
|
||||
if (!item.Includes().Any())
|
||||
var encompassedIncludes = existingItem.GetEncompassedIncludes(item, MigrationTrace.Instance);
|
||||
if (encompassedIncludes.Any())
|
||||
{
|
||||
MigrationTrace.Instance.WriteLine(String.Format(LocalizableStrings.ItemTransformApplicatorIgnoringItem, nameof(ItemTransformApplicator), existingItem.ItemType, existingItem.Condition, existingItem.Include, existingItem.Exclude));
|
||||
return null;
|
||||
MigrationTrace.Instance.WriteLine(String.Format(
|
||||
LocalizableStrings.ItemTransformApplicatorEncompassedIncludes,
|
||||
nameof(ItemTransformApplicator),
|
||||
string.Join(", ", encompassedIncludes)));
|
||||
item.RemoveIncludes(encompassedIncludes);
|
||||
if (!item.Includes().Any())
|
||||
{
|
||||
MigrationTrace.Instance.WriteLine(String.Format(
|
||||
LocalizableStrings.ItemTransformApplicatorIgnoringItem,
|
||||
nameof(ItemTransformApplicator),
|
||||
existingItem.ItemType,
|
||||
existingItem.Condition,
|
||||
existingItem.Include,
|
||||
existingItem.Exclude));
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -200,18 +369,20 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
|
|||
var existingRemoveItem = destinationItemGroup.Items
|
||||
.Where(i =>
|
||||
string.IsNullOrEmpty(i.Include)
|
||||
&& string.IsNullOrEmpty(i.Update)
|
||||
&& string.IsNullOrEmpty(i.Exclude)
|
||||
&& !string.IsNullOrEmpty(i.Remove))
|
||||
.FirstOrDefault();
|
||||
|
||||
var itemsToRemove = string.IsNullOrEmpty(item.Include) ? item.Update : item.Include;
|
||||
if (existingRemoveItem != null)
|
||||
{
|
||||
existingRemoveItem.Remove += ";" + item.Include;
|
||||
existingRemoveItem.Remove += ";" + itemsToRemove;
|
||||
}
|
||||
else
|
||||
{
|
||||
var clearPreviousItem = _projectElementGenerator.CreateItemElement(item.ItemType);
|
||||
clearPreviousItem.Remove = item.Include;
|
||||
clearPreviousItem.Remove = itemsToRemove;
|
||||
|
||||
AddItemToItemGroup(clearPreviousItem, destinationItemGroup);
|
||||
}
|
||||
|
@ -220,12 +391,19 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
|
|||
return item;
|
||||
}
|
||||
|
||||
private ProjectItemElement MergeWithExistingItemsWithSameCondition(ProjectItemElement item, ProjectItemGroupElement destinationItemGroup)
|
||||
private ProjectItemElement MergeWithExistingItemsWithSameCondition(
|
||||
ProjectItemElement item,
|
||||
ProjectItemGroupElement destinationItemGroup)
|
||||
{
|
||||
var existingItemsWithSameCondition =
|
||||
FindExistingItemsWithSameCondition(item, destinationItemGroup.ContainingProject, destinationItemGroup);
|
||||
var existingItemsWithSameCondition = FindExistingItemsWithSameCondition(
|
||||
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)
|
||||
{
|
||||
|
@ -238,7 +416,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
|
|||
existingItem.Parent.RemoveChild(existingItem);
|
||||
}
|
||||
|
||||
MigrationTrace.Instance.WriteLine(String.Format(LocalizableStrings.ItemTransformApplicatorAddingMergedItem,
|
||||
MigrationTrace.Instance.WriteLine(String.Format(
|
||||
LocalizableStrings.ItemTransformApplicatorAddingMergedItem,
|
||||
nameof(TransformApplicator),
|
||||
mergeResult.MergedItem.ItemType,
|
||||
mergeResult.MergedItem.Condition,
|
||||
|
@ -250,6 +429,21 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
|
|||
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>
|
||||
/// 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
|
||||
|
@ -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.
|
||||
/// </summary>
|
||||
private MergeResult MergeItems(ProjectItemElement item, ProjectItemElement existingItem)
|
||||
private MergeResult MergeItemsOnIncludes(ProjectItemElement item, ProjectItemElement existingItem)
|
||||
{
|
||||
if (!string.Equals(item.ItemType, existingItem.ItemType, StringComparison.Ordinal))
|
||||
{
|
||||
throw new InvalidOperationException(LocalizableStrings.CannotMergeItemsOfDifferentTypesError);
|
||||
}
|
||||
|
||||
if (!item.IntersectIncludes(existingItem).Any())
|
||||
{
|
||||
throw new InvalidOperationException(LocalizableStrings.CannotMergeItemsWithoutCommonIncludeError);
|
||||
}
|
||||
|
||||
var commonIncludes = item.IntersectIncludes(existingItem).ToList();
|
||||
var mergedItem = _projectElementGenerator.AddItem(item.ItemType, string.Join(";", commonIncludes));
|
||||
|
||||
|
@ -295,11 +484,41 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
|
|||
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(
|
||||
ICollection<ProjectMetadataElement> existingMetadataElements,
|
||||
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)
|
||||
{
|
||||
|
@ -307,11 +526,11 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
|
|||
m.Name.Equals(newMetadata.Name, StringComparison.OrdinalIgnoreCase));
|
||||
if (existingMetadata == null)
|
||||
{
|
||||
mergedMetadata.Add(newMetadata);
|
||||
mergedMetadata.Add((ProjectMetadataElement) newMetadata.Clone());
|
||||
}
|
||||
else
|
||||
{
|
||||
MergeMetadata(existingMetadata, newMetadata);
|
||||
MergeMetadata(existingMetadata, (ProjectMetadataElement) newMetadata.Clone());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -322,7 +541,25 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
|
|||
{
|
||||
if (existingMetadata.Value != newMetadata.Value)
|
||||
{
|
||||
existingMetadata.Value = string.Join(";", new [] { 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 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -335,7 +572,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
|
|||
.Where(i => i.Condition == item.Condition)
|
||||
.Where(i => i.Parent.ConditionChainsAreEquivalent(destinationContainer))
|
||||
.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(
|
||||
|
@ -346,7 +584,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
|
|||
return project.Items
|
||||
.Where(i => !i.ConditionChain().Any())
|
||||
.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(
|
||||
|
@ -357,7 +596,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
|
|||
return project.Items
|
||||
.Where(i => i.ConditionChain().Any())
|
||||
.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
|
||||
|
|
|
@ -16,10 +16,13 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
|
|||
itemName,
|
||||
includeContext => string.Empty,
|
||||
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.IncludeFiles != null
|
||||
&& includeContext.IncludeFiles.Count > 0);
|
||||
&& includeContext.IncludeFiles.Where(
|
||||
pattern => !ExcludePatternRule(pattern)).Count() > 0);
|
||||
|
||||
protected override Func<string, AddItemTransform<IncludeContext>> IncludeExcludeTransformGetter =>
|
||||
(itemName) => new AddItemTransform<IncludeContext>(
|
||||
|
@ -39,24 +42,27 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
|
|||
.Union(includeContext.BuiltInsInclude.OrEmptyIfNull())
|
||||
.Union(includeContext.CustomIncludePatterns.OrEmptyIfNull());
|
||||
|
||||
return FormatGlobPatternsForMsbuild(fullIncludeSet, includeContext.SourceBasePath);
|
||||
return FormatGlobPatternsForMsbuild(
|
||||
fullIncludeSet.Where(pattern => !ExcludePatternRule(pattern)),
|
||||
includeContext.SourceBasePath);
|
||||
},
|
||||
includeContext =>
|
||||
{
|
||||
return includeContext != null &&
|
||||
(
|
||||
(includeContext.IncludePatterns != null && includeContext.IncludePatterns.Count > 0)
|
||||
||
|
||||
(includeContext.BuiltInsInclude != null && includeContext.BuiltInsInclude.Count > 0)
|
||||
||
|
||||
(includeContext.CustomIncludePatterns != null && includeContext.CustomIncludePatterns.Count > 0)
|
||||
);
|
||||
return includeContext != null &&includeContext.IncludePatterns.OrEmptyIfNull()
|
||||
.Union(includeContext.BuiltInsInclude.OrEmptyIfNull())
|
||||
.Union(includeContext.CustomIncludePatterns.OrEmptyIfNull())
|
||||
.Where(pattern => !ExcludePatternRule(pattern)).Count() > 0;
|
||||
});
|
||||
|
||||
public UpdateContextTransform(
|
||||
string itemName,
|
||||
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)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,123 +1,131 @@
|
|||
Id,LtsVersion,CurrentVersion
|
||||
Microsoft.NETCore.App,1.0.3,1.1.0
|
||||
Microsoft.AspNetCore,1.0.3,1.1.0
|
||||
Microsoft.AspNetCore.Authentication,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.Authentication.Cookies,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.Authentication.Facebook,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.Authentication.Google,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.Authentication.JwtBearer,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.Authentication.MicrosoftAccount,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.Authentication.OAuth,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.Authentication.OpenIdConnect,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.Authentication.Twitter,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.CookiePolicy,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.Cors,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.DataProtection,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.DataProtection.Extensions,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.DataProtection.SystemWeb,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.Hosting.WindowsServices,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.Html.Abstractions,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.Identity.EntityFrameworkCore,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.MiddlewareAnalysis,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.Mvc,1.0.2,1.1.0
|
||||
Microsoft.AspNetCore.Mvc.Abstractions,1.0.2,1.1.0
|
||||
Microsoft.AspNetCore.Mvc.ApiExplorer,1.0.2,1.1.0
|
||||
Microsoft.AspNetCore.Mvc.Formatters.Xml,1.0.2,1.1.0
|
||||
Microsoft.AspNetCore.Mvc.WebApiCompatShim,1.0.2,1.1.0
|
||||
Microsoft.AspNetCore.Owin,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.Routing,1.0.2,1.1.0
|
||||
Microsoft.AspNetCore.Routing.Abstractions,1.0.2,1.1.0
|
||||
Microsoft.AspNetCore.Server.Kestrel.Https,1.0.2,1.1.0
|
||||
Microsoft.AspNetCore.Session,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.StaticFiles,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.TestHost,1.0.1,1.1.0
|
||||
Microsoft.NETCore.App,1.0.4,1.1.1
|
||||
Microsoft.AspNetCore,1.0.4,1.1.1
|
||||
Microsoft.AspNetCore.Authentication,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.Authentication.Cookies,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.Authentication.Facebook,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.Authentication.Google,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.Authentication.JwtBearer,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.Authentication.MicrosoftAccount,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.Authentication.OAuth,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.Authentication.OpenIdConnect,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.Authentication.Twitter,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.Buffering,0.1.2,0.2.1
|
||||
Microsoft.AspNetCore.CookiePolicy,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.Cors,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.DataProtection,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.DataProtection.Extensions,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.DataProtection.Redis,,0.1.1
|
||||
Microsoft.AspNetCore.DataProtection.SystemWeb,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.DataProtection.Sources,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.Diagnostics.Elm,0.1.2,0.2.1
|
||||
Microsoft.AspNetCore.Hosting.WindowsServices,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.Html.Abstractions,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.Identity.EntityFrameworkCore,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.MiddlewareAnalysis,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.Mvc,1.0.3,1.1.2
|
||||
Microsoft.AspNetCore.Mvc.Abstractions,1.0.3,1.1.2
|
||||
Microsoft.AspNetCore.Mvc.ApiExplorer,1.0.3,1.1.2
|
||||
Microsoft.AspNetCore.Mvc.Formatters.Xml,1.0.3,1.1.2
|
||||
Microsoft.AspNetCore.Mvc.WebApiCompatShim,1.0.3,1.1.2
|
||||
Microsoft.AspNetCore.Owin,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.Routing,1.0.3,1.1.1
|
||||
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.EntityFrameworkCore,1.0.2,1.1.0
|
||||
Microsoft.EntityFrameworkCore.Design,1.0.2,1.1.0
|
||||
Microsoft.EntityFrameworkCore.InMemory,1.0.2,1.1.0
|
||||
Microsoft.EntityFrameworkCore.Relational,1.0.2,1.1.0
|
||||
Microsoft.EntityFrameworkCore.Relational.Design,1.0.2,1.1.0
|
||||
Microsoft.EntityFrameworkCore.Sqlite,1.0.2,1.1.0
|
||||
Microsoft.EntityFrameworkCore.Sqlite.Design,1.0.2,1.1.0
|
||||
Microsoft.EntityFrameworkCore.SqlServer,1.0.2,1.1.0
|
||||
Microsoft.EntityFrameworkCore.SqlServer.Design,1.0.2,1.1.0
|
||||
Microsoft.Extensions.Caching.Memory,1.0.1,1.1.0
|
||||
Microsoft.Extensions.Caching.Redis,1.0.1,1.1.0
|
||||
Microsoft.Extensions.Caching.SqlServer,1.0.1,1.1.0
|
||||
Microsoft.EntityFrameworkCore,1.0.3,1.1.1
|
||||
Microsoft.EntityFrameworkCore.Design,1.0.3,1.1.1
|
||||
Microsoft.EntityFrameworkCore.InMemory,1.0.3,1.1.1
|
||||
Microsoft.EntityFrameworkCore.Relational,1.0.3,1.1.1
|
||||
Microsoft.EntityFrameworkCore.Relational.Design,1.0.3,1.1.1
|
||||
Microsoft.EntityFrameworkCore.Sqlite,1.0.3,1.1.1
|
||||
Microsoft.EntityFrameworkCore.Sqlite.Design,1.0.3,1.1.1
|
||||
Microsoft.EntityFrameworkCore.SqlServer,1.0.3,1.1.1
|
||||
Microsoft.EntityFrameworkCore.SqlServer.Design,1.0.3,1.1.1
|
||||
Microsoft.Extensions.Caching.Memory,1.0.2,1.1.1
|
||||
Microsoft.Extensions.Caching.Redis,1.0.2,1.1.1
|
||||
Microsoft.Extensions.Caching.SqlServer,1.0.2,1.1.1
|
||||
Microsoft.Extensions.CommandLineUtils,1.0.1,1.1.0
|
||||
Microsoft.Extensions.Configuration,1.0.1,1.1.0
|
||||
Microsoft.Extensions.Configuration.Binder,1.0.1,1.1.0
|
||||
Microsoft.Extensions.Configuration.CommandLine,1.0.1,1.1.0
|
||||
Microsoft.Extensions.Configuration.EnvironmentVariables,1.0.1,1.1.0
|
||||
Microsoft.Extensions.Configuration.FileExtensions,1.0.1,1.1.0
|
||||
Microsoft.Extensions.Configuration.Ini,1.0.1,1.1.0
|
||||
Microsoft.Extensions.Configuration.Json,1.0.1,1.1.0
|
||||
Microsoft.Extensions.Configuration.UserSecrets,1.0.1,1.1.0
|
||||
Microsoft.Extensions.Configuration.Xml,1.0.1,1.1.0
|
||||
Microsoft.Extensions.DependencyInjection,1.0.1,1.1.0
|
||||
Microsoft.Extensions.DiagnosticAdapter,1.0.1,1.1.0
|
||||
Microsoft.Extensions.Configuration,1.0.2,1.1.1
|
||||
Microsoft.Extensions.Configuration.Binder,1.0.2,1.1.1
|
||||
Microsoft.Extensions.Configuration.CommandLine,1.0.2,1.1.1
|
||||
Microsoft.Extensions.Configuration.EnvironmentVariables,1.0.2,1.1.1
|
||||
Microsoft.Extensions.Configuration.FileExtensions,1.0.2,1.1.1
|
||||
Microsoft.Extensions.Configuration.Ini,1.0.2,1.1.1
|
||||
Microsoft.Extensions.Configuration.Json,1.0.2,1.1.1
|
||||
Microsoft.Extensions.Configuration.UserSecrets,1.0.2,1.1.1
|
||||
Microsoft.Extensions.Configuration.Xml,1.0.2,1.1.1
|
||||
Microsoft.Extensions.DependencyInjection,1.0.2,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.Embedded,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.Globalization.CultureInfoCache,1.0.1,1.1.0
|
||||
Microsoft.Extensions.Localization,1.0.1,1.1.0
|
||||
Microsoft.Extensions.Logging,1.0.1,1.1.0
|
||||
Microsoft.Extensions.Logging.Console,1.0.1,1.1.0
|
||||
Microsoft.Extensions.Logging.Debug,1.0.1,1.1.0
|
||||
Microsoft.Extensions.Logging.Filter,1.0.1,1.1.0
|
||||
Microsoft.Extensions.Logging.TraceSource,1.0.1,1.1.0
|
||||
Microsoft.VisualStudio.Web.BrowserLink,1.0.0,1.0.0
|
||||
Microsoft.VisualStudio.Web.BrowserLink.Loader,14.0.1,14.1.0
|
||||
Microsoft.AspNetCore.AzureAppServicesIntegration,,1.0.0
|
||||
Microsoft.AspNetCore.DataProtection.AzureStorage,,1.0.0
|
||||
Microsoft.AspNetCore.Localization.Routing,,1.1.0
|
||||
Microsoft.AspNetCore.Rewrite,,1.0.0
|
||||
Microsoft.AspNetCore.ResponseCaching,,1.1.0
|
||||
Microsoft.AspNetCore.ResponseCompression,,1.0.0
|
||||
Microsoft.AspNetCore.WebSockets,,1.0.0
|
||||
Microsoft.Extensions.Logging.AzureAppServices,,1.0.0
|
||||
Microsoft.Extensions.Configuration.AzureKeyVault,,1.0.0
|
||||
Microsoft.Extensions.Logging.EventSource,,1.1.0
|
||||
Microsoft.Extensions.Globalization.CultureInfoCache,1.0.2,1.1.1
|
||||
Microsoft.Extensions.Localization,1.0.2,1.1.1
|
||||
Microsoft.Extensions.Logging,1.0.2,1.1.1
|
||||
Microsoft.Extensions.Logging.Console,1.0.2,1.1.1
|
||||
Microsoft.Extensions.Logging.Debug,1.0.2,1.1.1
|
||||
Microsoft.Extensions.Logging.Filter,1.0.2,1.1.1
|
||||
Microsoft.Extensions.Logging.TraceSource,1.0.2,1.1.1
|
||||
Microsoft.Extensions.Logging.EventLog,1.0.2,1.1.1
|
||||
Microsoft.VisualStudio.Web.BrowserLink,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.AzureAppServicesIntegration,,1.0.1
|
||||
Microsoft.AspNetCore.DataProtection.AzureStorage,,1.0.1
|
||||
Microsoft.AspNetCore.Localization.Routing,,1.1.1
|
||||
Microsoft.AspNetCore.Rewrite,,1.0.1
|
||||
Microsoft.AspNetCore.ResponseCaching,1.0.1,1.1.1
|
||||
Microsoft.AspNetCore.ResponseCompression,,1.0.1
|
||||
Microsoft.AspNetCore.WebSockets,,1.0.1
|
||||
Microsoft.Extensions.Logging.AzureAppServices,,1.0.1
|
||||
Microsoft.Extensions.Configuration.AzureKeyVault,,1.0.1
|
||||
Microsoft.Extensions.Logging.EventSource,,1.1.1
|
||||
System.ServiceModel.Duplex,4.0.1,4.3.0
|
||||
System.ServiceModel.Http,4.1.0,4.3.0
|
||||
System.ServiceModel.NetTcp,4.1.0,4.3.0
|
||||
System.ServiceModel.Security,4.0.1,4.3.0
|
||||
Libuv,1.9.1,1.9.1
|
||||
Microsoft.AspNet.WebApi.Client,5.2.2,5.2.2
|
||||
Microsoft.AspNetCore.Antiforgery,1.0.2,1.1.0
|
||||
Microsoft.AspNetCore.Authorization,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.Cryptography.Internal,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.Cryptography.KeyDerivation,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.DataProtection.Abstractions,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.Diagnostics,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.Diagnostics.Abstractions,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.Hosting,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.Hosting.Abstractions,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.Hosting.Server.Abstractions,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.Http,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.Http.Abstractions,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.Http.Extensions,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.Http.Features,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.HttpOverrides,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.Identity,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.JsonPatch,1.0.0,1.1.0
|
||||
Microsoft.AspNetCore.Localization,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.Mvc.Core,1.0.2,1.1.0
|
||||
Microsoft.AspNetCore.Mvc.Cors,1.0.2,1.1.0
|
||||
Microsoft.AspNetCore.Mvc.DataAnnotations,1.0.2,1.1.0
|
||||
Microsoft.AspNetCore.Mvc.Formatters.Json,1.0.2,1.1.0
|
||||
Microsoft.AspNetCore.Mvc.Localization,1.0.2,1.1.0
|
||||
Microsoft.AspNetCore.Mvc.Razor,1.0.2,1.1.0
|
||||
Microsoft.AspNetCore.Mvc.Razor.Host,1.0.2,1.1.0
|
||||
Microsoft.AspNetCore.Mvc.TagHelpers,1.0.2,1.1.0
|
||||
Microsoft.AspNetCore.Mvc.ViewFeatures,1.0.2,1.1.0
|
||||
Microsoft.AspNetCore.Razor,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.Razor.Runtime,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.Server.IISIntegration,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.Server.Kestrel,1.0.2,1.1.0
|
||||
Microsoft.AspNetCore.WebUtilities,1.0.1,1.1.0
|
||||
Microsoft.AspNetCore.Antiforgery,1.0.3,1.1.1
|
||||
Microsoft.AspNetCore.Authorization,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.Cryptography.Internal,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.Cryptography.KeyDerivation,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.DataProtection.Abstractions,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.Diagnostics,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.Diagnostics.Abstractions,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.Hosting,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.Hosting.Abstractions,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.Hosting.Server.Abstractions,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.Http,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.Http.Abstractions,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.Http.Extensions,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.Http.Features,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.HttpOverrides,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.Identity,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.JsonPatch,1.0.0,1.1.1
|
||||
Microsoft.AspNetCore.Localization,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.Mvc.Core,1.0.3,1.1.2
|
||||
Microsoft.AspNetCore.Mvc.Cors,1.0.3,1.1.2
|
||||
Microsoft.AspNetCore.Mvc.DataAnnotations,1.0.3,1.1.2
|
||||
Microsoft.AspNetCore.Mvc.Formatters.Json,1.0.3,1.1.2
|
||||
Microsoft.AspNetCore.Mvc.Localization,1.0.3,1.1.2
|
||||
Microsoft.AspNetCore.Mvc.Razor,1.0.3,1.1.2
|
||||
Microsoft.AspNetCore.Mvc.Razor.Host,1.0.3,1.1.2
|
||||
Microsoft.AspNetCore.Mvc.TagHelpers,1.0.3,1.1.2
|
||||
Microsoft.AspNetCore.Mvc.ViewFeatures,1.0.3,1.1.2
|
||||
Microsoft.AspNetCore.Razor,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.Razor.Runtime,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.Server.IISIntegration,1.0.2,1.1.1
|
||||
Microsoft.AspNetCore.Server.Kestrel,1.0.3,1.1.1
|
||||
Microsoft.AspNetCore.WebUtilities,1.0.2,1.1.1
|
||||
Microsoft.Bcl,1.1.9,1.1.9
|
||||
Microsoft.Bcl.Build,1.0.14,1.0.14
|
||||
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.CSharp,4.0.1,4.3.0
|
||||
Microsoft.DotNet.InternalAbstractions,1.0.0,
|
||||
Microsoft.Extensions.Caching.Abstractions,1.0.1,1.1.0
|
||||
Microsoft.Extensions.Configuration.Abstractions,1.0.1,1.1.0
|
||||
Microsoft.Extensions.DependencyInjection.Abstractions,1.0.1,1.1.0
|
||||
Microsoft.Extensions.Caching.Abstractions,1.0.2,1.1.1
|
||||
Microsoft.Extensions.Configuration.Abstractions,1.0.2,1.1.1
|
||||
Microsoft.Extensions.DependencyInjection.Abstractions,1.0.2,1.1.0
|
||||
Microsoft.Extensions.DependencyModel,1.0.0,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.Logging.Abstractions,1.0.1,1.1.0
|
||||
Microsoft.Extensions.Localization.Abstractions,1.0.2,1.1.1
|
||||
Microsoft.Extensions.Logging.Abstractions,1.0.2,1.1.1
|
||||
Microsoft.Extensions.ObjectPool,1.0.1,1.1.0
|
||||
Microsoft.Extensions.Options,1.0.1,1.1.0
|
||||
Microsoft.Extensions.Options.ConfigurationExtensions,1.0.1,1.1.0
|
||||
Microsoft.Extensions.Options,1.0.2,1.1.1
|
||||
Microsoft.Extensions.Options.ConfigurationExtensions,1.0.2,1.1.1
|
||||
Microsoft.Extensions.PlatformAbstractions,1.0.0,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.Protocols,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.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.DotNetHostPolicy,1.0.3,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.XPath,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.WebKey,,2.0.0-preview
|
||||
Microsoft.Data.Edm,,5.6.4
|
||||
|
|
|
|
@ -20,12 +20,12 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
|
|||
new AddItemTransform<IncludeContext>(
|
||||
itemName,
|
||||
includeContext => FormatGlobPatternsForMsbuild(includeContext.IncludeFiles.OrEmptyIfNull()
|
||||
.Where((pattern) => !_excludePatternRule(pattern)),
|
||||
.Where((pattern) => !ExcludePatternRule(pattern)),
|
||||
includeContext.SourceBasePath),
|
||||
includeContext => FormatGlobPatternsForMsbuild(includeContext.ExcludeFiles, includeContext.SourceBasePath),
|
||||
includeContext => includeContext != 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 =>
|
||||
(itemName) => new AddItemTransform<IncludeContext>(
|
||||
|
@ -39,7 +39,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
|
|||
fullIncludeSet = fullIncludeSet.Union(includeContext.BuiltInsInclude.OrEmptyIfNull());
|
||||
}
|
||||
|
||||
fullIncludeSet = fullIncludeSet.Where((pattern) => !_excludePatternRule(pattern));
|
||||
fullIncludeSet = fullIncludeSet.Where((pattern) => !ExcludePatternRule(pattern));
|
||||
|
||||
return FormatGlobPatternsForMsbuild(fullIncludeSet, includeContext.SourceBasePath);
|
||||
},
|
||||
|
@ -55,9 +55,9 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
|
|||
{
|
||||
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 &&
|
||||
includeContext.BuiltInsInclude != null &&
|
||||
|
@ -75,7 +75,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
|
|||
|
||||
private readonly string _itemName;
|
||||
private bool _transformMappings;
|
||||
private Func<string, bool> _excludePatternRule;
|
||||
protected Func<string, bool> ExcludePatternRule { get; }
|
||||
private bool _emitBuiltInIncludes;
|
||||
private readonly List<ItemMetadataValue<IncludeContext>> _metadata = new List<ItemMetadataValue<IncludeContext>>();
|
||||
|
||||
|
@ -89,7 +89,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
|
|||
_itemName = itemName;
|
||||
_transformMappings = transformMappings;
|
||||
_emitBuiltInIncludes = emitBuiltInIncludes;
|
||||
_excludePatternRule = excludePatternsRule ?? ((pattern) => false);
|
||||
ExcludePatternRule = excludePatternsRule ?? ((pattern) => false);
|
||||
|
||||
_mappingsToTransfrom = (addItemTransform, targetPath) =>
|
||||
{
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace Microsoft.DotNet.Tests.EndToEnd
|
|||
{
|
||||
string projectDirectory = directory.Path;
|
||||
|
||||
string newArgs = "console --debug:ephemeral-hive";
|
||||
string newArgs = "console -f netcoreapp1.1 --debug:ephemeral-hive";
|
||||
new NewCommandShim()
|
||||
.WithWorkingDirectory(projectDirectory)
|
||||
.Execute(newArgs)
|
||||
|
@ -112,7 +112,7 @@ namespace Microsoft.DotNet.Tests.EndToEnd
|
|||
new DotnetCommand()
|
||||
.WithWorkingDirectory(testProjectDirectory)
|
||||
.ExecuteWithCapturedOutput(
|
||||
$"-d dependency-tool-invoker -c {configuration} -f netcoreapp1.0 portable")
|
||||
$"-d dependency-tool-invoker -c {configuration} -f netcoreapp1.1 portable")
|
||||
.Should().Pass()
|
||||
.And.HaveStdOutContaining("Hello Portable World!");;
|
||||
}
|
||||
|
|
|
@ -189,7 +189,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
.Should().Pass();
|
||||
|
||||
var factory = new ProjectDependenciesCommandFactory(
|
||||
FrameworkConstants.CommonFrameworks.NetCoreApp10,
|
||||
FrameworkConstants.CommonFrameworks.NetCoreApp11,
|
||||
configuration,
|
||||
null,
|
||||
null,
|
||||
|
@ -198,7 +198,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
var command = factory.Create("dotnet-tool-with-output-name", null);
|
||||
|
||||
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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
CommandName = "dotnet-portable",
|
||||
Configuration = "Debug",
|
||||
ProjectDirectory = MSBuildTestProjectInstance.Root.FullName,
|
||||
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10
|
||||
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp11
|
||||
};
|
||||
|
||||
var result = projectDependenciesCommandResolver.Resolve(commandResolverArguments);
|
||||
|
@ -83,7 +83,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
CommandName = "dotnet-portable",
|
||||
Configuration = "Debug",
|
||||
ProjectDirectory = MSBuildTestProjectInstance.Root.FullName,
|
||||
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10
|
||||
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp11
|
||||
};
|
||||
|
||||
var result = projectDependenciesCommandResolver.Resolve(commandResolverArguments);
|
||||
|
@ -109,7 +109,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
CommandName = "nonexistent-command",
|
||||
CommandArguments = null,
|
||||
ProjectDirectory = MSBuildTestProjectInstance.Root.FullName,
|
||||
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10
|
||||
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp11
|
||||
};
|
||||
|
||||
var result = projectDependenciesCommandResolver.Resolve(commandResolverArguments);
|
||||
|
@ -135,7 +135,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
CommandName = "dotnet-portable",
|
||||
Configuration = "Debug",
|
||||
ProjectDirectory = testInstance.Root.FullName,
|
||||
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10,
|
||||
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp11,
|
||||
OutputPath = outputDir.FullName
|
||||
};
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace Microsoft.DotNet.Tests
|
|||
public class GivenAProjectToolsCommandResolver : TestBase
|
||||
{
|
||||
private static readonly NuGetFramework s_toolPackageFramework =
|
||||
FrameworkConstants.CommonFrameworks.NetCoreApp10;
|
||||
FrameworkConstants.CommonFrameworks.NetCoreApp11;
|
||||
|
||||
private const string TestProjectName = "AppWithToolDependency";
|
||||
|
||||
|
@ -279,6 +279,7 @@ namespace Microsoft.DotNet.Tests
|
|||
var projectToolsCommandResolver = SetupProjectToolsCommandResolver();
|
||||
projectToolsCommandResolver.GenerateDepsJsonFile(
|
||||
lockFile,
|
||||
s_toolPackageFramework,
|
||||
depsJsonFile,
|
||||
new SingleProjectInfo("dotnet-portable", "1.0.0", Enumerable.Empty<ResourceAssemblyInfo>()));
|
||||
|
||||
|
|
|
@ -453,11 +453,34 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
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]
|
||||
[InlineData("compile", "Compile", 3, "")]
|
||||
[InlineData("embed", "EmbeddedResource", 3, ";rootfile.cs")]
|
||||
[InlineData("copyToOutput", "Content", 2, ";rootfile.cs")]
|
||||
private void MigratingGroupIncludeExcludePopulatesAppropriateProjectItemElement(
|
||||
public void MigratingGroupIncludeExcludePopulatesAppropriateProjectItemElement(
|
||||
string group,
|
||||
string itemName,
|
||||
int expectedNumberOfCompileItems,
|
||||
|
@ -493,8 +516,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
|
||||
if (string.IsNullOrEmpty(item.Include))
|
||||
{
|
||||
item.Remove.Should()
|
||||
.Be(@"src\**\*;rootfile.cs;src\file2.cs");
|
||||
item.Remove.Should()
|
||||
.Be(@"src\**\*;rootfile.cs;src\file2.cs");
|
||||
}
|
||||
else if (item.Include.Contains(@"src\file1.cs"))
|
||||
{
|
||||
|
@ -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]
|
||||
[InlineData("compile", "Compile", "")]
|
||||
[InlineData("embed", "EmbeddedResource", ";rootfile.cs")]
|
||||
[InlineData("copyToOutput", "Content", ";rootfile.cs")]
|
||||
private void MigratingGroupIncludeOnlyPopulatesAppropriateProjectItemElement(
|
||||
public void MigratingGroupIncludeOnlyPopulatesAppropriateProjectItemElement(
|
||||
string group,
|
||||
string itemName,
|
||||
string expectedRootFiles)
|
||||
|
@ -551,8 +638,6 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
var mockProj = RunBuildOptionsRuleOnPj(pj,
|
||||
testDirectory: testDirectory);
|
||||
|
||||
Console.WriteLine(mockProj.RawXml);
|
||||
|
||||
mockProj.Items.Count(i => i.ItemType.Equals(itemName, StringComparison.Ordinal)).Should().Be(1);
|
||||
|
||||
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]
|
||||
public void MigratingTestProjectAddsGenerateRuntimeConfigurationFiles()
|
||||
{
|
||||
|
@ -728,7 +838,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
|
||||
private static void VerifyContentMetadata(ProjectItemElement item)
|
||||
{
|
||||
if (item.ItemType == "Content")
|
||||
if (item.ItemType == "None")
|
||||
{
|
||||
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, "src"));
|
||||
Directory.CreateDirectory(Path.Combine(directory, "anothersource"));
|
||||
File.WriteAllText(Path.Combine(directory, "root", "file1.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, "src", "file1.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, "anothersource", "file4.cs"), "content");
|
||||
File.WriteAllText(Path.Combine(directory, "rootfile.cs"), "content");
|
||||
}
|
||||
|
||||
|
|
|
@ -157,9 +157,9 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
""buildOptions"": {
|
||||
""copyToOutput"": {
|
||||
""include"": [""src""],
|
||||
""exclude"": [""src"", ""rootfile.cs""],
|
||||
""exclude"": [""anothersource"", ""rootfile.cs""],
|
||||
""includeFiles"": [""src/file1.cs"", ""src/file2.cs""],
|
||||
""excludeFiles"": [""src/file2.cs""]
|
||||
""excludeFiles"": [""anothersource/file2.cs""]
|
||||
}
|
||||
},
|
||||
""configurations"": {
|
||||
|
@ -167,34 +167,76 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
""buildOptions"": {
|
||||
""copyToOutput"": {
|
||||
""include"": [""root"", ""src"", ""rootfile.cs""],
|
||||
""exclude"": [""src"", ""root/rootfile.cs""],
|
||||
""exclude"": [""anothersource"", ""root/rootfile.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(2);
|
||||
contentItems.Where(i => i.ConditionChain().Count() == 0).Should().HaveCount(4);
|
||||
|
||||
// 2 for Configuration BuildOptions (1 Remove, 1 Include)
|
||||
contentItems.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(2);
|
||||
|
||||
var configIncludeContentItem = contentItems.First(
|
||||
item => item.ConditionChain().Count() > 0 && !string.IsNullOrEmpty(item.Include));
|
||||
var configRemoveContentItem = contentItems.First(
|
||||
item => item.ConditionChain().Count() > 0 && !string.IsNullOrEmpty(item.Remove));
|
||||
contentItems.Where(i =>
|
||||
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);
|
||||
|
||||
// Directories are not converted to globs in the result because we did not write the directory
|
||||
configRemoveContentItem.Remove.Should().Be(@"root;src;rootfile.cs");
|
||||
configIncludeContentItem.Include.Should().Be(@"root;src;rootfile.cs");
|
||||
configIncludeContentItem.Exclude.Should().Be(@"src;root\rootfile.cs;src\file2.cs");
|
||||
contentItems.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(4);
|
||||
contentItems.Where(i =>
|
||||
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(2);
|
||||
|
||||
contentItems.First(i =>
|
||||
i.ConditionChain().Count() == 1 &&
|
||||
i.Metadata.Any(m => m.Value == "PreserveNewest") &&
|
||||
!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]
|
||||
|
@ -214,7 +256,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
""testconfig"": {
|
||||
""buildOptions"": {
|
||||
""copyToOutput"": {
|
||||
""include"": [""root"", ""src"", ""rootfile.cs""],
|
||||
""include"": [""root"", ""anothersource"", ""rootfile.cs""],
|
||||
""exclude"": [""rootfile.cs"", ""someotherfile.cs""],
|
||||
""includeFiles"": [""src/file1.cs"", ""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 => i.ConditionChain().Count() == 0).Should().HaveCount(2);
|
||||
contentItems.Where(i =>
|
||||
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 => i.ConditionChain().Count() == 1).Should().HaveCount(3);
|
||||
contentItems.Where(i =>
|
||||
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(
|
||||
item => item.ConditionChain().Count() > 0
|
||||
&& item.Include.Contains("root"));
|
||||
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");
|
||||
|
||||
var configIncludeContentItem2 = contentItems.First(
|
||||
item => item.ConditionChain().Count() > 0
|
||||
&& item.Include.Contains(@"src\file1.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");
|
||||
|
||||
var configRemoveContentItem = contentItems.First(
|
||||
item => item.ConditionChain().Count() > 0 && !string.IsNullOrEmpty(item.Remove));
|
||||
contentItems.First(i =>
|
||||
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
|
||||
configRemoveContentItem.Removes()
|
||||
.Should().BeEquivalentTo("root", "src", "rootfile.cs", @"src\file1.cs", @"src\file2.cs");
|
||||
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");
|
||||
|
||||
configIncludeContentItem.Includes().Should().BeEquivalentTo("root", "src", "rootfile.cs");
|
||||
configIncludeContentItem.Excludes()
|
||||
.Should().BeEquivalentTo("rootfile.cs", "someotherfile.cs", @"src\file2.cs");
|
||||
contentItems.First(i =>
|
||||
i.ConditionChain().Count() == 1 &&
|
||||
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");
|
||||
configIncludeContentItem2.Excludes().Should().BeEquivalentTo(@"src\file2.cs");
|
||||
contentItems.First(i =>
|
||||
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]
|
||||
|
@ -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.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(2);
|
||||
contentItems.Count().Should().Be(5);
|
||||
contentItems.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(5);
|
||||
|
||||
var configIncludeContentItem = contentItems.First(
|
||||
item => item.ConditionChain().Count() > 0
|
||||
&& item.Include.Contains("root"));
|
||||
|
||||
var configIncludeContentItem2 = contentItems.First(
|
||||
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");
|
||||
var configIncludeContentItem = contentItems.First(item => item.Update.Contains("root"));
|
||||
var configIncludeContentItem2 = contentItems.First(item => item.Update.Contains(@"src\file1.cs"));
|
||||
var configIncludeContentItem3 = contentItems.First(item => item.Update.Contains(@"src\file2.cs"));
|
||||
var configIncludeContentItem4 = contentItems.First(item => item.Update.Equals(@"src"));
|
||||
var configIncludeContentItem5 = contentItems.First(item => item.Update.Contains(@"rootfile.cs"));
|
||||
|
||||
configIncludeContentItem.Updates().Should().BeEquivalentTo("root");
|
||||
configIncludeContentItem.GetMetadataWithName("Link").Should().NotBeNull();
|
||||
configIncludeContentItem.GetMetadataWithName("Link").Value.Should().Be("/some/dir/%(FileName)%(Extension)");
|
||||
|
||||
configIncludeContentItem.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull();
|
||||
configIncludeContentItem.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("PreserveNewest");
|
||||
|
||||
configIncludeContentItem2.Includes().Should().BeEquivalentTo(@"src\file1.cs", @"src\file2.cs");
|
||||
configIncludeContentItem2.Excludes().Should().BeEquivalentTo(@"src\file2.cs");
|
||||
|
||||
configIncludeContentItem2.Updates().Should().BeEquivalentTo(@"src\file1.cs");
|
||||
configIncludeContentItem2.GetMetadataWithName("Link").Should().NotBeNull();
|
||||
configIncludeContentItem2.GetMetadataWithName("Link").Value.Should().Be("/some/dir/%(FileName)%(Extension)");
|
||||
|
||||
configIncludeContentItem2.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull();
|
||||
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]
|
||||
|
@ -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.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(3);
|
||||
contentItems.Count().Should().Be(6);
|
||||
contentItems.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(6);
|
||||
|
||||
var configIncludeContentItem = contentItems.First(
|
||||
item => item.ConditionChain().Count() > 0
|
||||
&& item.Include == "root");
|
||||
&& item.Update == "root");
|
||||
|
||||
var configIncludeContentItem2 = contentItems.First(
|
||||
item => item.ConditionChain().Count() > 0
|
||||
&& item.Include == "src");
|
||||
&& item.Update == "src");
|
||||
|
||||
var configIncludeContentItem3 = contentItems.First(
|
||||
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");
|
||||
configIncludeContentItem.Excludes()
|
||||
.Should().BeEquivalentTo("rootfile.cs", "src", @"src\file2.cs");
|
||||
var configIncludeContentItem5 = contentItems.First(
|
||||
item => item.ConditionChain().Count() > 0
|
||||
&& 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("CopyToOutputDirectory").Should().NotBeNull();
|
||||
configIncludeContentItem.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("PreserveNewest");
|
||||
|
||||
configIncludeContentItem2.Include.Should().Be("src");
|
||||
configIncludeContentItem2.Excludes().Should().BeEquivalentTo("src", "rootfile.cs", @"src\rootfile.cs", @"src\file2.cs");
|
||||
|
||||
configIncludeContentItem2.Update.Should().Be("src");
|
||||
configIncludeContentItem2.GetMetadataWithName("Link").Should().NotBeNull();
|
||||
configIncludeContentItem2.GetMetadataWithName("Link").Value.Should().Be("/some/dir/%(FileName)%(Extension)");
|
||||
configIncludeContentItem2.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull();
|
||||
configIncludeContentItem2.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("PreserveNewest");
|
||||
|
||||
configIncludeContentItem3.Includes().Should().BeEquivalentTo(@"src\file1.cs");
|
||||
configIncludeContentItem3.Exclude.Should().Be(@"src\file2.cs");
|
||||
configIncludeContentItem2.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("Never");
|
||||
|
||||
configIncludeContentItem3.Updates().Should().BeEquivalentTo(@"src\file1.cs");
|
||||
configIncludeContentItem3.GetMetadataWithName("Link").Should().BeNull();
|
||||
configIncludeContentItem3.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull();
|
||||
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]
|
||||
|
@ -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();
|
||||
rootBuildOptionsContentItems.Count().Should().Be(2);
|
||||
rootBuildOptionsContentItems.Count().Should().Be(5);
|
||||
foreach (var buildOptionContentItem in rootBuildOptionsContentItems)
|
||||
{
|
||||
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);
|
||||
configItems.Should().HaveCount(2);
|
||||
configItems.Should().HaveCount(3);
|
||||
|
||||
var configIncludeContentItem = contentItems.First(
|
||||
item => item.ConditionChain().Count() > 0
|
||||
&& item.Include.Contains("src"));
|
||||
&& item.Update.Contains("src"));
|
||||
|
||||
var configRemoveContentItem = contentItems.First(
|
||||
item => item.ConditionChain().Count() > 0
|
||||
&& !string.IsNullOrEmpty(item.Remove));
|
||||
|
||||
configIncludeContentItem.Include.Should().Be("src");
|
||||
configIncludeContentItem.Update.Should().Be("src");
|
||||
|
||||
configIncludeContentItem.GetMetadataWithName("Link").Should().NotBeNull();
|
||||
configIncludeContentItem.GetMetadataWithName("Link").Value.Should().Be("/some/dir/%(FileName)%(Extension)");
|
||||
|
||||
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]
|
||||
|
@ -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.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(3);
|
||||
contentItems.Count().Should().Be(9);
|
||||
contentItems.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(4);
|
||||
|
||||
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)
|
||||
{
|
||||
buildOptionContentItem.GetMetadataWithName("Link").Should().BeNull();
|
||||
buildOptionContentItem.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("PreserveNewest");
|
||||
}
|
||||
|
||||
var configIncludeEncompassedItem = contentItems.FirstOrDefault(
|
||||
item => item.ConditionChain().Count() > 0
|
||||
&& item.Include == "root");
|
||||
&& item.Update == "root");
|
||||
configIncludeEncompassedItem.Should().BeNull();
|
||||
|
||||
var configIncludeContentItem = contentItems.First(
|
||||
item => item.ConditionChain().Count() > 0
|
||||
&& item.Include == "src");
|
||||
&& item.Update == "src");
|
||||
|
||||
var configIncludeContentItem2 = contentItems.First(
|
||||
item => item.ConditionChain().Count() > 0
|
||||
&& item.Include.Contains(@"src\file3.cs"));
|
||||
&& item.Update.Contains(@"src\file3.cs"));
|
||||
|
||||
var configRemoveContentItem = contentItems.First(
|
||||
item => item.ConditionChain().Count() > 0
|
||||
&& !string.IsNullOrEmpty(item.Remove));
|
||||
|
||||
configIncludeContentItem.Include.Should().Be("src");
|
||||
configIncludeContentItem.Excludes().Should().BeEquivalentTo("src", "rootfile.cs", @"src\rootfile.cs", @"src\file2.cs");
|
||||
|
||||
configIncludeContentItem.Update.Should().Be("src");
|
||||
configIncludeContentItem.GetMetadataWithName("Link").Should().NotBeNull();
|
||||
configIncludeContentItem.GetMetadataWithName("Link").Value.Should().Be("/some/dir/%(FileName)%(Extension)");
|
||||
configIncludeContentItem.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull();
|
||||
configIncludeContentItem.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("PreserveNewest");
|
||||
|
||||
configIncludeContentItem2.Includes().Should().BeEquivalentTo(@"src\file3.cs");
|
||||
configIncludeContentItem2.Exclude.Should().Be(@"src\file2.cs");
|
||||
configIncludeContentItem.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("Never");
|
||||
|
||||
configIncludeContentItem2.Updates().Should().BeEquivalentTo(@"src\file3.cs");
|
||||
configIncludeContentItem2.GetMetadataWithName("Link").Should().BeNull();
|
||||
configIncludeContentItem2.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull();
|
||||
configIncludeContentItem2.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("PreserveNewest");
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
public class GivenThatIWantToMigratePackOptions : TestBase
|
||||
{
|
||||
[Fact]
|
||||
public void It_does_not_migrate_Summary()
|
||||
public void ItDoesNotMigrateSummary()
|
||||
{
|
||||
var mockProj = RunPackOptionsRuleOnPj(@"
|
||||
{
|
||||
|
@ -28,7 +28,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void It_does_not_migrate_Owner()
|
||||
public void ItDoesNotMigrateOwner()
|
||||
{
|
||||
var mockProj = RunPackOptionsRuleOnPj(@"
|
||||
{
|
||||
|
@ -41,7 +41,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void Migrating__empty_tags_does_not_populate_PackageTags()
|
||||
public void MigratingEmptyTagsDoesNotPopulatePackageTags()
|
||||
{
|
||||
var mockProj = RunPackOptionsRuleOnPj(@"
|
||||
{
|
||||
|
@ -54,7 +54,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void Migrating_tags_populates_PackageTags_semicolon_delimited()
|
||||
public void MigratingTagsPopulatesPackageTagsSemicolonDelimited()
|
||||
{
|
||||
var mockProj = RunPackOptionsRuleOnPj(@"
|
||||
{
|
||||
|
@ -68,7 +68,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void Migrating_ReleaseNotes_populates_PackageReleaseNotes()
|
||||
public void MigratingReleaseNotesPopulatesPackageReleaseNotes()
|
||||
{
|
||||
var mockProj = RunPackOptionsRuleOnPj(@"
|
||||
{
|
||||
|
@ -83,7 +83,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void Migrating_IconUrl_populates_PackageIconUrl()
|
||||
public void MigratingIconUrlPopulatesPackageIconUrl()
|
||||
{
|
||||
var mockProj = RunPackOptionsRuleOnPj(@"
|
||||
{
|
||||
|
@ -98,7 +98,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void Migrating_ProjectUrl_populates_PackageProjectUrl()
|
||||
public void MigratingProjectUrlPopulatesPackageProjectUrl()
|
||||
{
|
||||
var mockProj = RunPackOptionsRuleOnPj(@"
|
||||
{
|
||||
|
@ -113,7 +113,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void Migrating_LicenseUrl_populates_PackageLicenseUrl()
|
||||
public void MigratingLicenseUrlPopulatesPackageLicenseUrl()
|
||||
{
|
||||
var mockProj = RunPackOptionsRuleOnPj(@"
|
||||
{
|
||||
|
@ -128,7 +128,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void Migrating_RequireLicenseAcceptance_populates_PackageRequireLicenseAcceptance()
|
||||
public void MigratingRequireLicenseAcceptancePopulatesPackageRequireLicenseAcceptance()
|
||||
{
|
||||
var mockProj = RunPackOptionsRuleOnPj(@"
|
||||
{
|
||||
|
@ -142,7 +142,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void Migrating_RequireLicenseAcceptance_populates_PackageRequireLicenseAcceptance_even_if_its_value_is_false()
|
||||
public void MigratingRequireLicenseAcceptancePopulatesPackageRequireLicenseAcceptanceEvenIfItsValueIsFalse()
|
||||
{
|
||||
var mockProj = RunPackOptionsRuleOnPj(@"
|
||||
{
|
||||
|
@ -156,7 +156,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void Migrating_Repository_Type_populates_RepositoryType()
|
||||
public void MigratingRepositoryTypePopulatesRepositoryType()
|
||||
{
|
||||
var mockProj = RunPackOptionsRuleOnPj(@"
|
||||
{
|
||||
|
@ -172,7 +172,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void Migrating_Repository_Url_populates_RepositoryUrl()
|
||||
public void MigratingRepositoryUrlPopulatesRepositoryUrl()
|
||||
{
|
||||
var mockProj = RunPackOptionsRuleOnPj(@"
|
||||
{
|
||||
|
@ -188,7 +188,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void Migrating_Files_without_mappings_populates_content_with_same_path_as_include_and_pack_true()
|
||||
public void MigratingFilesWithoutMappingsPopulatesContentWithSamePathAsIncludeAndPackTrue()
|
||||
{
|
||||
var mockProj = RunPackOptionsRuleOnPj(@"
|
||||
{
|
||||
|
@ -200,15 +200,57 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
}");
|
||||
|
||||
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");
|
||||
|
||||
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]
|
||||
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(@"
|
||||
{
|
||||
|
@ -223,19 +265,19 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
}");
|
||||
|
||||
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" &&
|
||||
item.GetMetadataWithName("PackagePath") != null);
|
||||
|
||||
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(
|
||||
Path.Combine("some", "other", "path"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Migrating_Files_with_mappings_to_root_populates_content_PackagePath_metadata_but_leaves_it_empty()
|
||||
public void MigratingFilesWithMappingsToRootPopulatesContentPackagePathMetadataButLeavesItEmpty()
|
||||
{
|
||||
var mockProj = RunPackOptionsRuleOnPj(@"
|
||||
{
|
||||
|
@ -250,18 +292,18 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
}");
|
||||
|
||||
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" &&
|
||||
item.GetMetadataWithName("PackagePath") != null);
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Migrating_same_file_with_multiple_mappings_string_joins_the_mappings_in_PackagePath()
|
||||
public void MigratingSameFileWithMultipleMappingsStringJoinsTheMappingsInPackagePath()
|
||||
{
|
||||
var mockProj = RunPackOptionsRuleOnPj(@"
|
||||
{
|
||||
|
@ -284,13 +326,13 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
});
|
||||
|
||||
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" &&
|
||||
item.GetMetadataWithName("PackagePath") != null);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -414,7 +414,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
|
||||
mockProj.Items.Should().NotContain(
|
||||
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]
|
||||
|
@ -436,7 +436,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
mockProj.Items.Should().NotContain(
|
||||
i => i.Include == "Microsoft.NETCore.App" && i.ItemType == "PackageReference");
|
||||
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");
|
||||
}
|
||||
|
||||
|
@ -457,7 +457,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
mockProj.Items.Should().NotContain(
|
||||
i => i.Include == "Microsoft.NETCore.App" && i.ItemType == "PackageReference");
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
|
@ -9,11 +9,13 @@ using System;
|
|||
|
||||
namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
||||
{
|
||||
public class GivenThatIWantToMigratePackagesToTheirLTSVersions : PackageDependenciesTestBase
|
||||
public class GivenThatIWantToMigratePackagesToTheirLTSAndFTSVersions : PackageDependenciesTestBase
|
||||
{
|
||||
[Theory]
|
||||
[InlineData("1.0.0", "1.0.3")]
|
||||
[InlineData("1.0.3-preview2", "1.0.3")]
|
||||
[InlineData("1.0.0", "1.0.4")]
|
||||
[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(
|
||||
string sourceVersion,
|
||||
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.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.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(
|
||||
string sourcePackageName,
|
||||
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.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", "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(
|
||||
string sourcePackageName,
|
||||
string sourceVersion,
|
||||
|
@ -228,11 +257,17 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("Microsoft.Extensions.Logging", "1.0.0", "Microsoft.Extensions.Logging", "1.0.1")]
|
||||
[InlineData("Microsoft.Extensions.Logging.Console", "1.0.0", "Microsoft.Extensions.Logging.Console", "1.0.1")]
|
||||
[InlineData("Microsoft.Extensions.Logging.Debug", "1.0.0", "Microsoft.Extensions.Logging.Debug", "1.0.1")]
|
||||
[InlineData("Microsoft.Extensions.Configuration.Json", "1.0.0", "Microsoft.Extensions.Configuration.Json", "1.0.1")]
|
||||
[InlineData("Microsoft.Extensions.Configuration.UserSecrets", "1.0.0", "Microsoft.Extensions.Configuration.UserSecrets", "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.2")]
|
||||
[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.2")]
|
||||
[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(
|
||||
string sourcePackageName,
|
||||
string sourceVersion,
|
|
@ -32,24 +32,39 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
}",
|
||||
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);
|
||||
|
||||
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.Exclude.Should().Be(@"src\file2.cs");
|
||||
item.Update.Should().Be(@"src\file1.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
|
||||
{
|
||||
item.Include.Should()
|
||||
.Be(@"root\**\*;src\**\*;rootfile.cs");
|
||||
|
||||
item.Exclude.Should()
|
||||
.Be(@"src\**\*;rootfile.cs;src\file2.cs");
|
||||
item.Update.Should().Be(@"src\**\*;rootfile.cs");
|
||||
item.Exclude.Should().BeEmpty();
|
||||
item.Metadata.Count(m =>
|
||||
m.Name == "CopyToPublishDirectory" && m.Value == "Never").Should().Be(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -82,21 +97,39 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
}",
|
||||
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);
|
||||
|
||||
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.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
|
||||
{
|
||||
item.Update.Should().Be(@"root\**\*;src\**\*;rootfile.cs");
|
||||
item.Update.Should().Be(@"src\**\*;rootfile.cs");
|
||||
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);
|
||||
|
||||
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)
|
||||
var defaultIncludePatterns = 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)))
|
||||
{
|
||||
if (item.Include.Contains(@"root\**\*"))
|
||||
if (item.Update.Contains(@"root\**\*"))
|
||||
{
|
||||
item.Include.Should().Be(@"root\**\*");
|
||||
item.Exclude.Should().Be(@"src\**\*;rootfile.cs;src\file3.cs");
|
||||
item.Update.Should().Be(@"root\**\*");
|
||||
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.Exclude.Should().Be(@"src\file2.cs;src\file3.cs");
|
||||
item.Update.Should().Be(@"src\file1.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
|
||||
{
|
||||
item.Include.Should()
|
||||
item.Update.Should()
|
||||
.Be(@"src\**\*;rootfile.cs");
|
||||
|
||||
item.Exclude.Should()
|
||||
.Be(@"src\**\*;rootfile.cs;src\file2.cs;src\file3.cs");
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -189,35 +237,84 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
}",
|
||||
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)
|
||||
var defaultIncludePatterns = 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));
|
||||
Console.WriteLine($"LICAVALC: Update: {item.Update}, Include: {item.Include}, Metadata: {metadata}");
|
||||
|
||||
if (item.Update.Contains(@"root\**\*"))
|
||||
{
|
||||
item.Update.Should().Be(@"root\**\*;src\**\*;rootfile.cs");
|
||||
item.Update.Should().Be(@"root\**\*");
|
||||
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"))
|
||||
{
|
||||
item.Update.Should().Be(@"src\file1.cs;src\file2.cs");
|
||||
item.Update.Should().Be(@"src\file1.cs");
|
||||
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
|
||||
{
|
||||
item.Update.Should().Be(@"src\**\*;rootfile.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 == "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)
|
||||
{
|
||||
Directory.CreateDirectory(Path.Combine(testDirectory, "root"));
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void MigratingCoreAndDesktopTFMsAddsAllRuntimeIdentifiersIfTheProjectDoesNothaveAnyAlready()
|
||||
public void MigratingCoreAndDesktopTFMsDoesNoAddRuntimeIdentifiersOrRuntimeIdentifierWhenTheProjectDoesNothaveAnyAlready()
|
||||
{
|
||||
var testDirectory = Temp.CreateDirectory().Path;
|
||||
var testPJ = new ProjectJsonBuilder(TestAssets)
|
||||
|
@ -88,35 +88,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
|
||||
new MigrateTFMRule().Apply(migrationSettings, migrationInputs);
|
||||
|
||||
mockProj.Properties.Count(p => p.Name == "RuntimeIdentifiers").Should().Be(1);
|
||||
mockProj.Properties.First(p => p.Name == "RuntimeIdentifiers")
|
||||
.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' ");
|
||||
mockProj.Properties.Count(p => p.Name == "RuntimeIdentifiers").Should().Be(0);
|
||||
mockProj.Properties.Count(p => p.Name == "RuntimeIdentifier").Should().Be(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -144,7 +117,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void MigratingProjectWithFullFrameworkTFMsOnlyAddsARuntimeIdentifierWin7x86WhenNoRuntimesExistAlready()
|
||||
public void MigratingProjectWithFullFrameworkTFMsDoesNotAddRuntimeIdentifiersOrRuntimeIdentiferWhenNoRuntimesExistAlready()
|
||||
{
|
||||
var testDirectory = Temp.CreateDirectory().Path;
|
||||
var testPJ = new ProjectJsonBuilder(TestAssets)
|
||||
|
@ -165,8 +138,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
new MigrateTFMRule().Apply(migrationSettings, migrationInputs);
|
||||
|
||||
mockProj.Properties.Count(p => p.Name == "RuntimeIdentifiers").Should().Be(0);
|
||||
mockProj.Properties.Where(p => p.Name == "RuntimeIdentifier").Should().HaveCount(1);
|
||||
mockProj.Properties.Single(p => p.Name == "RuntimeIdentifier").Value.Should().Be("win7-x86");
|
||||
mockProj.Properties.Where(p => p.Name == "RuntimeIdentifier").Should().HaveCount(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
@ -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.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.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(
|
||||
string sourceToolName,
|
||||
string sourceVersion,
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,6 +19,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
{
|
||||
protected const string DefaultFramework = "netcoreapp1.0";
|
||||
protected const string DefaultLibraryFramework = "netstandard1.5";
|
||||
protected const string ConsoleLoggerOutputNormal = "--logger:console;verbosity=normal";
|
||||
private TempRoot _temp;
|
||||
private static TestAssets s_testAssets;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace Microsoft.DotNet.Cli.Build.Tests
|
|||
|
||||
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");
|
||||
|
||||
var outputRunCommand = new TestCommand("dotnet");
|
||||
|
@ -46,7 +46,7 @@ namespace Microsoft.DotNet.Cli.Build.Tests
|
|||
string dir = "pkgs";
|
||||
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()
|
||||
.WithWorkingDirectory(rootPath)
|
||||
.Execute(newArgs)
|
||||
|
@ -65,7 +65,12 @@ namespace Microsoft.DotNet.Cli.Build.Tests
|
|||
.Execute()
|
||||
.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");
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -224,10 +224,10 @@ namespace Microsoft.DotNet.Migration.Tests
|
|||
outputDir.Should().Exist()
|
||||
.And.HaveFiles(new[]
|
||||
{
|
||||
"ContentFile1.txt",
|
||||
"ContentFile2.txt",
|
||||
"ContentFileBuiltIn1.txt",
|
||||
"ContentFileBuiltIn2.txt",
|
||||
"ContentFile1.txt1",
|
||||
"ContentFile2.txt1",
|
||||
"ContentFileBuiltIn1.txt1",
|
||||
"ContentFileBuiltIn2.txt1",
|
||||
"IncludeThis.txt",
|
||||
});
|
||||
Directory.Exists(Path.Combine(outputDir.FullName, "ExcludeThis1.txt")).Should().BeFalse();
|
||||
|
@ -237,10 +237,10 @@ namespace Microsoft.DotNet.Migration.Tests
|
|||
publishDir.Should().Exist()
|
||||
.And.HaveFiles(new[]
|
||||
{
|
||||
"ContentFile1.txt",
|
||||
"ContentFile2.txt",
|
||||
"ContentFileBuiltIn1.txt",
|
||||
"ContentFileBuiltIn2.txt",
|
||||
"ContentFile1.txt1",
|
||||
"ContentFile2.txt1",
|
||||
"ContentFileBuiltIn1.txt1",
|
||||
"ContentFileBuiltIn2.txt1",
|
||||
"IncludeThis.txt",
|
||||
});
|
||||
Directory.Exists(Path.Combine(publishDir.FullName, "ExcludeThis1.txt")).Should().BeFalse();
|
||||
|
@ -431,6 +431,12 @@ namespace Microsoft.DotNet.Migration.Tests
|
|||
.Execute("build -c Debug")
|
||||
.Should().Pass();
|
||||
|
||||
if (!EnvironmentInfo.HasSharedFramework("netcoreapp1.0"))
|
||||
{
|
||||
// running the app requires netcoreapp1.0
|
||||
return;
|
||||
}
|
||||
|
||||
var cmd = new DotnetCommand()
|
||||
.WithWorkingDirectory(projectDirectory)
|
||||
.ExecuteWithCapturedOutput("run -c Debug");
|
||||
|
@ -483,6 +489,12 @@ namespace Microsoft.DotNet.Migration.Tests
|
|||
.Execute("build -c Debug")
|
||||
.Should().Pass();
|
||||
|
||||
if (!EnvironmentInfo.HasSharedFramework("netcoreapp1.0"))
|
||||
{
|
||||
// running the app requires netcoreapp1.0
|
||||
return;
|
||||
}
|
||||
|
||||
var cmd = new DotnetCommand()
|
||||
.WithWorkingDirectory(projectDirectory)
|
||||
.ExecuteWithCapturedOutput("run -c Debug");
|
||||
|
@ -534,6 +546,12 @@ namespace Microsoft.DotNet.Migration.Tests
|
|||
.Execute("build -c Debug")
|
||||
.Should().Pass();
|
||||
|
||||
if (!EnvironmentInfo.HasSharedFramework("netcoreapp1.0"))
|
||||
{
|
||||
// running the app requires netcoreapp1.0
|
||||
return;
|
||||
}
|
||||
|
||||
var cmd = new DotnetCommand()
|
||||
.WithWorkingDirectory(projectDirectory)
|
||||
.ExecuteWithCapturedOutput("run -c Debug");
|
||||
|
|
|
@ -95,7 +95,7 @@ namespace Microsoft.DotNet.Migration.Tests
|
|||
{
|
||||
MigrateAndBuild(
|
||||
"NonRestoredTestProjects",
|
||||
"PJAppWithSlnAndXprojRefThatRefsCsprojWhereSlnDoesNotRefCsproj");
|
||||
"PJAppWithSlnThatDoesNotRefCsproj");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -229,11 +229,10 @@ namespace Microsoft.DotNet.Migration.Tests
|
|||
.Execute($"restore \"{solutionRelPath}\"")
|
||||
.Should().Pass();
|
||||
|
||||
//ISSUE: https://github.com/dotnet/cli/issues/5205
|
||||
//new DotnetCommand()
|
||||
// .WithWorkingDirectory(projectDirectory)
|
||||
// .Execute($"build \"{solutionRelPath}\"")
|
||||
// .Should().Pass();
|
||||
new DotnetCommand()
|
||||
.WithWorkingDirectory(projectDirectory)
|
||||
.Execute($"build \"{solutionRelPath}\"")
|
||||
.Should().Pass();
|
||||
}
|
||||
|
||||
private void MigrateAndBuild(string groupName, string projectName, [CallerMemberName] string callingMethod = "", string identifier = "")
|
||||
|
@ -257,11 +256,10 @@ namespace Microsoft.DotNet.Migration.Tests
|
|||
.Execute($"restore \"{solutionRelPath}\"")
|
||||
.Should().Pass();
|
||||
|
||||
//ISSUE: https://github.com/dotnet/cli/issues/5205
|
||||
//new DotnetCommand()
|
||||
// .WithWorkingDirectory(projectDirectory)
|
||||
// .Execute($"build \"{solutionRelPath}\"")
|
||||
// .Should().Pass();
|
||||
new DotnetCommand()
|
||||
.WithWorkingDirectory(projectDirectory)
|
||||
.Execute($"build \"{solutionRelPath}\"")
|
||||
.Should().Pass();
|
||||
|
||||
SlnFile slnFile = SlnFile.Read(Path.Combine(projectDirectory.FullName, solutionRelPath));
|
||||
|
||||
|
|
|
@ -492,7 +492,7 @@ namespace Microsoft.DotNet.Migration.Tests
|
|||
}
|
||||
|
||||
outputsIdentical.Should().BeTrue();
|
||||
|
||||
|
||||
VerifyAllMSBuildOutputsRunnable(projectDirectory);
|
||||
}
|
||||
|
||||
|
@ -543,7 +543,7 @@ namespace Microsoft.DotNet.Migration.Tests
|
|||
.And.Contain("Migration failed.");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[RequiresSpecificFrameworkFact("netcoreapp1.0")]
|
||||
public void ItMigratesAndPublishesProjectsWithRuntimes()
|
||||
{
|
||||
var projectName = "PJTestAppSimple";
|
||||
|
@ -745,6 +745,12 @@ namespace Microsoft.DotNet.Migration.Tests
|
|||
|
||||
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 runnableDlls = projectDirectory
|
||||
|
|
|
@ -8,5 +8,6 @@
|
|||
<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="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>
|
||||
</configuration>
|
|
@ -7,5 +7,6 @@
|
|||
<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="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>
|
||||
</configuration>
|
|
@ -32,11 +32,11 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
|
|||
|
||||
new PublishCommand()
|
||||
.WithWorkingDirectory(testProjectDirectory)
|
||||
.Execute("--framework netcoreapp1.0")
|
||||
.Execute("--framework netcoreapp1.1")
|
||||
.Should().Pass();
|
||||
|
||||
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")
|
||||
.ExecuteWithCapturedOutput(outputDll)
|
||||
|
@ -59,7 +59,7 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
|
|||
var rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier();
|
||||
|
||||
new PublishCommand()
|
||||
.WithFramework("netcoreapp1.0")
|
||||
.WithFramework("netcoreapp1.1")
|
||||
.WithRuntime(rid)
|
||||
.WithWorkingDirectory(testProjectDirectory)
|
||||
//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 outputProgram = testProjectDirectory
|
||||
.GetDirectory("bin", configuration, "netcoreapp1.0", rid, "publish", $"{testAppName}{Constants.ExeSuffix}")
|
||||
.GetDirectory("bin", configuration, "netcoreapp1.1", rid, "publish", $"{testAppName}{Constants.ExeSuffix}")
|
||||
.FullName;
|
||||
|
||||
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
|
@ -94,7 +94,7 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
|
|||
string dir = "pkgs";
|
||||
string args = $"--packages {dir}";
|
||||
|
||||
string newArgs = $"console -o \"{rootPath}\"";
|
||||
string newArgs = $"console -f netcoreapp1.1 -o \"{rootPath}\"";
|
||||
new NewCommandShim()
|
||||
.WithWorkingDirectory(rootPath)
|
||||
.Execute(newArgs)
|
||||
|
|
|
@ -75,7 +75,7 @@ namespace Microsoft.DotNet.Cli.Run.Tests
|
|||
|
||||
new RunCommand()
|
||||
.WithWorkingDirectory(testProjectDirectory)
|
||||
.ExecuteWithCapturedOutput("--framework netcoreapp1.0")
|
||||
.ExecuteWithCapturedOutput("--framework netcoreapp1.1")
|
||||
.Should().Pass()
|
||||
.And.HaveStdOutContaining("Hello World!");
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ namespace Microsoft.DotNet.Cli.Run.Tests
|
|||
string dir = "pkgs";
|
||||
string args = $"--packages {dir}";
|
||||
|
||||
string newArgs = $"console -o \"{rootPath}\"";
|
||||
string newArgs = $"console -f netcoreapp1.1 -o \"{rootPath}\"";
|
||||
new NewCommandShim()
|
||||
.WithWorkingDirectory(rootPath)
|
||||
.Execute(newArgs)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue