UpToDateCheck: always fail if projects.assets.json is updated
See original GitHub issueVisual Studio Version: 16.5.5
Summary:
Steps to Reproduce:
-
Create .NET Standard project
-
Build twice (UpToDateCheck should work on second build)
-
Touch
obj\projects.assets.json
(in practice, it happens to me once in a while when VS restore solution) -
Build once: UpToDateCheck fails (expected) and trigger build However output files are not being touched because
CoreCompile
is skipped (Inputs
don’t containobj\projects.assets.json
, only.cs
files)
Expected Behavior:
- Build again: UpToDateCheck succeed
Actual Behavior:
- Build again: UpToDateCheck fails (because output files are still older than
obj\projects.assets.json
)
User Impact:
UpToDateCheck is broken until a full Rebuild
Workaround
Here’s a MSBuild Target to add this file to CoreCompile
inputs:
<Target Name="_GenerateCompileInputsProjectAssets" AfterTargets="_GenerateCompileInputs">
<ItemGroup>
<CustomAdditionalCompileInputs Include="$(ProjectAssetsFile)" />
</ItemGroup>
</Target>
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:17 (14 by maintainers)
Top Results From Across the Web
Assets file project.assets.json not found. Run a NuGet ...
The error occurs because the dotnet cli does not create the all of the required files initially. Doing dotnet restore adds the required...
Read more >NuGet Restore build issues - project.assets.json doesn't ...
If you run restore using dontet or msbuild, and then check if the project. asset. json is regenerated. It should be different from...
Read more >NETSDK1004: Assets file not found - .NET CLI
This error occurs when the assets file project.assets.json is not found during build. The full error message is similar to the following ...
Read more >Fixing missing project.json error in old csproj format
The cause comes from left over files in your obj catalogues. The file in question seems to named project.assets.json. Deleting these in all...
Read more >project.assets.json not found when building on teamcity agent
When we run using the TeamCity agent, we always get the following error: C:\Program Files\dotnet\sdk\2.0.0\Sdks\Microsoft.NET.Sdk\build\Microsoft.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@nkolev92 sorry that I didn’t answer at the time. I don’t remember exactly when the problem started.
I just tried the repro steps here and it no longer reproduces in 17.1. We have made several changes to the fast up-to-date check since this issue was filed, and looking at the code I do not expect this issue to exist any more. I expect the fix exists in 16.11 (possibly earlier).
I’ll close this. Let me know if you still experience this issue. Thanks.