Граф коммитов

222 Коммитов

Автор SHA1 Сообщение Дата
Jan Krivanek 4e9a031108
Merge pull request #8779 from JanKrivanek/proto/serialize-exc
Relay remoted exceptions
2023-06-20 16:32:54 +02:00
Jan Krivanek 09d8c22760
Apply suggestions from code review
Co-authored-by: Rainer Sigwald <raines@microsoft.com>
2023-06-12 15:07:06 +02:00
Rainer Sigwald 2a2ac62f54
Term cleanup (#8799)
Fix some items detected by a scanning tool.

---------

Co-authored-by: Marc Paine <marcpop@microsoft.com>
2023-05-25 16:07:53 +00:00
Jan Krivanek 2b0963ceed Reflect PR suggestions 2023-05-22 12:50:04 +02:00
Rainer Sigwald 2e62a015fa
Link from ChangeWaves-dev to ChangeWaves (#8744) 2023-05-09 13:49:34 -07:00
Forgind 0809a23b75
Verify paths are not the same Fixes #8684 (#8685)
Fixes #8684
Fixes #8273

Context
After #8275, we delete any destination file as part of the Copy task if we determine that we really should copy onto it. Unfortunately, if we try to copy a file onto itself, we delete it before we can copy onto itself, which just means it's gone. Fortunately, we have a check earlier that ensures that we skip any copy operation from a location to the same location. Unfortunately, it's a direct string comparison that doesn't evaluate to full paths first, so it misses slightly more complicated examples.

Changes Made
Take into account full paths

Testing
Unit tests + manual test that it doesn't delete the file anymore

Notes
This implementation tries to remove now-unnecessary full path derivations downstream, hence some added complexity, but it still means extra computation on the happy path if we end up creating a hard/symbolic link. An alternate direction eliminating any full path derivations on the happy path would save about 4% of Copy's execution time, per a quick perf test. (With how many samples I used, "no change" is within a standard deviation.)
2023-05-05 14:49:10 -07:00
Ladi Prosek 280393a917
[RAR] Don't do I/O on SDK-provided references (#8688)
Fixes #8634

Context
For SDK/workload references, the SDK is currently already passing relevant metadata such as AssemblyVersion and PublicKeyToken, so there is no need for RAR to open these files and parse their .NET metadata tables to get this information. Also, barring corrupted installs, these files are guaranteed to exist on disk so there is no need for RAR to do any I/O on them (file-exists, get-time-stamp, ..)

Changes Made
Tweaked RAR to trust the item metadata passed by the SDK. The feature is gated on the presence of the FrameworkReferenceName metadatum which is not documented and is used only by the relevant SDK tasks, to my best knowledge.

SDK does not specify the Culture component of assembly names so it's assumed to be neutral. This has passed all relevant validation so far. If non-neutral assemblies are ever used as references, we'll need to define a metadatum for SDK to set.

Testing
Existing and new unit tests.
Experimental insertion with an assert that assembly names calculated from item metadata are equivalent to those extracted from assembly files (verifies that the Culture=neutral assumption is correct).
Checked all assemblies specified in all FrameworkList.xml files shipped in the SDK (+ workloads) and verified that all of them are culture neutral.
Perf results
RAR micro-benchmark where the task is invoked with parameters corresponding to building a simple AspNetCore app:

13.13 ms -> 3.27 ms per invocation without StateFile cache.
15.03 ms -> 5.13 ms per invocation with StateFile cache.
RAR task duration as reported with /clp:PerformanceSummary when building a simple AspNetCore app with MSBuild server enabled:

20 ms -> 10 ms.
Notes
The change is behind a 17.8 changewave.
No changes have been made to per-project caching (via the StateFile parameter) to reduce scope. Changes to the per-project cache file will be done in another PR.
2023-05-05 14:48:32 -07:00
Jan Krivanek 90f4271f28
Proposal for secrets metadata feature (#8520)
Initial proposal for secrets metadata feature
2023-05-04 11:18:19 -07:00
Jan Krivanek 956d69f41f
Reorganize docs (#8701)
Fixes #8671

Context
New layout as agreed offline

specs             (content remains same, we'll move here rar-core-scenarios from documentation/design folder)
 |-----proposed   (the secrets metadata and packages sourcing PRs would get routed here. In future - all in-progress work specs)
 |-----archive    (the rar-as-service.md from documentation/design will get moved here. In future - all not dismissed but not planned feature spec goes here)
Moving facilitated via git mv to preserve history and make diffs conscise
2023-05-01 13:38:58 -07:00
Rainer Sigwald d95c8c3e3b
Deemphasize MSBUILDDEBUGENGINE in binlog doc (#8712)
At least one person skimmed over the section we wanted to emphasize (`-bl`) and focused on `MSBUILDDEBUGENGINE`, sharing lower-fidelity logs that are harder to understand.

Remove the "Preferred way" callout--it's preferred in that section but not in general. Add a section header for command-line builds. Add some samples there.
2023-05-01 13:38:38 -07:00
Jan Krivanek fbbcaf80df
Document references peculiarities (#8494)
Relates to:
#4795
#8405

Context
Documenting some aspect of tailoring behavior of references. Capturing as well resolution/workarounds for the listed comunity reported issues

---------

Co-authored-by: Rainer Sigwald <raines@microsoft.com>
2023-04-23 15:55:43 +08:00
Jared Parsons 10a1f7a10d
Update Providing-Binary-Logs.md (#8690)
Need to include `""` around the path in the Powershell case
2023-04-23 15:41:28 +08:00
Rainer Sigwald 40975df1a0
Revert "Avoid package dependencies on inbox libraries (#8669)" (#8679)
This reverts commit 8326396cb4 because it causes component governance alerts.
2023-04-19 14:23:04 +00:00
Viktor Hofer 8326396cb4
Avoid package dependencies on inbox libraries (#8669)
System.Security.Principal.Windows is inbox since net6.0
System.Net.Http is inbox since netcoreapp2.0
System.Reflection.Metadata is inbox since netcoreapp2.0
System.Threading.Tasks.Dataflow is inbox since netcoreapp2.0
Remove System.Net.Http package references which aren't needed as they underlying assembly is inbox on both .NETFramework and .NETCoreApp.
By avoiding the dependencies, we minimize the dependency graph and with that the attack surface.

cc @MichaelSimons (removes netstandard1.x dependencies)
2023-04-19 09:49:45 +08:00
Dmitriy Shepelev 65a40415b7
Update `ProjectReference` docs (#8434)
Update documentation given the merge of #8249, #8257, and #8330.

---------

Co-authored-by: Rainer Sigwald <raines@microsoft.com>
2023-04-19 09:42:28 +08:00
Jan Krivanek cc55017f88
Log item self-expansion (#8581)
Fixes #8527

Context
Self referencing item metadata in an item definition within the target leads to possible unintended expansion (and cross-applying of pre-existing item instances).

This behavior is not a bug - it's the implication of the target batching feature - but might be confusing. So detection and warning is added here

Changes Made
A self reference (qualified or unqualified) of metadata within the item defeiniton (which is within a target) is detected and high importance message is issued.

Testing
Tests added for a warning case and for a non-warning case (self-referencing metadata outside of target context)

Doc
https://github.com/MicrosoftDocs/visualstudio-docs-pr/pull/11034

Possible impact
It's unfortunately hard to obtain data on prevalence of this pattern due to limitations of available code searches (github search doesn't support '@' sign and no escaping option; SourceGraph, grep.app doesn't support regex lookaheads). So I cannot quantify (I'll try again later on).
But there are some sparse evidence of usage:

https://github.com/JeremyAnsel/JeremyAnsel.HLSL.Targets/blob/master/JeremyAnsel.HLSL.Targets/JeremyAnsel.HLSL.Targets/JeremyAnsel.HLSL.Targets.csproj#L49
https://github.com/neuecc/MessagePack-CSharp/blob/master/src/MessagePack.MSBuild.Tasks/MessagePack.MSBuild.Tasks.csproj#L35
https://github.com/dotnet/aspnetcore/blob/main/eng/AfterSigning.targets#L22
all of those seem to be doing something else then intended (the variable part of path is empty, so it gets just the base directory), but they do not break.

tl;dr;: unless we are able to better quantify, we might resort to demote the warning to a message Demoted to Message severity
2023-04-14 12:06:27 +08:00
Ladi Prosek 82fa6f40b9
Document 'Resolve Assembly Reference core scenarios' (#8506)
This document aims to capture the core functionality provided by the ResolveAssemblyReference task when building .NET (Core - pun intended) projects. The goal is to rationalize and optimize the task, ultimately achieving substantially better performance and crossing out RAR from the list of notoriously slow build tasks.

Fixes #8441
2023-04-04 10:36:38 -05:00
Forgind 37bf098794
Clarify what .default means (#8626)
* Clarify what .default means

.default (in MSBuild code) followed an earlier spec that referred to it as <default> and omitted some details. This clarifies the meaning of .default.

* Replace <default> with .default
2023-04-04 09:59:22 +08:00
Forgind da690cf2cf
Any have metadata value when empty Fixes #5113 (#8603)
Previously, when we saw the Item was empty, we'd jump out early. Fortunately, we already special-cased Count, and it turns out we can do the same with AnyHaveMetadataValue. Fixes #5113.
2023-03-28 17:04:36 -05:00
Jan Krivanek 6ce195f4a3
Log assembly loads during task run (#8316)
Fixes #6303
Related: KirillOsenkov/MSBuildStructuredLog#653

Context
Assembly loading logging for:
Task runs - including loads in separate app domain for AppDomainIsolatedTask
Except for tasks runs in OutOfProcessRaskHostNode - as neither LoggingService nor LoggingContext are available there - not sure if not supporting those is a problem.
Sdk resolving (explicitly skipping resolvers defined in Microsoft.Build assembly)
Loggers initialization (explicitly skipping resolvers defined in Microsoft.Build assembly orwithin Microsoft.Build.Logging namespace) - Note - loggers initialiation reordered - Binlog is the first one - as assembly load events are emited at the time of each logger initialization, currently LoggerService dispatches events immediately after construction, so as a result order of logger definitions matter (only the earlier initialized gets messages about latter ones initialization assembly loads). Alternative would be to change the LoggerService contract to start dispatching on explicit request (easy to implement and preserving current MSBuild behavior - however might be potentially breaking for API users?) or to cache those events and log them later (doable, but convoluted - probably not worth the efforts now)
Evaluation
Samples
task run:

Assembly loaded during TaskRun: System.Diagnostics.Debug, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Diagnostics.Debug\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Diagnostics.Debug.dll, MVID: bc6b825d-5f99-464e-a06d-e3ae4b860a34, AppDomain: [Default])
evaluation:

Assembly loaded during Evaluation: System.Collections.Immutable, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.2\System.Collections.Immutable.dll, MVID: 5a4c54a3-2092-428e-89cc-a391fd9d398a, AppDomain: [Default])
logger initialization:

Assembly loaded during LoggerInitialization (MyLoggers.BasicFileLogger): System.Reflection.Metadata, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.2\System.Reflection.Metadata.dll, MVID: c602a8ce-3890-40fc-aa9b-fa3c23f81aab, AppDomain: [Default])
custom sdk resolver (no sample - similar to logger initialization)

Perf impact
No observable impact.

MSBUILDLOGALLASSEMBLYLOADS is used to turn on loggin of all assembly loads
build command: msbuild.exe <proj> /nodeReuse:false /bl
Scenario	Mean Duration
Orchard - MSBuild main	00:00:59.25
Orchard - curr branch	00:00:58.30
Orchard - curr branch, all loads	00:00:58.30
Console - MSBuild main	00:00:01.08
Console - curr branch	00:00:01.09
Console - curr branch, all loads	00:00:01.10
2023-02-24 19:09:28 +08:00
Jan Krivanek 5476e4396f
Improve VS binlogs providing info (#8446)
Context
As discussed on triage - binlogs captured through VS project system extension tooling are less preferrable to logs captured via environment opt-in. Let's make it more explicit in our docs that we are often linking externally to our customers.
2023-02-20 18:16:41 +08:00
adr26 dba9b23435
Update links referencing git branches from master -> main (#8437)
Fix other broken links.

Fixes #8438

Context
The primary branch for msbuild (and a number of other projects) has been migrating from 'master' to 'main'. A number of links reference the old 'master' branch name and are broken.

Changes Made
This PR updates those that have changed to 'main', along with updating a couple of other broken links.

Testing
Relying on the CI tests :)

Notes
It's my first MSBuild PR, apologies if there I've missed anything!
2023-02-12 12:13:23 +08:00
Jan Krivanek a57cc6d3d3
Add nodes orchestration doc (#8383)
Enriched transcript of a talk with @rainersigwald about MSBuild nodes orchestration and scheduling.

I added some extra interpretations and links that were not voiced in the talk - so I'll be happy for review for corectness of the doc.
2023-02-08 16:37:29 +08:00
Vlada Shubina e073a394db
Added README.md and updated the table of contents in `documentation` folder (#8390)
Context
The docs are hard to navigate

Changes Made
Added README.md and updated the table of contents in documentation folder
https://github.com/dotnet/msbuild/blob/main/documentation/specs/rar-as-service.md - moved to design folder
merged 2 pages on SDK resolvers
"debugging on Mono" is moved to deprecated and not included to contents
2023-02-07 15:40:35 +08:00
Eduardo Villalpando Mello 49e9c62c72 Updated remaining reference on documentation and removed .DS_Store files 2023-01-30 17:25:39 -06:00
Eduardo Villalpando Mello 33a36ea699 Renamed documentation 2023-01-30 17:00:57 -06:00
Jan Krivanek 5b1a645414 Add documentation on xplat unit testing 2023-01-04 12:04:38 +01:00
Jan Krivanek ac0911a006
Merge pull request #8213 from JanKrivanek/proto/bl-embed-symlinks
Add support for symlink files embedding to binlog
2023-01-03 17:15:56 +01:00
Eduardo Villalpando Mello a6f6699d1f Create FancyLogger opt-in/out mechanism (#8178)
* Added FancyLogger

Fixes #

Context
For the average user, the current ConsoleLogger does not provide the required amount of information about the build, as it either shows too little information (with low verbosity levels) or too much information that it is very difficult to find (with high verbosity levels).
A better approach would be having the log update to show the necessary amount of information for the current performing action (be it a project, target or task) and hiding additional data for actions that completed successfully; thus reducing the amount of irrelevant info.
Likewise the addition of formatting (bold, italics, color) using ANSI escape codes provides the user with a much better experience.
A progress tracker for the build is also considered.

This PR focuses only on the opt-in/out mechanism for the feature.

Changes Made
Created a new FancyLogger class.
Created a ANSIBuilder static class with helper methods for ANSI formatting and graphics
Added the /fancylogger and /flg command line switches for enabling the FancyLogger
Added the $MSBUILDFANCYLOGGER environment variable for enabling the FancyLogger
Testing
Notes

Co-authored-by: Rainer Sigwald <raines@microsoft.com>
2022-12-20 17:02:55 +08:00
Jan Krivanek ee5fc55513 Switched options in doc 2022-12-19 16:28:01 +01:00
Jan Krivanek 93504d7fa3 Clarify wiki 2022-12-15 11:02:36 +01:00
Jan Krivanek 95706ab245
Merge branch 'main' into proto/bl-embed-symlinks 2022-12-13 20:46:57 +01:00
Jan Krivanek 202a929aea Fix wording 2022-12-13 20:45:19 +01:00
Jan Krivanek 884fde8061 Simplify the change, add doc 2022-12-13 15:09:53 +01:00
Jenny Bai fd7cd728d3
Parse invalid property under target (#8190)
Fixes #5773

Context
Put a property inside a target without an enclosing PropertyGroup and build. Error informing me that is an invalid child element 

Changes Made
Add one condition when parse the element under target. If the element has inner text and no other child elements except text, then this should be a property and throw invalid child element, the error is "MSB4067: The element &lt;{0}&gt; beneath element &lt;{1}&gt; is unrecognized. If you intended this to be a property, enclose it within a &lt;PropertyGroup&gt; element"

Tests
ReadInvalidPropertyUnderTarget
2022-12-13 10:11:43 +08:00
Noah Gilson 100e592026
Remove Bootstrap Property from Onboarding Docs (#8127)
* Change all of the inferences to bootstrap except on bootstrapped_msbuild.sh files, though it's likely also not needed there

* Remove the tautology

* Remove suggestion to install .net sdk
2022-11-17 09:56:13 +08:00
Jenny Bai d14b74d6f0
Merge pull request #8095 from Forgind/log-error-on-path-not-found
Log an error when no provided search path for an import exists
2022-11-13 18:38:43 -08:00
Ben Villalobos 85317edac0
DisableTransitiveProjectReferences is not required for SetPlatform (#8114) 2022-11-04 09:49:27 +01:00
Forgind d0060335c1
Remove wave 17_0 (#8096)
* Remove wave 17_0
Fix alignment, remove unnecessary method, delete unused variable
2022-11-03 13:00:03 +01:00
Rainer Sigwald 07bf358dd7
Mention MSBUILDDEBUGENGINE in Tips&Tricks (#8089)
* Mention MSBUILDDEBUGENGINE in Tips&Tricks

Some folks were looking for this and found this page, but wound up IMing me because DEBUGENGINE wasn't here.

* Casing!
2022-11-03 04:32:35 -07:00
Forgind d7db41bc81 Add a change wave 2022-10-26 14:28:24 -07:00
Oliver Schneider 3777dcaf7e
Fixed some URLs in the documentation (#8078)
- Changed http:// links to https:// where that was the case (a handful
  of http:// links remain), but all changed ones were checked
- Where GitHub links changed from `master` to `main`
- Where source lines were referenced it now points to a given revision,
  because pointing to a branch name means the line number may be
  incorrect. NB: so this was very much intentional!
- Linked to the archived page for dead links
- Updated old MSDN and docs.microsoft.com and blog links to point to the
  current location (even if it's the archive on learn.microsoft.com)
- Remove en-us from canonical links to learn.microsoft.com ...

Co-authored-by: Rainer Sigwald <raines@microsoft.com>
2022-10-26 09:26:18 +02:00
Shreyas Jejurkar 3b7246b650
Update Building-Testing-and-Debugging-on-.Net-Core-MSBuild.md (#8083)
Instead of hard-coding mention it as TargetFramework
2022-10-25 10:24:59 +02:00
AR-May ef7b9a5534
Eliminate project string cache under a change wave. (#7965)
* Do not use project string cache.
* Move code from Wave17_4 to Wave17_6.
* Add this PR to ChangeWaves list in documentation.
2022-10-17 18:17:40 +02:00
Ben Villalobos 56a0e3c30e
Change up-for-grabs to help wanted (#7974)
Fixes #7900

Context
help wanted has better github integrations
2022-10-06 09:42:53 -07:00
Forgind ec8ec7d56a
Avoid building dwproj (#7708)
Mitigates https://github.com/dotnet/msbuild/issues/2064

Context
This is an alternate way to fix the same problem. This is incomplete: it would still need to replace "dwproj" with the !projectsKnownToBeMSBuild and add a warning.
2022-09-23 11:04:11 +02:00
AR-May 9c9f439ae8
Update Change Waves env var in docs (#7909) 2022-08-27 11:37:45 -07:00
AR-May a55907eead
Merge branch 'main' into feature/msbuild-server 2022-07-01 13:59:01 +02:00
MichalPavlik 23fb4a6b3e
Update doc (#7740)
* Update doc

* Fixed typo

* Fixed another typo

* Update documentation/MSBuild-Server.md

Co-authored-by: Forgind <Forgind@users.noreply.github.com>

* Update documentation/MSBuild-Server.md

Co-authored-by: Forgind <Forgind@users.noreply.github.com>

* Update documentation/MSBuild-Server.md

Co-authored-by: Forgind <Forgind@users.noreply.github.com>

* Update documentation/MSBuild-Server.md

Co-authored-by: Forgind <Forgind@users.noreply.github.com>

* Update documentation/MSBuild-Server.md

Co-authored-by: Forgind <Forgind@users.noreply.github.com>

* Update documentation/MSBuild-Server.md

Co-authored-by: Forgind <Forgind@users.noreply.github.com>

* Resolving comments

Co-authored-by: Forgind <Forgind@users.noreply.github.com>
2022-07-01 10:34:21 +02:00
Forgind 9d9417646a
Avoid locking TaskHostFactory-using assemblies (#7387)
Getting type information for a task that was supposed to be loaded in a TaskHost involves loading that assembly today. The point of TaskHost nodes is that they don't lock the assembly, and they disappear quickly, releasing the lock from when we actually need to load the assembly to execute it. This will mean that we don't lock the assembly to read its type information, actually complying with the user's likely intent.

If the user asks for a TaskHost, use MetadataLoadContext to get its information rather than loading the assembly fully.

Fixes #6461
2022-06-28 15:38:32 -05:00