Repository navigation
Closed
Description
Libraries Build will now be using dotnet sdk outerbuild and innerbuild infrastructure to build the BCL.
Configurations.props file will no longer be required. TargetFrameworks can be directly used instead of BuildConfigurations.
I will just summarize the build and VS experience changes for the dotnet community.
Build Changes
- We are no longer overloading the configuration property. The only allowable configurations are Debug and Release. ConfigurationGroup property is replaced by Configuration.
- TargetGroup property has also been removed. We will use the Target Framework and TargetFrameworkSuffix(refers to the OSGroup in the TargetFrameworks if present) properties in the csproj file to specify the conditions. You can also still keep using TargetsWindows\Unix\Linux properties.
BuildTargetFramework is the new property which will be used for vertical build. For Building Individual Projects, you can use either TargetFramework or BuildTargetFramework to build against a specific TargetFramework.
The default is netcoreapp5.0.
TargetFramework can only be used to build one project. It cannot be used to build more than one projects and it can contain an osgroup as well eg you can build the project /p:TargetFramework=netcoreapp5.0-windows_NT. It will result in sdk running only the innerBuild for specified framework.
BuildTargetFramework can be used for a vertical build as well as for individual project build. In case of an individual project it will result in outerBuild triggering an innerBuild by setting the TargetFramework to best supported framework. - BuildConfigurations are replaced by TargetFrameworks property. Currently we will always have to use TargetFrameworks property in our csprojs to specify the supported frameworks even if its only one. (TargetFramework in csproj file wont work)
- PackageConfigurations have also been removed. By default all TargetFrameworks will be included in the package. You can remove the TargetFramework from a package by specifically setting ExcludeFromPackage property = true for the specific targetFramework. Eg
<ExcludeFromPackage Condition="'$(TargetFramework)' != 'netstandard2.0'">true</ExcludeFromPackage>- There hasn’t been any change in how we build our allConfigurations leg
VS Experience Changes
- Editor experience has improved as you will now able to choose the TargetFramework from the dropdown menu for individual files.
- By default, the vs builds all netcoreapp5.0 TargetFrameworks i.e if a project builds for netcoreapp5.0-WindowsNT, netcoreapp5.0-Unix, Building the project from the VS will result in building for both the target Frameworks.
However, you can build for more TargetFrameworks by setting AdditionalBuildTargetFrameworks property. - The testing experience is mostly the same i.e launch with -VS switch and debug or run tests using test explorer.
Some Benefits Besides Cleanup
- This is the first step towards enabling restore for src and ref csprojs and removing deprojs.
- We can use now common msbuild properties with coreclr and installer subsets eg Earlier we were using ConfigurationGroup and everything else was using Configuration.
- We can now enable running tests in VS for net472.
- The build is faster.
@ericstj @ViktorHofer @safern feel free to edit and add benefits.
PR making the change #1787
cc @danmosemsft
Reacted by Viktor Hofer, Santiago Fernandez Madero, D3-LucaPiombino, Kevin Jones, Eric StJohn, David Cantú and Dan Moseley
Reacted by Viktor Hofer, Ganbarukamo41, D3-LucaPiombino, Eric StJohn and Dan Moseley
Reacted by Viktor Hofer and Eric StJohn
Activity
danmoseley commentedon Feb 5, 2020
Yay - especially for the Visual Studio improvements.
ViktorHofer commentedon Feb 5, 2020
What about netstandard2.0 and 2.1? Aren't those implicit as well?
safern commentedon Feb 5, 2020
FYI: I just pinned the issue so that it is visible.
[-]Build and VS Experience Changes due to the new build system[/-][+]Libraries Build and VS Experience Changes due to the new build system[/+][-]Libraries Build and VS Experience Changes due to the new build system[/-][+]Libraries Build and VS Experience Changes[/+]ViktorHofer commentedon Feb 5, 2020
I changed the title to indicate that this is only about libraries (for now).
EgorBo commentedon Feb 6, 2020
What's the current workflow to run a specific test suite?
e.g. I follow the doc: https://github.com/dotnet/runtime/blob/master/docs/workflow/testing/libraries/testing.md#running-tests-on-the-command-line, e.g.:
I get
if I specify
/p:TargetFramework=netcoreapp5.0I getViktorHofer commentedon Feb 6, 2020
This sounds like you haven't built libraries with a Release configuration from root first:
.\libraries.cmd -c Release.EgorBo commentedon Feb 6, 2020
Didn't help 😢
safern commentedon Feb 6, 2020
The path is searching on
Debug. Can you confirm you're passing down/p:Configuration=Releaseadamsitnik commentedon Feb 6, 2020
I got a very similar error.
18 remaining items
danmoseley commentedon Apr 3, 2020
Since we're just talking about renaming test methods it should be possible for any one of us to review the whole thing. If there are distinct parts then separate commits might be helpful.
danmoseley commentedon Apr 8, 2020
@alexvy86 now your PR is merged, how is the VS experience? Do most (all?) test projects run clean in VS now for you?
alexvy86 commentedon Apr 8, 2020
@danmosemsft it's hard to say, I've only tried opening a few in VS, and lately I've been running into new issues with that. At some point I was able to run tests for
System.Text.Jsonin VS, that's how I took some of the initial screenshots, but right now test discovery is failing.System.ComponentModel.TypeConvertertakes a ton of time discovering tests... Once I was able to debug one particular test, but ever since when I try to debug it, breakpoints won't get hit (they say symbols are not loaded for the project... but it is the project that I have open in VS!), and complains about missing symbols for something related to xUnit, after an Assert already failed.I'm not sure how much of this is messed up configuration in my machine/environment and how much related to changes in the repo. I'll keep playing around with all of this and post any updates.
danmoseley commentedon Apr 8, 2020
OK, thanks. It would be great to enumerate issues and perhaps we can keep making progress.
alexvy86 commentedon Apr 8, 2020
Of note, I haven't gone back to
master, all of this is in the branch I created for the PR. I'll start testing back in master now that it got merged.danmoseley commentedon Apr 8, 2020
Note there were some recent changes to how building is done: #33821
You may want to
git clean -fdxafter pulling, and use the new commands own.safern commentedon Apr 8, 2020
Maybe you built coreclr in
Debugmode?Note that you also need to install the latest daily build of the SDK once you pull from master as we updated the SDK we list in the
global.json. https://github.com/dotnet/installer/blob/master/README.md#installers-and-binariesalexvy86 commentedon Apr 8, 2020
I did at the beginning, yes, but after noticing that test runs in many projects were taking longer than I though they would, I noticed the issue and built the Release version. Tests started running faster, and I thought I was fine, but maybe something (in VS?) was still using the Debug version.
I just installed the latest SDK after reading about it in the announcement, I'll keep playing around with the scenarios that I already saw working and report any problems I encounter.
alexvy86 commentedon Apr 8, 2020
So I cleaned up with
git clean -fdx, I pulled master, built CoreCLR in Release mode (.\build.cmd clr -c Release), then built the libraries in Debug mode (.\build.cmd libs), and 33 of them errored out complaining about missing Debug-mode artifacts from CoreCLR in\artifacts\bin\coreclr\Windows_NT.x64.Debug\. I thought working on the libraries should be possible building CoreCLR in Release mode, right?Now,
System.Text.Jsonis one of the libraries that succeeded the build, so I then opened it in VS 16.5.2 (.\build.cmd -vs System.Text.Json), tried to build the solution in Debug mode through the context menu, and got warnings and errors about missing assemblies (most of them from the list of libraries whose build failed above, but also others):I also tried building
System.ComponentModel.TypeConverterfrom VS and got similar, if fewer, errors:Just to get more data, I built the libraries in Release mode (
\build.cmd libs -c Release) and that succeeded. But even then, building theSystem.Text.Jsonsolution in VS (I tried Debug and Release this time) failed.I tried looking at commonalities for the library projects whose Debug build failed, and this is a shot in the dark but they all have this in their
csprojfile:Since I read that CoreLib is pretty tied to the runtime and they need to be built in the same configuration, maybe that has something to do with it?
safern commentedon Apr 8, 2020
I think you missed passing
-runtimeConfiguration Release. Also you need to pass this tobuild.cmd -vscommand, that way projects that have a ReferenceFromRuntime find the right coreclr path.Anipik commentedon Apr 8, 2020
Some of the intellisense iand testing issues are resolved by #34721
alexvy86 commentedon Apr 9, 2020
Ah, that's what
-runtimeConfigurationis for, it makes sense now. It partially helped, the Debug-mode command line build of the libraries succeeded, but once in VS I get weird behavior (this isSystem.Text.Json):A Rebuild on the solution or any of the projects supposedly succeeds:
But a Build of the solution or any of the projects fails and shows these warnings/errors:
Even after a supposedly successful rebuild, Test Explorer is not reporting any tests, and if I click on Run All Tests it complains of a failed build.
So I went to the two projects that complain about "not being compatible with netcoreapp5.0". I opened
System.Memorywith VS and building throws these issues (duplicate frameworks?):System.Runtimethrows these (a missingCompileDesignTimetarget, and looking for a Unix artifacts folder?):Haven't been able to figure them out, so posting them here in case they ring a bell for anyone.
alexvy86 commentedon Apr 9, 2020
Ah the "duplicate frameworks" issue is already tracked in #32205