dotnet / project-system

The .NET Project System for Visual Studio
MIT License
967 stars 386 forks source link

Changes in .ts/.tsx files brake Up-to-date Check until full rebuild #8981

Closed olmobrutall closed 1 year ago

olmobrutall commented 1 year ago

Visual Studio Version

Visual Studio 2022 64-bits 17.5.3 Microsoft.TypeScript.MSBuild 5.0.4

Summary

⚠️ ⚠️ Very important performance problem for any TypeScript developer in Visual Studio, specially when using more than one probject ⚠️ ⚠️

TypeScript files afect the build, but do not produce any output in bin/obj, because of this, after succesfully compiling a Web Application (<Project Sdk="Microsoft.NET.Sdk.Web">) that uses the Nuget Microsoft.TypeScript.MSBuild to compile some ts file, if you modify a ts file, the project will be forever ignored by the up-to-date check until a .cs file is changes and a build updates the output dll.

Steps to Reproduce

  1. In Visual Studio, create a new project of type: ASP.Net Core Web App called "WebApplication1"

  2. Add a TypeScript file file.ts in the root directory of "WebApplication1" with content var a = 2;.

  3. Visual Studio will sugest to install the nuget Microsoft.TypeScript.MSBuild, if not install it manually

  4. Activate Up-to-Date logging level as explained here.

  5. Compile the project, of course the project gets compiled the first time. ✅

    1>FastUpToDate: Output 'C:\Users\olmob\source\repos\WebApplication1\WebApplication1\bin\Debug\net7.0\WebApplication1.dll' does not exist, not up-to-date. (WebApplication1)
    1>FastUpToDate: Up-to-date check completed in 0,5 ms (WebApplication1)
    1>------ Build started: Project: WebApplication1, Configuration: Debug Any CPU ------
    Restored C:\Users\olmob\source\repos\WebApplication1\WebApplication1\WebApplication1.csproj (in 3 ms).
    1>WebApplication1 -> C:\Users\olmob\source\repos\WebApplication1\WebApplication1\bin\Debug\net7.0\WebApplication1.dll
    ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
    ========== Build started at 10:17 PM and took 04,306 seconds ==========
  6. Compile Again, no changes detected, MSBuild is skipped ✅

    1>FastUpToDate: Project is up-to-date. (WebApplication1)
    1>FastUpToDate: Up-to-date check completed in 1,9 ms (WebApplication1)
    ========== Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
  7. Modify file.ts by writing var a = 3;. Compile again. Of course if recompiles... but produces a warning 🤔

    1>FastUpToDate: Input TypeScriptCompile item 'C:\Users\olmob\source\repos\WebApplication1\WebApplication1\file.ts' is newer (2023-04-15 22:18:16.443) than earliest output 'C:\Users\olmob\source\repos\WebApplication1\WebApplication1\obj\Debug\net7.0\WebApplication1.pdb' (2023-04-15 22:17:11.993), not up-to-date. (WebApplication1)
    1>FastUpToDate: Up-to-date check completed in 1,0 ms (WebApplication1)
    1>------ Build started: Project: WebApplication1, Configuration: Debug Any CPU ------
    1>WebApplication1 -> C:\Users\olmob\source\repos\WebApplication1\WebApplication1\bin\Debug\net7.0\WebApplication1.dll
    ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
    ========== Build started at 10:18 PM and took 02,922 seconds ==========
    WARNING: Potential build performance issue in 'WebApplication1.csproj'. The project does not appear up-to-date after a successful build: Input TypeScriptCompile item 'C:\Users\olmob\source\repos\WebApplication1\WebApplication1\file.ts' is newer (2023-04-15 22:18:16.443) than earliest output 'C:\Users\olmob\source\repos\WebApplication1\WebApplication1\obj\Debug\net7.0\WebApplication1.pdb' (2023-04-15 22:17:11.993), not up-to-date. See https://aka.ms/incremental-build-failure.
  8. Without modifying the solution, compile again... it incorrectly calls MSBuild, compiling the project again. 🔥 🐛 👎

    1>FastUpToDate: Input TypeScriptCompile item 'C:\Users\olmob\source\repos\WebApplication1\WebApplication1\file.ts' is newer (2023-04-15 22:18:16.443) than earliest output 'C:\Users\olmob\source\repos\WebApplication1\WebApplication1\obj\Debug\net7.0\WebApplication1.pdb' (2023-04-15 22:17:11.993), not up-to-date. (WebApplication1)
    1>FastUpToDate: Up-to-date check completed in 0,8 ms (WebApplication1)
    1>------ Build started: Project: WebApplication1, Configuration: Debug Any CPU ------
    1>WebApplication1 -> C:\Users\olmob\source\repos\WebApplication1\WebApplication1\bin\Debug\net7.0\WebApplication1.dll
    ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
    ========== Build started at 10:20 PM and took 01,015 seconds ==========
    WARNING: Potential build performance issue in 'WebApplication1.csproj'. The project does not appear up-to-date after a successful build: Input TypeScriptCompile item 'C:\Users\olmob\source\repos\WebApplication1\WebApplication1\file.ts' is newer (2023-04-15 22:18:16.443) than earliest output 'C:\Users\olmob\source\repos\WebApplication1\WebApplication1\obj\Debug\net7.0\WebApplication1.pdb' (2023-04-15 22:17:11.993), not up-to-date. See https://aka.ms/incremental-build-failure.
  9. Repeating 8 will never fix the problem. Only by making a change in a Program.cs file the output files will be newer than the ts files. re-enabling FastUpToDate. No warning this time ✅

    1>FastUpToDate: Input TypeScriptCompile item 'C:\Users\olmob\source\repos\WebApplication1\WebApplication1\file.ts' is newer (2023-04-15 22:25:48.914) than earliest output 'C:\Users\olmob\source\repos\WebApplication1\WebApplication1\obj\Debug\net7.0\WebApplication1.pdb' (2023-04-15 22:24:29.958), not up-to-date. (WebApplication1)
    1>FastUpToDate: Up-to-date check completed in 0,8 ms (WebApplication1)
    1>------ Build started: Project: WebApplication1, Configuration: Debug Any CPU ------
    1>WebApplication1 -> C:\Users\olmob\source\repos\WebApplication1\WebApplication1\bin\Debug\net7.0\WebApplication1.dll
    ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
    ========== Build started at 10:26 PM and took 01,437 seconds ==========
  10. Compile again without changes. FastUpToDate correctly detects the project as up-to-date.

    1>FastUpToDate: Project is up-to-date. (WebApplication1)
    1>FastUpToDate: Up-to-date check completed in 1,6 ms (WebApplication1)
    ========== Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
    ========== Build started at 10:27 PM and took 00,078 seconds ==========

Expected Behavior

A C# project that contains changes only in TS files gets compiled one time, then correctly detected as up-to-date

Actual Behavior

The project won't be detected until a change in a C# file is made, forcing MSBuild to rebuild the assets.

User Impact

I think most developer using VisualStudio to build web applications tend to use TypeScript and I think all are impacted by this issue. The problem is often overseen because Web Applications tend to be at the end of the dependency graph.

My example using https://github.com/signumsoftware/southwind (depends on https://github.com/signumsoftware/framework)

In my case we were used to consider TypeScript compilation slower than C# (about 3x times slower), but since they were only three projects (Southwind.React, Signum.React.Extensions and Signum.React) we could live with it.

Lately we are restructuring the project to have one csproj per vertical module instead of layer, so Extensions instead of being one project is.... 43 web projects that need TypeScript compilation. https://github.com/signumsoftware/framework/tree/revolution/Extensions

A clean rebuild of Southwind project takes about 6 mins in my machine... time to make a coffe I suppose.

After that, building Southwind is very fast.

43>FastUpToDate: Up-to-date check completed in 19,9 ms (Southwind)
========== Build: 0 succeeded, 0 failed, 43 up-to-date, 0 skipped ==========
========== Build started at 10:57 PM and took 01,502 seconds ==========
Visual Studio accelerated 26 project(s), copying 162 file(s). See https://aka.ms/vs-build-acceleration.

But if you make a change TS/TSX file in some referenced project, like Signum, and then recompile Southwind it produces a chain reaction:

If needs to recompile almost everithing:

========== Build: 42 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
========== Build started at 11:31 PM and took 01:52,532 minutes ==========

The reason is this chain reaction:

Line 597: WARNING: Potential build performance issue in 'Signum.csproj'. The project does not appear up-to-date after a successful build: Input TypeScriptCompile item 'D:\Signum\southwind\Framework\Signum\React\Globals.ts' is newer (2023-04-15 23:31:10.635) than earliest output 'D:\Signum\southwind\Framework\Signum\obj\Debug\net7.0\Signum.pdb' (2023-04-15 23:28:00.406), not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 623: WARNING: Potential build performance issue in 'Signum.Authorization.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Signum\tsconfig.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.Authorization\bin\Debug\net7.0\tsconfig.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 1271: WARNING: Potential build performance issue in 'Signum.Profiler.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Signum\tsconfig.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.Profiler\bin\Debug\net7.0\tsconfig.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 1273: WARNING: Potential build performance issue in 'Signum.HtmlEditor.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Signum\tsconfig.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.HtmlEditor\bin\Debug\net7.0\tsconfig.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 1277: WARNING: Potential build performance issue in 'Signum.ViewLog.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Signum\tsconfig.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.ViewLog\bin\Debug\net7.0\tsconfig.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 1279: WARNING: Potential build performance issue in 'Signum.Codemirror.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Signum\tsconfig.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.CodeMirror\bin\Debug\net7.0\tsconfig.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 1282: WARNING: Potential build performance issue in 'Signum.Notes.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Signum\tsconfig.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.Notes\bin\Debug\net7.0\tsconfig.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 1518: WARNING: Potential build performance issue in 'Signum.UserAssets.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Signum\tsconfig.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.UserAssets\bin\Debug\net7.0\tsconfig.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 1520: WARNING: Potential build performance issue in 'Signum.DiffLog.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Signum\tsconfig.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.DiffLog\bin\Debug\net7.0\tsconfig.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 1833: WARNING: Potential build performance issue in 'Signum.Files.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Signum\tsconfig.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.Files\bin\Debug\net7.0\tsconfig.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 2209: WARNING: Potential build performance issue in 'Signum.Caching.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Signum\tsconfig.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.Caching\bin\Debug\net7.0\tsconfig.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 2328: WARNING: Potential build performance issue in 'Signum.TimeMachine.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Signum\tsconfig.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.TimeMachine\bin\Debug\net7.0\tsconfig.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 2444: WARNING: Potential build performance issue in 'Signum.Omnibox.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Signum\tsconfig.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.Omnibox\bin\Debug\net7.0\tsconfig.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 2564: WARNING: Potential build performance issue in 'Signum.Scheduler.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Signum\tsconfig.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.Scheduler\bin\Debug\net7.0\tsconfig.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 2574: WARNING: Potential build performance issue in 'Signum.Rest.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Signum\tsconfig.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.Rest\bin\Debug\net7.0\tsconfig.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 2578: WARNING: Potential build performance issue in 'Signum.Eval.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Signum\tsconfig.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.Eval\bin\Debug\net7.0\tsconfig.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 2592: WARNING: Potential build performance issue in 'Signum.Isolation.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Signum\tsconfig.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.Isolation\bin\Debug\net7.0\tsconfig.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 2596: WARNING: Potential build performance issue in 'Signum.Migrations.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Signum\tsconfig.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.Migrations\bin\Debug\net7.0\tsconfig.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 2598: WARNING: Potential build performance issue in 'Signum.ConcurrentUser.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Signum\tsconfig.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.ConcurrentUser\bin\Debug\net7.0\tsconfig.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 2600: WARNING: Potential build performance issue in 'Signum.Help.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Extensions\Signum.Omnibox\tsconfig.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.Help\bin\Debug\net7.0\tsconfig.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 2602: WARNING: Potential build performance issue in 'Signum.Processes.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Signum\tsconfig.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.Processes\bin\Debug\net7.0\tsconfig.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 2730: WARNING: Potential build performance issue in 'Signum.Toolbar.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Signum\tsconfig.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.Toolbar\bin\Debug\net7.0\tsconfig.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 2903: WARNING: Potential build performance issue in 'Signum.Dashboard.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Extensions\Signum.Omnibox\tsconfig.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.Dashboard\bin\Debug\net7.0\tsconfig.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 3267: WARNING: Potential build performance issue in 'Signum.UserQueries.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Signum\tsconfig.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.UserQueries\bin\Debug\net7.0\tsconfig.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 3484: WARNING: Potential build performance issue in 'Signum.Tree.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Extensions\Signum.UserQueries\package.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.Tree\bin\Debug\net7.0\package.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 3954: WARNING: Potential build performance issue in 'Signum.Chart.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Extensions\Signum.Omnibox\tsconfig.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.Chart\bin\Debug\net7.0\tsconfig.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 3976: WARNING: Potential build performance issue in 'Signum.Map.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Extensions\Signum.Omnibox\tsconfig.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.Map\bin\Debug\net7.0\tsconfig.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 4319: WARNING: Potential build performance issue in 'Signum.Templating.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Extensions\Signum.UserQueries\package.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.Templating\bin\Debug\net7.0\package.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 4325: WARNING: Potential build performance issue in 'Signum.MachineLearning.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Extensions\Signum.Omnibox\tsconfig.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.MachineLearning\bin\Debug\net7.0\tsconfig.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 4328: WARNING: Potential build performance issue in 'Signum.Dynamic.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Extensions\Signum.Caching\tsconfig.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.Dynamic\bin\Debug\net7.0\tsconfig.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 4337: WARNING: Potential build performance issue in 'Signum.SMS.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Extensions\Signum.UserQueries\package.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.SMS\bin\Debug\net7.0\package.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 4911: WARNING: Potential build performance issue in 'Signum.Mailing.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Extensions\Signum.Omnibox\tsconfig.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.Mailing\bin\Debug\net7.0\tsconfig.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 4937: WARNING: Potential build performance issue in 'Signum.Authorization.ResetPassword.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Extensions\Signum.Caching\package.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.Authorization.ResetPassword\bin\Debug\net7.0\package.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 5047: WARNING: Potential build performance issue in 'Signum.Authorization.ActiveDirectory.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Signum\tsconfig.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.Authorization.ActiveDirectory\bin\Debug\net7.0\tsconfig.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 5189: WARNING: Potential build performance issue in 'Signum.Mailing.Package.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Extensions\Signum.Mailing\package.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.Mailing.Package\bin\Debug\net7.0\package.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 5711: WARNING: Potential build performance issue in 'Signum.Excel.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Extensions\Signum.Caching\tsconfig.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.Excel\bin\Debug\net7.0\tsconfig.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 6147: WARNING: Potential build performance issue in 'Signum.Alerts.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Extensions\Signum.Caching\package.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.Alerts\bin\Debug\net7.0\package.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 6148: WARNING: Potential build performance issue in 'Signum.Mailing.MicrosoftGraph.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Extensions\Signum.Mailing\package.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.Mailing.MicrosoftGraph\bin\Debug\net7.0\package.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 6150: WARNING: Potential build performance issue in 'Signum.Translation.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Extensions\Signum.UserQueries\package.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.Translation\bin\Debug\net7.0\package.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 6158: WARNING: Potential build performance issue in 'Signum.Word.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Signum\tsconfig.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.Word\bin\Debug\net7.0\tsconfig.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 6545: WARNING: Potential build performance issue in 'Signum.Workflow.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Signum\tsconfig.json' is newer than destination 'D:\Signum\southwind\Framework\Extensions\Signum.Workflow\bin\Debug\net7.0\tsconfig.json', not up-to-date. See https://aka.ms/incremental-build-failure.
    Line 6549: WARNING: Potential build performance issue in 'Southwind.csproj'. The project does not appear up-to-date after a successful build: Item with CopyToOutputDirectory="PreserveNewest" source 'D:\Signum\southwind\Framework\Extensions\Signum.UserQueries\package.json' is newer than destination 'D:\Signum\southwind\Southwind\bin\Debug\net7.0\package.json', not up-to-date. See https://aka.ms/incremental-build-failure.

I have tried playing with UpToDateCheckInput / UpToDateCheckOutput with no results

    <ItemGroup>
        <UpToDateCheckInput Include="**/*.ts" Set="Scripts" />
        <UpToDateCheckInput Include="**/*.tsx" Set="Scripts" />
        <UpToDateCheckInput Remove="ts_out/**/*.*" Set="Scripts" />
        <UpToDateCheckOutput Include="ts_out/**/*.*" Set="Scripts" />
    </ItemGroup>

AFAIK, this options only allow to add new items, but not to remove / change set of items implicitly added, in this case by TypeScriptCompile.

drewnoakes commented 1 year ago

Thanks very much for reporting this.

From what I can see the fast up-to-date check is working correctly and the problem exists elsewhere, perhaps in the Microsoft.TypeScript.MSBuild package. To wit:

Comparing timestamps of inputs and outputs:
    <snip>
    Adding UpToDateCheckBuilt outputs:
        C:\Users\drnoakes\source\repos\WebApplication54\WebApplication54\bin\Debug\net7.0\WebApplication54.dll
        C:\Users\drnoakes\source\repos\WebApplication54\WebApplication54\obj\Debug\net7.0\WebApplication54.dll
        C:\Users\drnoakes\source\repos\WebApplication54\WebApplication54\obj\Debug\net7.0\WebApplication54.pdb
        C:\Users\drnoakes\source\repos\WebApplication54\WebApplication54\bin\Debug\net7.0\WebApplication54.pdb
    <snip>
    Adding TypeScriptCompile inputs:
        C:\Users\drnoakes\source\repos\WebApplication54\WebApplication54\CompileMe.ts
    <snip>

The .ts files must not be present in this default set of inputs/outputs. Compiling a changed .ts file does not result in an update to any of the outputs listed there (.dll or .pdb files).

As you correctly identified, these items should be included in a differentiated Set. That should be happening by default in whatever code is adding these items to the project and configuring them as up-to-date check inputs. Some part of the build is explicitly opting TypeScriptCompile items in for the check. It must also control the set. Further, the set must have at least one output item so that there is something to check input timestamps against.

I won't have time to dig into this until later in the week at the earliest. Hopefully the above is helpful if you want to investigate further.

Let's get that fixed/understood first. We can investigate the overbuild warnings around tsconfig.json and package.json after, if they're still an issue.

olmobrutall commented 1 year ago

Thanks @drewnoakes for the early response.

The .ts files must not be present in this default set of inputs/outputs. Compiling a changed .ts file does not result in an update to any of the outputs listed there (.dll or .pdb files).

As you correctly identified, these items should be included in a differentiated Set. That should be happening by default in whatever code is adding these items to the project and configuring them as up-to-date check inputs. Some part of the build is explicitly opting TypeScriptCompile items in for the check. It must also control the set. Further, the set must have at least one output item so that there is something to check input timestamps against.

I'm glad that we both seem to agree on what is going on. Let's see if we can get someone in the Typescript team involved. @RyanCavanaugh?

I won't have time to dig into this until later in the week at the earliest. Hopefully the above is helpful if you want to investigate further.

It is true that by using UpToDateCheckInput/ UpToDateCheckOutput I can only add items to compare, but I can not remove the ones that are implicitly added (probably by Microsoft.TypeScript.MSBuild)?

Without this feature, I can not completly split the default set from the Scripts set. I can add ts_out/tsconfig.tsbuildinfo to the default set, but since the check is MAX(input) < MIN(output), it doesn'T solve the problem because the old .dll wins over the new .tsbildinfo

Let's get that fixed/understood first. We can investigate the overbuild warnings around tsconfig.json and package.json after, if they're still an issue.

I've found a solution for this. Adding in Directory.Build.targets

    <ItemGroup>
        <Content Update="package.json">
            <CopyToOutputDirectory>Never</CopyToOutputDirectory>
        </Content>
        <Content Update="tsconfig.json">
            <CopyToOutputDirectory>Never</CopyToOutputDirectory>
        </Content>
    </ItemGroup>

Prevents the chain-reaction and only recompiles ad infinitum Signum.csproj.

Why are this json files "Copy If Newer" by default? It makese sense for appsettings.json but not for package.json or tsconfig.json.

Shouldn't this common files be considered by VS item templates?

drewnoakes commented 1 year ago

The TypeScript team needs to take a look at this and expose their project items correctly for the fast up-to-date check.

Thanks for filing https://github.com/microsoft/TypeScript/issues/53795. I'll comment there. At this point there's no work item for this repo.