Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Project <PROJECT NAME> is not up to date. Missing input file 'netframework,version=v4.0,profile=client.assemblyattributes.cs

Tags:

I have a sln with > 50 projects, and recently, when I moved to VS2013, every time I press F5 for a build, it will rebuild all the projects, even though I have just performed a build. The diagnostics show, that each project is marked as not up to date with the following error:

Project <PROJECT NAME> is not up to date. Missing input file 'c:\users\USER\appdata\local\temp\2\.netframework,version=v4.0,profile=client.assemblyattributes.cs

I have read these threads:

  • In Visual Studio 2010 why is the .NETFramework,Version=v4.0.AssemblyAttributes.cpp file created, and can I disable this?

  • https://social.msdn.microsoft.com/Forums/vstudio/en-US/15d65667-ac47-4234-9285-32a2cb397e32/migration-from-vs2008-to-vs2010-and-netframeworkversionv40assemblyattributescpp?forum=vcgeneral

but the suggestion there is to add the following line to the proj file:

  <Target Name="GenerateTargetFrameworkMonikerAttribute" />

I did and it did not work. Suppressing the warning as MS suggestion will also not work as the project will remain "not up to date".

I am using VS2013, C# and VB projects. With the very same project and VS2012, such error is not raised and the projects are up to date.

Any suggestions?

UPDATE Perhaps it is worth mentioning that I do have a few build definitions in the solution, where all of the projects are building for AnyCPU except one: http://screencast.com/t/fuw9k4IubN

like image 721
checho Avatar asked Dec 22 '14 11:12

checho


3 Answers

I had the same problem and solved it by upgrading the ToolsVersion attribute in *.csproj files:
ToolsVersion="4.0" replaced with ToolsVersion="16.0"
(I’m using Visual Studio 2019, which is v16.x internally).

like image 112
picrap Avatar answered Sep 23 '22 14:09

picrap


<Target Name="GenerateTargetFrameworkMonikerAttribute" />

Well, not a good idea, that accomplishes the exact opposite of the problem you are trying to solve. It forces MSBuild to create the AssemblyAttributes.cs file, inevitably your project needs to be rebuilt since the file is new. The Q+A you found addresses a completely different issue, these were C++ programmers that were trying to come to grips with a new linker warning in VS2010. They hate warnings that appear from nowhere from files that are not part of their project. Well, don't we all. The marked answer on that SO question is quite evil btw, that other guy posted a much better answer :)

Missing input file 'c:\users\USER\appdata\local\temp\2\.netframework...

There's a signal in this message, note the presence of the \2 subdirectory in that path name. That is a Big Red Flag, it is not normal. This auto-generated .cs file normally lives inside the TEMP directory, not a subdirectory of that folder. Surely this has something to do with your real problem.

MSBuild doesn't do anything special and simply uses System.IO.Path.GetTempPath() to generate the folder name. That method isn't special either, it simply delegates the job to the GetTempPath() winapi function. The diagnostic therefore is that on this build machine, that OS function sometimes generates an odd-ball path, picking a subdirectory of the TEMP folder. And that it doesn't always generate the same one, thus causing your projects to getting rebuilt.

There is at least one good theory for this behavior, mentioned by commenter @Darran Rowe to this blog post:

No, this is Terminal Services at work. When you log in over remote desktop, Windows will set the temp directory for the logon session to %LOCALAPPDATA%\Temp\<session id>

Rings a bell?

like image 29
Hans Passant Avatar answered Sep 23 '22 14:09

Hans Passant


Try deleting the hidden .vs directry which is in the same folder than the solution file.

like image 32
Lumo Avatar answered Sep 25 '22 14:09

Lumo