You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you build an MsBuild project using the nuget package microsoft.typescript.msbuild, there is a target named TypeScriptDeleteOutputFromOtherConfigs which runs before CompileTypeScript.
This target aims to delete tsc...out files from other "configs" then the "current", whatever that means.
In case you build the project in Debug mode, there will be a file created:
However this 2. build in Release mode will grab the previous Tsc....out from the Debug folder. It will delete all the previously built files listed in that file.
Target TypeScriptDeleteOutputFromOtherConfigs uses property $(BaseIntermediateOutputPath) which is like ...full path to project...\obj\.
I don't really understand what this Target aims to do; but couldn't it use propery $(IntermediateOutputPath) which is like obj\<Configuration>\<TargetFramework>\?
That way the above issue could be avoided.
I would think it could not cause any harm since this Tsc....out file is written by the TypeScript targets which by me always put this file into obj/Debug or obj/Release, never outside of these.
The 2. build in Release mode grabbed the previous Tsc....out from the Debug folder, and deleted all the previously built files listed in that file.
This causes the previously built files to get deleted unnecessarily.
In our project structure - which is complex and tricky - it also causes a build error.
(We have a workaround for that, we simply override target TypeScriptDeleteOutputFromOtherConfigs to do nothing; so this issue is only for the benefit of the community.)
🙂 Expected behavior
Don't really know when TypeScriptDeleteOutputFromOtherConfigs could be helpful, but it (maybe) should only scan for Tsc....out files in obj/<TargetFramework>
The text was updated successfully, but these errors were encountered:
Hello @nvirth! Could you share how you override the target TypeScriptDeleteOutputFromOtherConfigs? We are experiencing the same problem here with microsoft.typescript.msbuild 5.4.5.
Here is a tiny abstract project that reproduces the problem, causing the build to fail with the error:
\Microsoft.TypeScript.targets(712,5): error MSB3061: Unable to delete file "...". Access to the path '...' is denied
Just compile it with dotnet build -m:12 WebApplication.sln until it happens (around 20% of the times for me).
The more frameworks we try to build in parallel the bigger are the chances to hit the problem.
If we compile for only one framework, like dotnet build -f:net8.0 -m:12 WebApplication.sln, the problem won't happen.
Bug Report
If you build an MsBuild project using the nuget package microsoft.typescript.msbuild, there is a target named
TypeScriptDeleteOutputFromOtherConfigs
which runs beforeCompileTypeScript
.This target aims to delete
tsc...out
files from other "configs" then the "current", whatever that means.In case you build the project in Debug mode, there will be a file created:
Now if you build this project in Release mode:
However this 2. build in Release mode will grab the previous
Tsc....out
from the Debug folder. It will delete all the previously built files listed in that file.Target
TypeScriptDeleteOutputFromOtherConfigs
uses property$(BaseIntermediateOutputPath)
which is like...full path to project...\obj\
.I don't really understand what this Target aims to do; but couldn't it use propery
$(IntermediateOutputPath)
which is likeobj\<Configuration>\<TargetFramework>\
?That way the above issue could be avoided.
I would think it could not cause any harm since this
Tsc....out
file is written by the TypeScript targets which by me always put this file intoobj/Debug
orobj/Release
, never outside of these.🔎 Search Terms
TypeScriptDeleteOutputFromOtherConfigs
🕗 Version & Regression Information
It is sure present in:
microsoft.typescript.msbuild v4.4.4
microsoft.typescript.msbuild v4.8.1-rc
🙁 Actual behavior
The 2. build in Release mode grabbed the previous
Tsc....out
from the Debug folder, and deleted all the previously built files listed in that file.This causes the previously built files to get deleted unnecessarily.
In our project structure - which is complex and tricky - it also causes a build error.
(We have a workaround for that, we simply override target
TypeScriptDeleteOutputFromOtherConfigs
to do nothing; so this issue is only for the benefit of the community.)🙂 Expected behavior
Don't really know when
TypeScriptDeleteOutputFromOtherConfigs
could be helpful, but it (maybe) should only scan forTsc....out
files inobj/<TargetFramework>
The text was updated successfully, but these errors were encountered: