Visual Studio Rebuilds unmodified projects sometimes after a PC reboot - c#

I've a Visual Studio 2013 solution with about 50 C# projects. Normally if I select build (F6) it just builds the projects which have changed. But sometimes after a I shut down and restart my PC it rebuilds all when I select build (F6). Why?
This doesn't happen all the time when I restart my PC. Most of the times it says that all projects are up to date after a reboot. But sometimes it rebuilds all.
I took a look at the following question Visual Studio Rebuilds unmodified projects and its answers.
The next step I did was to set the build output verbosity to diagnostic.
I'm getting the following output when Visual Studio rebuilds all after a PC restart:
1>Project 'Project1' is not up to date. Missing input file
...
There much more lines (more than 1000). I took a look at them but I still don't understand why Visual Studio rebuilds the project.
Update
Why does Visual Studio needs the following file?
1>Project 'Project1' is not up to date. Missing input file
'c:\users\wo\appdata\local\temp\.netframework,version=v4.5.assemblyattributes.cs'.
...

For future travelers, I think it's also just a bug in current versions of Visual Studio 2019, 16.6 and newer.
This problem happens for me with Visual Studio 2019 versions 16.6.0 and 16.6.1. I have cross-version aware C# projects that do not have this issue for 2010, 2015, 2017, or 2019 16.5 and older, on the same machine and same user, with the same project in the same folder and solution.
With the recent 2019 versions (in the last month or so, May and June 1st 2020) I get similar message:
1>Project 'Banana' is not up to date. Missing input file 'c:\users\banana\appdata\local\temp.netframework,version=v4.7.2.assemblyattributes.cs'.
If I clean then build, then its normal. If I run a successive build I get the error.
This happens with or without reboot, and after cleaning temp folders even, or if I run Visual Studio with admin or not. The path its trying to find really exists, and pops up if paste in explorer.
I've completely cleaned all but the code files with fresh folders and have the same issue. For me it's only with C# projects. So I think it's a 16.6 bug.
See recent changes:
KirillOsenkov commented on Jan 4 2020
#livarcocc would it be possible to prioritize this? This is an impactful issue that's very easy to fix and has been open for three years now. Seems like low-hanging fruit.
bording commented on Feb 12 2020
With the fix for this being merged into master now, which release will it be a part of? I see that this issue is on the 16.5 milestone, so does that mean it will be in that release, or does the fix also need to be ported to another branch?
tmat commented on Feb 12 2020
#bording I updated the milestone to 16.6 as I believe master is 16.6.
https://github.com/microsoft/msbuild/issues/1479

Visual Studio Rebuilds unmodified projects sometimes after a PC reboot
One possibility that caused this issue is that the building account lost permission to the temp folder. To resolve this issue, you can try to grant permissions read/write/execute to the temp folder, or maybe try running visual studio as administrator to see if it is permissions related.
As we know, if we Open/Build a project in visual studio, .NETFramework,Version=v4.x.AssemblyAttributes.cs appears in temp folder automatically. If you lost permission to the temp folder after restart PC or not running visual studio as administrator, we could not access the temp folder, then Visual Studio will report that it can not find the file version=v4.5.assemblyattributes.cs in the temp folder.
Alternatively, you can also generate this file into the Intermediate directory (usually called obj) by adding following property to the project file:
<PropertyGroup>
<TargetFrameworkMonikerAssemblyAttributesPath>$([System.IO.Path]::Combine('$(IntermediateOutputPath)','$(TargetFrameworkMoniker).AssemblyAttributes$(DefaultLanguageSourceExtension)'))</TargetFrameworkMonikerAssemblyAttributesPath>
</PropertyGroup>
Credentials: MSBuild: unnecessary rebuilds because of generated AssemblyAttributes.cs
Hope this helps.

Related

Visual Studio creates gibberish folder

I'm using Visual Studio 2019 to develop with C#.
Sometimes Visual Studio creates a folder with a gibberish name when I build a solution, like
C:\FNTJ1nkhh1X4r0gk3geH5yIYY8=
This folder only contains the subfolder sqlite3\v1 which in turn contains the following files
db.lock
storage.ide
storage.ide-shm
storage.ide-wal
If such a folder is created, it is created for one certain solution, other solutions don't show that behaviour. Deleting the folder or recreating the solution doesn't help.
To rule them out I already disabled all extensions in Visual Studio but the problem remains.
I've also compared the affected solution file with an unaffected one but didn't find something suspicious.
Has anyone else experienced this and what could be the reason?
After #HansPassant's comment I dug a bit furhter and found that the folder should be located under
%LOCALAPPDATA%\Microsoft\VisualStudio\Roslyn\Cache\RemoteWorkspace
Searching for this location led me to this forum post which confirms this to be a bug in Visual Studio which should be fixed in Visual Studio 2019 version 16.8 preview 3.

Updating to Visual Studio 2017 15.8.6, now completely broken

I updated to Visual Studio 2017 15.8.6 (I'm running Windows 10, fully up to date) last week and since then I have been completely unable to use Visual Studio.
When I try to create a new Visual C++ project, I get the following errors:
Followed by:
Then:
This is not limited to Visual C++. C# projects also fail:
Even pressing the Help button on the toolbar throws an error:
I spent a long time looking up solutions for these issues and tried a variety of methods:
1) I installed the 'Clear MEF Component Cache' extension and ran that. No luck.
2) I completely removed my VisualStudio folders in my AppData directories. No luck.
3) I re-installed Visual Studio 2017. Twice.
4) I ran a Repair installation.
Nothing works. Re-installing does nothing, and none of the solutions I found on MSDN forums work.
Every project template fails. I ensured every necessary component was selected in the Visual Studio installer. I'm out of ideas.
This is the contents of my ActivityLog.xml file, as referenced in several of the error messages:
[https://pastebin.com/RVgpmDTG][1]
Looks like I found the solution. Ran the following from a VS Developer Command Prompt:
gacutil /u Microsoft.Build.Framework
gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Build.Framework.dll"

visual studio 2017 unsupported file on a project built in VS 2017 - csproj issue

the issue i am having is, on a project i've been working on for a week, ONLY IN VS 2017, it now is unsupported. this is the error code i am getting:
Unsupported
This version of Visual Studio is unable to open the following projects. The project types may not be installed or this version of Visual Studio may not support them.
For more information on enabling these project types or otherwise migrating your assets, please see the details in the "Migration Report" displayed after clicking OK.
- theFileThatIsAnIssue.csproj"
No changes required
These projects can be opened in Visual Studio 2015, Visual Studio 2013, Visual Studio 2012, and Visual Studio 2010 SP1 without changing them.
- MyProjectTitle, "C:\Users\meAsAUser\Desktop\MyProjectTitle\MyProjectSolution.sln"
I have gone through and deleted all .user files, tried cloning from my remote repo, opened the sln in notepad to make sure it was any CPU (it is), and restarted both VS and my computer.
it has now put the little "15" marker on all the solutions on my computer, which means this will be an issue for my other projects as well.

Debugger Not Installed While Starting C# Console App in Visual Studio Community 2017

I have freshly installed Visual Studio Community 2017. I have a simple console app that prints a message. When I click the Start button I get the message
Error while trying to run project: Unable to start program
The debugger is not properly installed. Run setup to install or repair the debugger.
If I click on Debug in the menu and Start Without Debugging, I see the output of the program, so build and run seem to be working. However, I guess the debugger is not installed and I'm not sure how to install it. I've done exhaustive Google searches and seen posts talking about running regsvr32 and repair, both of which have proved fruitless.
EDIT:
Installing VS2015 fixed the problem.
#David Bradford, long time after Novell isn't it? Anyway, after looking all over the place this is the best solution I found. You don't have to install VS2015 just follow the directions below. I tried this and it fixed the problem for me and another person I was working with.
Link to the VS developer community that has various comments and the fix below
Added a solution by Andrey ยท Jun 23 at 06:01 PM
Best Solultion
C:\Program Files (x86)\Common Files\Microsoft Shared\VS7Debug
C:\Program Files\Common Files\microsoft shared\VS7Debug
Solution for this problem for Visual Studio 2017 Community.
Clean folders: Delete all the files in the two folders
C:\Program Files (x86)\Common Files\Microsoft Shared\VS7Debug
C:\Program Files\Common Files\microsoft shared\VS7Debug
Then run repair Visual Studio by clicking the menu (three lines stacked up) to the right of the Modify and Launch buttons.
P.S. This issue happen because dlls corrupted. Here is this case
shareimprove this answer
This seems to be a known issue and is under investigation by the VS 2017 team. More information here: https://developercommunity.visualstudio.com/content/problem/26630/the-debugger-is-not-properly-installed-cannot-debu.html

Installation failed while trying to install Visual Studio 2015 community edition [duplicate]

This question already has answers here:
Multiple Errors Installing Visual Studio 2015 Community Edition
(23 answers)
Closed 6 years ago.
I was trying to install visual studio 2015 community edition on my system using the downloaded ISO file. There occurred an error showing the installation failed. The error was like:
team explorer for visual studio 2015
fatal error during installation
I have compared the SHA-1 hash value of my downloaded iso file with one provided at microsoft site. They are correct and matching. I have tried all possibilities including reinstall, repair etc. Still not working.
PS: I have already installed visual studio 2008 on my system and its working properly.
Answer from another question asked on stackoverflow, source:
Multiple Errors Installing Visual Studio 2015 Community Edition
I spent a whole week trying to solve this issue.
What finally did it for me was disabling my anti-virus programs.
Before I stumbled upon my solution, I went through a lot of other solutions. I
thought, I'd post some of the solutions that might prove to be useful for those who are still having trouble with installing Visual Studios 2015 Community Edition.
Solution 1: Minimal Installation
Try installing with minimal extra features. Run the Visual Studios 2015 installation, then click "Custom" and on the following screen, uncheck everything and proceed with the installation.
Solution 2: Delete installation cache
Perhaps the installation failed due to corrupt files in the cache. When installation fails, remove all Visual Studio cache related items and do a full re-installation. To do this, run command prompt (Run as Administrator) and type: "cd /programdata/package cache/" then press enter. Then type "del /f /s *.msi /f /s *.cab" then press enter.
Now run the Visual Studios 2015 installation again.
Solution 3: Delete temporary file data stored on your computer
Open up File Explorer and go to "C:\Users\[Your User Account Name]\AppData\Local\Microsoft". Then delete the following folders: VSCommon, VisualStudio, Blend, VsGraphics, ApplicationInsights, vshub, Team Foundation, Web Platform Installer and MsBuild. After this, run the Visual Studios 2015 Installer again.
Solution 4: Enable all four evaluations of Symbolic links
First, check to see if all four evaluations are enabled. Open up command prompt (Run as Administrator) and type "fsutil behavior query SymlinkEvaluation". All 4 evaluations should be enabled. If they aren't then type "fsutil behavior set SymlinkEvaluation L2L:1 R2R:1 L2R:1 R2L:1". Once those 4 evaluations are set, clear up temporary files and clear installation cache (see Solution 2 and Solution 3) then run the Visual Studios 2015 installation again.
Solution 5: Repair the Redistributables
Perhaps, the problem is that your VC-redistributables are faulty and are in need of repair. To do so, run "Add/Remove programs" and look for all the x86 and x64 versions of Microsoft Visual C++ [Year] Redistributable (Version). Then press Change for each of them and when the uninstallation screen pops up, press Repair. I did it for all the versions I had previously installed: 2012, 2013 and 2015. Therefore, I repaired 6 of them: 2012: x86 and x64, 2013: x86 and x64, 2015: x86 and x64.
Solution 6: Check to see if x86 and x64 sizes are the same
As mentioned by others in this discussion, do a search for vcruntime140.dll and see if the x86 and x64 versions. They should NOT have the same size. If they do, see solution 5 or you can manually delete them (** Be cautious when deleting files from the Windows folder!) and re-install them (from here: https://www.microsoft.com/en-ca/download/details.aspx?id=48145). Also do the same check for msvcp140.dll. I personally did a search for these files in "C:\Windows\SysWOW64 and C:\Windows\System32" and compared the files from the two folders. Moreover I also checked for differences of vcruntime140.dll and msvcp140.dll in "C:\Program Files\Microsoft Visual Studio 14.0" and "C:\Program Files (x86)\Microsoft Visual Studio 14.0"
Solution 7: Temporarily disable all Anti-Virus Protection and Firewalls
For me, it turned out that the problem stemmed from having ByteFence Anti-Malware and Norton Security with Backup protection. I disabled real-time protection from ByteFence Anti-Malware and I disabled Auto-Protect and Smart Firewall from Norton Security with Backup. Before I ran the installation again, I repeated Solution 2 and Solution 3 (scroll up). And Voila, installation was successful. But how did I find out that the Anti-Virus Program was the culprit? Read Solution 8.
Solution 8: Carefully monitor Visual Studios Installation Process for Intrusions
I resorted to this solution in order to find out the problem. After reading Ezh's article, I decided to download Process Monitor v3.2 and Process Explorer v16.1. I was carefully monitoring 3 programs side-by-side: Process Monitor, Process Explorer and the Visual Studios 2015 Installer, and I watched very closely all the processes that the installer was invoking. Then I noticed that when VSIXInstaller.exe process came on and attempted to install something from a remote server, it kept failing over and over again because my Anti-Virus Program would suddenly appear on screen (as a process) and decide to hog/block some important DLL files that VSIX installation needed. Temporarily disabling the anti-virus program solved my issue!
Solution 9: Complete Windows format and re-installation
If all else fails, and you are really desperate to get Visual Studios 2015 working, I suggest a complete Windows re-installation. At this point, the problem is most likely some type of interference/intrusion with a program which you do not know of.
After a tough day of reinstalling and uninstalling of VS2015 again and again (both Professional and Enterprise, both with updates and without) on Windows 10 nothing seemed to help. Finally this approach worked:
Uninstall the crashing version of VS2015 completely
Uninstall C++ 2015 Redistributables - both x64 and x86 version
Restart the computer
Manually delete remaining dlls from both system32 and SysWOW64 system folders (their names end with *140.dll - but be careful and do a backup!)
Download "Microsoft Visual C++ 2015 Redistributable Update 3" from here - https://www.microsoft.com/en-us/download/confirmation.aspx?id=53840 - both x64 and x86 version
Install the "Microsoft Visual C++ 2015 Redistributable Update 3" - both x64 and x86 version
Restart the computer if needed
And finally - Install the VS 2015
Working!
I 've tried all the workarounds that are in "Mai Benanami" answer without success and what finally do the trick was to uninstall all visual studios and all Microsoft Visual C++ XXX Redistributable x86 and x64 versions.
Then, run the Visual Stuido installer again.
Hope it helps!

Categories

Resources