devenv always rebuilds my project, because a typescript file is newer than a pdb file

烈酒焚心 提交于 2019-12-11 03:04:37

问题


I have a project with typescripts. devenv constantly rebuilding this project. Diagnostics output contains this line:

Project 'Benefits' is not up to date. Input file 'C:\abc\UI\BenefitsWeb\Scripts\Benefits\Modules\PPACA\ApprovalScreen.ts' is modified after output file 'C:\abc\UI\BenefitsWeb\bin\Dayforce.Web.Benefits.pdb'.

So, how do I resolve this issue? The aforementioned typescript file is truly newer than the PDB. But the PDB is not the output of the typescript compilation !!!

Here is how I compile my typescript files:

<PropertyGroup>
  <CompileDependsOn>
    $(CompileDependsOn);
    CompileTypeScript
  </CompileDependsOn>
</PropertyGroup>

<Target Name="GetInputs">
  ...
</Target>

<Target Name="GetOutputs">
  ...
</Target>

<Target Name="CompileTypeScript" DependsOnTargets="GetInputs;GetOutputs" Inputs="@(InputTypeScripts)" Outputs="@(OutputJavaScripts)">
  ...
</Target>

The project specifies the typescript files in the TypeScriptCompile item group, for instance:

<TypeScriptCompile Include="Scripts\Benefits\Modules\PPACA\CalendarSetup.ts" />

Of course, @(OutputJavaScripts) lists the expected .js files only. No PDB files there.

So how come devenv matches a typescript file with a PDB file? How do I fix it?

EDIT 1

I would like to clarify. It does not actually recompile the typescript or C# files (well for the first time it does recompile the typescript files, but only that). It starts the build, because typescript is newer than a PDB, but then it recognizes that no PDB dependency has actually changed. The same is true for the javascript files - they are all up-to-date. So nothing is actually rebuilt, but why to enter the build sequence in the first place!


回答1:


I had a similar issue but with a txt file instead of a typescript file. I opened up the csproj file, found the section that declared the text files, and moved it above a section where it was declaring some project references. Basically, above any binary-type files. After reloading the project, MSBuild wouldn't build it unless a file in it had actually changed.




回答2:


I had a similar issue with a js file. Setting its Build Action to None, recompile, then back to Content, recompile solved the issue.



来源:https://stackoverflow.com/questions/22853058/devenv-always-rebuilds-my-project-because-a-typescript-file-is-newer-than-a-pdb

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!