Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Migrate to MSBuild #5852

Merged
merged 1 commit into from
Mar 1, 2017
Merged

Migrate to MSBuild #5852

merged 1 commit into from
Mar 1, 2017

Conversation

dougbu
Copy link
Member

@dougbu dougbu commented Feb 23, 2017

Rebase nimullen/migration branch from PR #5749 and carry on from there. See descriptions of individual commits for more detail.

Current status: Command-line builds work cleanly. Mvc.NoFun.sln and Mvc.OnlyFun.sln generally load, build, and test cleanly in Visual Studio. Still experiencing some "Non responsive" periods and slow loads, especially if solution is loaded at same time as VS is started. Mvc.sln still tends to hang VS.

Will file a few more bugs (mostly around C# editing performance and testing experience) and add them to #5482. Have already checked off fixed bugs in #5482.

@dougbu
Copy link
Member Author

dougbu commented Feb 23, 2017

@natemcmaster @pranavkm @Eilon please have a look at this instead of #5749. But note pushing remains blocked on VS issues.

@dougbu dougbu mentioned this pull request Feb 23, 2017
<PackageReference Include="Microsoft.AspNetCore.Routing" Version="1.2.0-*" />
<PackageReference Include="Microsoft.AspNetCore.Routing.DecisionTree.Sources" Version="1.2.0-*" PrivateAssets="All" />
<PackageReference Include="Microsoft.Extensions.ClosedGenericMatcher.Sources" Version="1.2.0-*" PrivateAssets="All" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="1.1.0-*" />
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the correct version of this package?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a 2.0.0 version being built...https://github.com/dotnet/core-setup/blob/master/src/Microsoft.Extensions.DependencyModel/. Let's add that to the list of things we upgrade when we move everything to netstandard2.0 / .NET Core 2.0. cref aspnet/Coherence#166

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'd leave this pinned at 1.1.0 since that's the version that corresponds to NETStandard.Library 1.6.1

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pranavkm do you mean this should be 1.1.0 and not 1.1.0-*?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup - the 1.1.0 package exists on nuget.org, so that's the build that'll get used: https://www.nuget.org/packages/Microsoft.Extensions.DependencyModel/1.1.0

<PropertyGroup>
<TargetFrameworks>net452;netcoreapp1.1</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">netcoreapp1.1</TargetFrameworks>
<RuntimeIdentifier Condition=" '$(TargetFramework)' != 'netcoreapp1.1' ">win7-x64</RuntimeIdentifier>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hesitate to remove this because confirming everything works in command-line and VS runs as well as our functional tests might miss something. Have at least confirmed the Microsoft.NET.Sdk.Web targets do not contain anything similar.

Anyone know if these lines in the web site project files can be removed?

<PropertyGroup>
<TargetFrameworks>netcoreapp1.1;net452</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">netcoreapp1.1</TargetFrameworks>
<PreserveCompilationContext>true</PreserveCompilationContext>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was present in may test project.json files. But, was actually needed only in 2 test projects.

if (type == null)
{
type = typeof(ViewComponentTagHelperDescriptorFactoryTest).GetMethod("MethodWithOutParam").GetParameters().First().ParameterType;
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ajaybhargavb did you file a bug about the serialization / deserialization problems with the out List<char*[]> parameter's Type? Would like to reference it here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW I suspect the issue is actually in serialization -- ends up as an open generic List<> type.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not yet. I was waiting for your PR to repro this issue. I'll link it here once I am done.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this bug introduced by converting to C# 7.0? We had a few other, minor problems when switching to the new compiler.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we split this out in to a separate test? GetCSharpTypeName_ReturnsCorrectTypeNames_ForOutParameters? This is kinda ugly

<PackageReference Include="Microsoft.Extensions.PropertyHelper.Sources" Version="1.2.0-*" PrivateAssets="All" />
<PackageReference Include="Microsoft.Extensions.SecurityHelper.Sources" Version="1.2.0-*" PrivateAssets="All" />
<PackageReference Include="System.Buffers" Version="$(CoreFxVersion)-*" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="$(CoreFxVersion)-*" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be "Version="$(CoreFxVersion)". Leave the -* off. This is true in many places in this and other files.

<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Mvc\Microsoft.AspNetCore.Mvc.csproj" />
<ProjectReference Include="..\Microsoft.AspNetCore.Mvc.TestCommon\Microsoft.AspNetCore.Mvc.TestCommon.csproj" />

<PackageReference Include="Microsoft.DotNet.InternalAbstractions" Version="1.0.0" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you try removing this? IIRC this was added because early builds of xunit needed it. This has since been fixed.

Unless, of course, this project uses API from that package. In which case, switch this to Microsoft.DotNet.PlatformAbstractions/1.1.0 instead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Taylor tried this earlier, but we might have had newer packages since.

<ProjectReference Include="..\Microsoft.AspNetCore.Mvc.TestCommon\Microsoft.AspNetCore.Mvc.TestCommon.csproj" />

<PackageReference Include="Microsoft.AspNetCore.Http" Version="1.2.0-*" />
<PackageReference Include="Microsoft.DotNet.InternalAbstractions" Version="1.0.0" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto...repeat for all test projects.

<PropertyGroup>
<TargetFrameworks>netcoreapp1.1;</TargetFrameworks>
<DefineConstants>$(DefineConstants);__RemoveThisBitTo__GENERATE_BASELINES;FUNCTIONAL_TESTS</DefineConstants>
<PackageTargetFallback>$(PackageTargetFallback);portable-net451+win8</PackageTargetFallback>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are we using that still requires this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See @pranavkm's comment about the WebApiCompatShim project. #5822 should cover removing these last couple of fallbacks.

<Import Project="..\..\build\common.props" />

<PropertyGroup>
<TargetFrameworks>netcoreapp1.1;</TargetFrameworks>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: use the singular form. <TargetFramework>netcoreapp1.1</TargetFramework>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably add a tracking bug to re-add net4x testing. I forget why we decided to skip desktop here.


<ItemGroup>
<EmbeddedResource Include="EmbeddedResources\**" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" />
<Content Update="sample.txt;web.config">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sure don't need web.config here, might not need sample.txt. The SDK will pick up web.config by default.

</PropertyGroup>

<ItemGroup>
<EmbeddedResource Include="EmbeddedResources\**" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove the Exclude attribute here as the "Include" wouldn't match up with anything in the Exclude patterns.

<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="1.2.0-*" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net452' ">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: keep all property groups together at the top of the top file.

Also, why are these necessary? The SDK already defines contants per-TFM.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're trying to verify that conditional constants defined in the project are available to views.

<PropertyGroup>
<TargetFrameworks>net452;netstandard1.3</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">netstandard1.3</TargetFrameworks>
<AssemblyName>UserClassLibrary</AssemblyName>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: both AssemblyName and PackageId aren't required here. These are the default values.

build/repo.props Outdated
<ItemGroup>
<ExcludeFromTest Include="$(RepositoryRoot)test\Microsoft.AspNetCore.Mvc.TestCommon\*.csproj" />
<!-- Exclude with and without extra slash in case DefaultItems.targets is fixed. -->
<ExcludeSolutions Include="$(RepositoryRoot)\Mvc.*Fun.sln" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. Open an issue on KoreBuild.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@pranavkm pranavkm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

<PackageReference Include="Microsoft.AspNetCore.Routing" Version="1.2.0-*" />
<PackageReference Include="Microsoft.AspNetCore.Routing.DecisionTree.Sources" Version="1.2.0-*" PrivateAssets="All" />
<PackageReference Include="Microsoft.Extensions.ClosedGenericMatcher.Sources" Version="1.2.0-*" PrivateAssets="All" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="1.1.0-*" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'd leave this pinned at 1.1.0 since that's the version that corresponds to NETStandard.Library 1.6.1


<PropertyGroup>
<TargetFrameworks>net452;netcoreapp1.1</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">netcoreapp1.1</TargetFrameworks>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably don't need this in test apps. The issue is running tests on xplat, but compiling it should be fine.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙈 not much point in compiling these and it adds at least 10s to a Linux build in my testing. Probably more since I only compared build-compile runs.

<TargetFrameworks>net452;netcoreapp1.1</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">netcoreapp1.1</TargetFrameworks>
<RuntimeIdentifier Condition=" '$(TargetFramework)' != 'netcoreapp1.1' ">win7-x64</RuntimeIdentifier>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😮

<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="1.2.0-*" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net452' ">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're trying to verify that conditional constants defined in the project are available to views.

<Import Project="..\..\..\build\common.props" />

<PropertyGroup>
<TargetFrameworks>net452;netcoreapp1.1</TargetFrameworks>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this missing the preserveCompilationContext flag from the project.json. I think project.json required an executable to produce a deps file.

</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.1' ">
<PackageReference Include="System.Xml.XmlDocument" Version="$(CoreFxVersion)-*" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still needed? The Formatter project should bring in this reference

if (type == null)
{
type = typeof(ViewComponentTagHelperDescriptorFactoryTest).GetMethod("MethodWithOutParam").GetParameters().First().ParameterType;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we split this out in to a separate test? GetCSharpTypeName_ReturnsCorrectTypeNames_ForOutParameters? This is kinda ugly

<PropertyGroup>
<TargetFrameworks>netcoreapp1.1;net452</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">netcoreapp1.1</TargetFrameworks>
<DefineConstants>$(DefineConstants);__RemoveThisBitTo__GENERATE_BASELINES</DefineConstants>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<DefineConstants Condition="'$(GenerateBaselines)'=='true'">$(DefineConstants);GENERATE_BASELINES</DefineConstants>
<DefineConstants>$(DefineConstants);__RemoveThisBitTo__GENERATE_BASELINES</DefineConstants>

this lets you do dotnet test /p:GenerateBaseLines:true to produce baselines without editing any files. The second one exists as an option inside VS.

<Import Project="..\..\build\common.props" />

<PropertyGroup>
<TargetFrameworks>netcoreapp1.1;</TargetFrameworks>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably add a tracking bug to re-add net4x testing. I forget why we decided to skip desktop here.

<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Mvc\Microsoft.AspNetCore.Mvc.csproj" />
<ProjectReference Include="..\Microsoft.AspNetCore.Mvc.TestCommon\Microsoft.AspNetCore.Mvc.TestCommon.csproj" />

<PackageReference Include="Microsoft.DotNet.InternalAbstractions" Version="1.0.0" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Taylor tried this earlier, but we might have had newer packages since.

@dougbu dougbu force-pushed the dougbu/migration branch 3 times, most recently from 91285cb to d350769 Compare February 26, 2017 22:00
@dougbu
Copy link
Member Author

dougbu commented Feb 26, 2017

🆙📅

Not sure why the AppVeyor build failed. Many functional tests hit issues in .NET 4.5.2 runs. Every failure I've seen was a MissingMethodException hit in Microsoft.CodeAnalysis.Razor.TagHelperTypeVisitor.Create() calls. Haven't reproduced this locally but am trying things out with all the latest packages…

@dougbu
Copy link
Member Author

dougbu commented Feb 26, 2017

… bizarre but the AppVeyor failures do not reproduce locally, even after .\.build\nuget.exe locals all -clear and git clean -dfx. And, the dev branch seems to build fine as well. Redoing the AppVeyor build of this PR…

@dougbu
Copy link
Member Author

dougbu commented Feb 27, 2017

… latest AppVeyor build of this PR failed in the same way. Will try to mimic AppVeyor environment locally…

@natemcmaster
Copy link
Contributor

Talked with Doug in person. It appears the tests no longer pass when .NET Framework 4.6.2 is installed, which is causing the AppVeyor failures. We should look into this as it might be a bug in BCL or Roslyn.

@dougbu
Copy link
Member Author

dougbu commented Feb 27, 2017

🆙📅 FYI only. I squashed my changes since nimullen/migration.

@dougbu
Copy link
Member Author

dougbu commented Feb 27, 2017

It appears the tests no longer pass when .NET Framework 4.6.2 is installed, which is causing the AppVeyor failures.

I was wrong; .NET 4.6.2 is installed on my machine. Must be some other difference between my machine and AppVeyor and @natemcmaster's machine.

- thanx to @NTaylorMullen for initial conversion
  - e.g. AssemblyInfo.cs files were already minimized or removed :)
- allow `>=` RC3 CLI's to build and run MVC
- work around several dotnet migration issues; see #5482
- disable full .NET Framework runs of functional tests; see #5873
- remove `Microsoft.DotNet.InternalAbstractions` and `System.Xml.XmlDocument` dependencies
- remove project.json (!!), *.xproj, .notest, and web.config files

Redo earlier changes:
- apply test migration to .NET 4.5.2 in *.csproj world
  - see 63507c8 for previous, project.json work
- apply dependency version downgrade from 0097e40 in *.csproj world

Make other test-related changes:
- make Microsoft.AspNetCore.Mvc.TestDiagnosticListener a regular class library
- add support for `/p:GenerateBaselines=true` for functional and Razor.Host tests
- separate `GetCSharpTypeName_ReturnsCorrectTypeNames_ForOutParameter()` test
  - work around inability to deserialize a odd `ref` type
  - xUnit and vstest now serialize / deserialze test data more often
- skip poor test mentioned in #5768
- work around microsoft/vstest#392
  - rename tests to avoid duplicates
- work around microsoft/vstest#419
  - set up created `AppDomain`s with current `ApplicationBase`
@dougbu dougbu merged commit acfad83 into dev Mar 1, 2017
@dougbu
Copy link
Member Author

dougbu commented Mar 1, 2017

acfad83

@natemcmaster
Copy link
Contributor

🎉

@dougbu dougbu deleted the dougbu/migration branch March 29, 2017 21:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants