-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Further centralize shared Fx and TFM transition workarounds #27473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -15,13 +15,13 @@ This tutorial assumes that you are familiar with: | |||
|
|||
ASP.NET Core uses git submodules to include the source from a few other projects. In order to pull the sources of the these submodules when cloning the repo, be sure to pass the `--recursive` flag to the `git clone` command. | |||
|
|||
```ps1 | |||
```powershell |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file wasn't really incredibly broken; it just gave the VS Code Markdown extension plenty to complain about
@@ -154,26 +159,29 @@ to open the .sln file or one of the project specific .slnf files to work on the | |||
> branch, we regularly update the versions of .NET Core SDK required to build the repo. | |||
> You will need to restart Visual Studio every time we update the .NET Core SDK. | |||
|
|||
Typically, you want to focus on a single project within the monorepo. For example, | |||
> :bulb: Rerunning the above command or, perhaps, the quicker `.\build.cmd -noBuildNative -noBuildManaged` may be | |||
> necessary after switching branches, especially if the `$(DefaultNetCoreTargetFramework)` value changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new
### Use the result of your build | ||
### Resx files | ||
|
||
If you need to make changes to a .resx file, run `dotnet msbuild t:/Resgen <path to csproj>`. This will update the generated C#. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Slight reordering
@@ -1,7 +1,6 @@ | |||
<Project> | |||
<PropertyGroup> | |||
<DefaultNetCoreTargetFramework>${DefaultNetCoreTargetFramework}</DefaultNetCoreTargetFramework> | |||
<TargetFramework>${DefaultNetCoreTargetFramework}</TargetFramework> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have any projects lacking a $(TargetFramework)
setting and this can cause problems where we use $(TargetFrameworks)
@captainsafia I'd appreciate your thoughts on docs/BuildFromSource.md changes in particular |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BuildFromSource.md changes look good. Left a few notes inline.
1788d8c
to
fd353d6
Compare
fd353d6
to
8a939b9
Compare
8cdc40e
to
d558c0a
Compare
d558c0a
to
70068f5
Compare
@wtgodbe and @JunTaoLuo please review. Lots has changed since @captainsafia signed off. |
<DefaultRuntimeFrameworkVersion Condition=" '$(IsServicingBuild)' != 'true' AND | ||
'$(TargetLatestDotNetRuntime)' != 'false' ">${MicrosoftNETCoreAppRuntimeVersion}</DefaultRuntimeFrameworkVersion> | ||
<TargetingPackVersion Condition=" '$(IsServicingBuild)' != 'true' AND | ||
'$(TargetLatestDotNetRuntime)' != 'false' ">${MicrosoftNETCoreAppRefVersion}</TargetingPackVersion> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I need to these changes specifically in this file as well? Sounds like no.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming this works, it seems reasonable, but I'm concerned that it seems to be adding complexity and might make our build even harder to understand than it already is - could you explain if/how the value it adds is large enough to overcome that (or if I'm overestimating the added complexity)?
8c5173c
to
15b0406
Compare
I started this branch to
The work also helped me remove duplication I was less aware of e.g. between src/ProjectTemplates/BlazorTemplates.Tests/ and src/ProjectTemplates/test/. What specific added complexity are you concerned about❔ I suspect at least some if what you're seeing existed before but in code I'm deleting. |
15b0406
to
0e78d2d
Compare
@wtgodbe this is now green. Do you object to merging❔ |
Main concern is the use of the generated .props/.targets file everywhere now, it seems a bit unintuitive and may leave devs wondering where certain common properties "live" now |
If I clean the repo then run |
Seems like that works, so I'm satisfied |
If the SDK is up-to-date, the new minimum requirement after cleaning for |
As I said, that isn't expected to work. I should have added that |
Do those caveats undo your approval❔ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the SDK is up-to-date, the new minimum requirement after cleaning for dotnet build (in projects that don't require native assets) is ./build.cmd -noBuildNative -noBuildManaged or ./build.sh --no-build-managed
I did my normal workflow, which is clean, restore, build a project using the restored .dotnet folder. Given that this breaks folks who are running dotnet build
with a globally installed SDK that matches the one in global.json (e.g. once we ship 6.0 RTM, or if anyone has a 6.0 preview installed globally), I'm more hesitant. My gut feeling is that that scenario should work. Maybe if every restore
operation creates the generated file if it doesn't already exist? In any case I'd prefer to talk about this more before making that breaking change.
Ah, I thought you wanted to avoid
This PR doesn't break using a globally-installed SDK. Globally-installed SDKs only work if they also include up-to-date runtimes from dotnet/runtime e.g. just after rebranding post-release. This restriction comes from the need to have the additional runtimes in the SDK folder. Nothing new here w.r.t. that restriction. Did you request changes because you thought something about globally-installed SDKs had changed in this PR❔ |
So what causes the new requirement to run |
I probably I confused you because I thought you wanted to avoid using |
I understand that part, I just want to understand what (if any) scenarios worked before this PR, that do not work after - that is, who has to change their workflow? |
About the only things that change at all are scenarios involving switches between branches for which all needed runtimes are already in .dotnet/. In those cases, it's better to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, then this works for me
0e78d2d
to
ac6fbe3
Compare
- make generated `Directory.Build.*` files more widely applicable - warn if requested Microsoft.AspNetCore.App version does not exist in `$(DOTNET_ROOT)` - add `$(UpdateAspNetCoreKnownFramework)` for Microsoft.AspNetCore.App `@(KnownFrameworkReference)` update - remove central `$(BuildingTestAppsIndependently)` special case - not needed because compiler toolset version is always available - correct `$(KnownAppHostPackOrFrameworkReferenceTfm)` when not targeting the default TFM - use MSBuild intrinsic functions for this and in framework projects; future-proofing - correct `@(KnownFrameworkReference)` metadata when in servicing - should not override default runtime and targeting pack versions - use generated `Directory.Build.*` files in regular build - remove now-duplicate property and item settings outside generated `Directory.Build.*` files - use generated `Directory.Build.*` files for local Razor tests - set `$(TargetLatestRuntimePatch)` instead of `$(RuntimeFrameworkVersion)`; simpler - do not restore Razor SDK test asset projects until just before tests run - depend on Microsoft.AspNetCore.App projects - disable `$(TreatWarningsAsErrors)` for a few Razor SDK tests - tests expect projects to build successfully despite a few warnings - improve (widen) Microsoft.AspNetCore.App `Condition` in Blazor SDK tests nit: do not pass `$(MicrosoftNetCompilersToolsetVersion)` into Razor test asset projects - not needed because generated files already contain the right information - even without that, the Directory.Build.props file imports eng/Versions.props
- move Infrastructure/ files to TestInfrastructure/ - Infrastructure/ sub-directories were functionally identical - move shared parts of template test project files to PrepareForTest.targets
…uildFromSource.md - address numerous Markdown lint warnings, typos, and spelling mistakes in this file
- thanks @captainsafia Co-authored-by: Safia Abdalla <safia@microsoft.com>
- some was already duplicated - fix Markdown lint issues in BuildErrors.md too
- required for the new `msbuild` intrinsics - it is _not_ recommended to parse TFMs manually anymore - revert this after Visual Studio 16.8 reaches the regular agents
- move `_InstallFrameworkIntoLocalDotNet` earlier because other builds depend on this part - this target sometimes executes after dependent projects continue - add `DependsOnTargets` attributes to further constrain ordering nit: `IncludeFrameworkListFile` should run before `_ResolveSharedFrameworkContent`
- let's see if 16.8.0 is new enough - regular queues were updated today This reverts commit e4ed1755ee74565b232bf0d08b7c631a6e775778.
ac6fbe3
to
1259f96
Compare
…spnetcore#27473) * Further centralize shared Fx and TFM transition workarounds - make generated `Directory.Build.*` files more widely applicable - warn if requested Microsoft.AspNetCore.App version does not exist in `$(DOTNET_ROOT)` - add `$(UpdateAspNetCoreKnownFramework)` for Microsoft.AspNetCore.App `@(KnownFrameworkReference)` update - remove central `$(BuildingTestAppsIndependently)` special case - not needed because compiler toolset version is always available - correct `$(KnownAppHostPackOrFrameworkReferenceTfm)` when not targeting the default TFM - use MSBuild intrinsic functions for this and in framework projects; future-proofing - correct `@(KnownFrameworkReference)` metadata when in servicing - should not override default runtime and targeting pack versions - use generated `Directory.Build.*` files in regular build - remove now-duplicate property and item settings outside generated `Directory.Build.*` files - use generated `Directory.Build.*` files for local Razor tests - set `$(TargetLatestRuntimePatch)` instead of `$(RuntimeFrameworkVersion)`; simpler - do not restore Razor SDK test asset projects until just before tests run - depend on Microsoft.AspNetCore.App projects - disable `$(TreatWarningsAsErrors)` for a few Razor SDK tests - tests expect projects to build successfully despite a few warnings - improve (widen) Microsoft.AspNetCore.App `Condition` in Blazor SDK tests nit: do not pass `$(MicrosoftNetCompilersToolsetVersion)` into Razor test asset projects - not needed because generated files already contain the right information - even without that, the Directory.Build.props file imports eng/Versions.props * Use generated `Directory.Build.*` files for local template tests - move Infrastructure/ files to TestInfrastructure/ - Infrastructure/ sub-directories were functionally identical - move shared parts of template test project files to PrepareForTest.targets * Describe errors with missing generated files and the new warning in BuildFromSource.md - address numerous Markdown lint warnings, typos, and spelling mistakes in this file * Apply suggestions from code review - thanks @captainsafia * Move all troubleshooting information into BuildErrors.md - some was already duplicated - fix Markdown lint issues in BuildErrors.md too * Reorder App.Runtime build slightly - move `_InstallFrameworkIntoLocalDotNet` earlier because other builds depend on this part - this target sometimes executes after dependent projects continue - add `DependsOnTargets` attributes to further constrain ordering nit: `IncludeFrameworkListFile` should run before `_ResolveSharedFrameworkContent` * Add temporary workaround for `[AssemblyVersion]` changes * Address @wtgodbe's nit from dotnet/aspnetcore#27653 - dotnet/aspnetcore#27653 (review) Co-authored-by: Safia Abdalla <safia@microsoft.com> Commit migrated from dotnet/aspnetcore@5fd1db26257c
Directory.Build.*
files in regular build$(UpdateAspNetCoreKnownFramework)
controlling Microsoft.AspNetCore.App KnownFrameworkReference update$(DOTNET_ROOT)
Directory.Build.*
files$(BuildingTestAppsIndependently)
special case$(KnownAppHostPackOrFrameworkReferenceTfm)
when not targeting the default TFMDirectory.Build.*
files for local template testsDirectory.Build.*
files for local Razor tests$(TargetLatestRuntimePatch)
instead of$(RuntimeFrameworkVersion)
; simpler