Closed olmobrutall closed 6 years ago
More Info:
If I update only package.json works.
The problem is updating <TypeScriptToolsVersion>2.7</TypeScriptToolsVersion>
the .csproj files.
@uniqueiniquity can you take a look? looks related to recent changes to the targets/tasks.
@olmobrutall Would you be willing to post or send me the whole v=diag
output?
It's a bit hard to tell from that set of lines what's actually happening.
In general, should_not_exist.file
is a dummy file name used (when TypeScriptCompileBlocked
is not set) to trigger a build when no build log file exists. So if it's not being removed from the GeneratedJavascript
item group properly for some reason, it is somehow getting propagated to the item list that determines what to copy from the dist
folder. Again, a full log would help me trace exactly how that's happening. A quick workaround would be to ensure should_not_exist.file
is removed from whatever item list is being processed on line 516965.
@uniqueiniquity I've managed to reproduce the issue in a very similar -but open source- application.
Clonning https://github.com/signumsoftware/southwind (master branch)
and runnning
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Msbuild.exe" Southwind.sln /p:Configuration=Release /p:Platform="Any CPU" /p:DeployOnBuild=true /p:PublishProfile=FolderProfile /p:VisualStudioVersion=15.0 /flp:v=diag
If you want to avoid the hassle the full log is here: https://1drv.ms/u/s!AiVD6FOsvtuPkHV5kvw9yqanZof_
There are about 12 csproj files and 3 of them have Typescript code:
The tsconfig.json files are using "noEmit": true,
while webpack.config overrides with
options: { transpileOnly: true, compilerOptions: { "noEmit": false } }
This way I use MSBuild / VS for compile-time errors only, and webpack for javascript generation only.
If you look at the log, for Signum.React the file is added and removed:
Added Item(s): GeneratedJavascript=should_not_exist.file
Done building target "PreComputeCompileTypeScriptWithTSConfig" in project "Signum.React.csproj".: (TargetId:1310)
Target "CompileTypeScriptWithTSConfig: (TargetId:1311)" in file "C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.7\build\Microsoft.TypeScript.targets" from project "C:\Code\Southwind\Framework\Signum.React\Signum.React.csproj" (target "Compile" depends on it):
Building target "CompileTypeScriptWithTSConfig" completely.
Output file "should_not_exist.file" does not exist.
Using "CreateProperty" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Task "CreateProperty" (TaskId:814)
Task Parameter:Value=true (TaskId:814)
Output Property: CompileRan=true (TaskId:814)
Done executing task "CreateProperty". (TaskId:814)
Removed Item(s): GeneratedJavascript=should_not_exist.file
Same for Signum.React.Extensions:
Added Item(s): GeneratedJavascript=should_not_exist.file
Done building target "PreComputeCompileTypeScriptWithTSConfig" in project "Signum.React.Extensions.csproj".: (TargetId:1392)
Target "CompileTypeScriptWithTSConfig: (TargetId:1393)" in file "C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.7\build\Microsoft.TypeScript.targets" from project "C:\Code\Southwind\Extensions\Signum.React.Extensions\Signum.React.Extensions.csproj" (target "Compile" depends on it):
Building target "CompileTypeScriptWithTSConfig" completely.
Output file "should_not_exist.file" does not exist.
Task "CreateProperty" (TaskId:871)
Task Parameter:Value=true (TaskId:871)
Output Property: CompileRan=true (TaskId:871)
Done executing task "CreateProperty". (TaskId:871)
Removed Item(s): GeneratedJavascript=should_not_exist.file
But something different happens for Soutnwind.React:
Added Item(s): GeneratedJavascript=should_not_exist.file
Done building target "PreComputeCompileTypeScriptWithTSConfig" in project "Southwind.React.csproj".: (TargetId:1474)
Target "CompileTypeScriptWithTSConfig: (TargetId:1475)" in file "C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.7\build\Microsoft.TypeScript.targets" from project "C:\Code\Southwind\Southwind.React\Southwind.React.csproj" (target "Compile" depends on it):
Skipping target "CompileTypeScriptWithTSConfig" because it has no inputs.
Though the target has declared its inputs, the input specification only references empty properties and/or empty item lists.
Done building target "CompileTypeScriptWithTSConfig" in project "Southwind.React.csproj".: (TargetId:1475)
Target "GetTypeScriptOutputForPublishing: (TargetId:1476)" in file "C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.7\build\Microsoft.TypeScript.targets" from project "C:\Code\Southwind\Southwind.React\Southwind.React.csproj" (target "Compile" depends on it):
Task "AssignTargetPath" (TaskId:924)
Task Parameter:Files=should_not_exist.file (TaskId:924)
Task Parameter:RootFolder=C:\Code\Southwind\Southwind.React (TaskId:924)
Output Item(s):
GeneratedJavascriptWithTargetPath=
should_not_exist.file
OriginalItemSpec=should_not_exist.file
TargetPath=should_not_exist.file (TaskId:924)
Done executing task "AssignTargetPath". (TaskId:924)
Added Item(s):
FilesForPackagingFromProject=
should_not_exist.file
Category=Run
DestinationRelativePath=
Exclude=False
FromTarget=Unknown
OriginalItemSpec=should_not_exist.file
ProjectFileType=Default
TargetPath=should_not_exist.file
Added Item(s):
ContentWithTargetPath=
should_not_exist.file
OriginalItemSpec=should_not_exist.file
TargetPath=should_not_exist.file
Added Item(s): Content=should_not_exist.file
Looks like the file is not removed from the list.
I had this exact issue 6 days ago and nothing what I tried seemed to fix it (This thread is the only relevant google search result for should_not_exist.file
, there were no results before.). In the end, I managed to get rid of the error by repairing Visual Studio from the installer.
Note: I'm using Visual Studio 2015
I have the same problem after updating my visual studio typescript version to 2.7.1.
@olmobrutall seems like I don't have access for the one drive link. I'll clone the repo and investigate that way.
@uniqueiniquity the problem was with the last underscore in the link https://1drv.ms/u/s!AiVD6FOsvtuPkHV5kvw9yqanZof_
@olmobrutall Seems that we have a bug involving TypeScriptCompileBlocked
. I apologize for the inconvenience this has caused you.
I will fix this in a future version of the TS SDK, but for now, the culprit is line 310 of C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.7\build\Microsoft.TypeScript.targets
.
If you change it from
<GeneratedJavascript Condition="'@(GeneratedJavascript)' == ''" Include="should_not_exist.file" />
to
<GeneratedJavascript Condition="'@(GeneratedJavascript)' == '' AND '@(TypeScriptInputFiles)' != ''" Include="should_not_exist.file" />
then the dummy file will not be added to the list of files to copy.
No worries.
Do you see possible that a TS 2.7.2 comes before 2.8? There are some developers involved and I had a bad experience doing custom hacks that then have to be roll-baked in every computer (https://github.com/Microsoft/TypeScript/issues/19406).
This change is planned for 2.7.2, should be out in a week or so.
Typescript team rocks :)
For those following along and fixing this before 2.7.2, the offending line might be 386, depending on whether or not your project has a TSConfig. Both lines will be fixed in 2.7.2.
glad I found this, this is serious problem as it effectively makes deployment from the IDE and from MSBUILD impossible. it's not just an inconvenience...
Still seeing this error with 2.7.2. Attaching build log...
@wldkrd1 The build log seems to say you are still using 2.7.1 (line 2455, for example).
Gah, I had 2.7.2 installed on the machine, but 2.7.1 nuget package. Updated the nuget package, all is well.
Is there any update on this issue in regards to Visual Studio Team Services? The only way I can get the build to work in VSTS is if I download a local agent so it runs a correct TypeScript version.
Installing Microsoft.TypeScript.MSBuild (v2.7.2) got our VSTS builds working again. Probably better to be explicit with the TypeScript version to use than to let VSTS choose.
@karlromanowski Are you running a local agent? I was able to get it to work with a local agent but using a hosted agent makes the issue occur.
In case more people run into this problem - updating your TS via npm is not enough. You actually need TypeScript SDK of version 2.7.2 (https://www.microsoft.com/en-us/download/confirmation.aspx?id=55258)
@trailmax Thanks for pointing that out; sorry for not being clearer.
Apparently VSTS updated their VS2017 Hosted environments to 2.7.1 yesterday, which causes this issue to appear for people using TypeScriptCompileBlocked
in their csproj file. In case you're here because of that, I was able to fix this by removing/commenting out this tag in the csproj file:
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets')" />
I found out a better solution is to install the Microsoft.VisualStudio.MsBuild
NuGet package v2.7.2. This updates the build targets to point to the nuget folder so we don't rely on the environment's TypeScript version. I didn't realize Karl's earlier comment about this was referring to a NuGet package.
@j2jensen This seems to have worked. For anybody wanting the link to the NuGet (I found it in a comment you put somewhere else) https://www.nuget.org/packages/Microsoft.TypeScript.MSBuild/
What I would like to know though, is there a way to just get MSBuild to not know about TypeScript at all. I am using WebPack to build JS, and my Publish includes the relevant created files. I don't know MSBuild to touch my TypeScript files.
@Thorocaine, I believe that using @j2jensen's first suggestion will have the result you want, though in ASP.NET Core and NodeJS projects, this line is implicitly included.
Along with @Thorocaine I would like to know if there is a way to avoid the TypeScript targets from getting added to my .csproj file. I thought TypeScriptCompileBlocked would do it but I guess not.
@MKuenzi I guess my question to you is what do you wish TypeScriptCompileBlocked
was doing that it's not? In scenarios like ASP.NET Core, the TypeScript targets are always imported implicitly, so if there's something that the setting is not blocking, we'd certainly like it to work in those projects as well.
@uniqueiniquity I'd be glad to. My goal is to prevent the TypeScript Targets from being added to the .csproj project file since I am compiling TypeScript outside of MSBuild/Visual Studio.
EDIT: I should clarify my ultimate goal is to make sure that MSBuild/Visual Studio isn't building my TypeScript, so if TypeScriptCompileBlocked is doing that maybe everything is working as expected.
Right now as soon as I add a TypeScript file to my .csproj project file and save the project file, Visual Studio will import the TypeScript targets. It would be great if there was someway I could signal to Visual Studio not to add those targets back on a TypeScript file add.
EDIT2: https://www.typescriptlang.org/docs/handbook/compiler-options-in-msbuild.html It looks like TypeScriptCompileBlocked should be preventing MSBuild from compiling and I have no evidence that it is not working. I thought the targets implied the compilation by MSBuild.
My apologies!
No worries, glad that everything is resolved! Let me know if you have any more questions.
We just update some applications using Visual Studio .csproj files and Typescript to 2.7.1 (strict).
The process went smoth, fixing the definitely assignment of class fields, but the CI system fails with the following message:
Copying file should_not_exist.file to obj\x64\To-Test\Package\PackageTmp failed. Could not find file 'should_not_exist.file'
The project file is very similar to: https://github.com/signumsoftware/southwind/blob/master/Southwind.React/Southwind.React.csproj
This file contains two custom blocks:
SignumTSGenerator
Custom MSBuild task that generates TS code from C#, commenting it out does not make any difference so I think is ok.
WebPackBuild
This parts collects everithing in
dist
folder to the MSDeploy package. Commenting it out removes the problem (but of course the application doesn't work).Also, reverting the commits that updated to 2.7 (similar to https://github.com/signumsoftware/southwind/commit/d9c20f181f9512ef6c602de98c6f489a8c21b937#diff-b80350f6aff97bcc35c7aa3fe715a3b2) removes the problem.
I've compared a
v=diag
build of the solution with 2.6 and 2.7.The files are quite big, but while the 2.6 version makes no reference to
should_not_exist.file
, the new one does many times. Here are the Search results:Any idea what this files does, and why/how it could interact with MSDeploy / dist folder?