How to properly update visual studio sources files/directories - visual-studio

My cpps and headers files were messy on visual studio, then I organized it manually on the directories.
The problem is visual studio still trying to compile over the old files names and directories that I have already changed, I'm getting a lot of
C1083: No such file or directory and
MSB8027: Two or more files with the name of ...
But I deleted them and I want to visual studio recognizes it.
What should I do?
Thanks

Related

Visual Studio installer project - keep file while uninstall

I am using Visual Studio Installer Projects to generate MSI files, it includes create log folder when it doesn't exist. When uninstall the program, that log folder and files inside will also deleted. Is there a way to keep those log folder and files during uninstall?

Where can I find the Windows header files

Sometimes in my research into Microsoft functions, I'll see the name of a constant and perhaps a reference to a header file - like winuser.h. I don't often need to refer to them but when I do, I wind up spending some time Googling to find out where those files are. With this question, I can hopefully come to the answer right away. The question, as the title says, is: Assuming I've installed Visual Studio or the SDK, where in the file directory structure on a windows machine can I find the basic windows header files, like windows.h and winuser.h?
First you need to install Visual Studio or the Windows SDK. I'd give URLs here but they change with every new version of windows. The header files could be in
C:\Program Files\Microsoft SDKs\Windows\vX.X\Include
C:\Program Files (x86)\Microsoft SDKs\Windows\vX.X\Include
(where vX.X reflects the version number)
Update - May 2020
I'm on a new machine and installed VS2019 and the WindowsSDK and here are the new locations:
C:\Program Files (x86)\Microsoft Visual
Studio\2019\Professional\SDK\ScopeCppSDK\vc15\SDK\include\um
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um
I do not see any includes in the 'Program Files' folders.

can't build old VS2010 project with VS2013. (build tool for VS2010 cannot be found.)

I have installed VS2013 on my computer about 2 years ago(and removed VS2010 I guess) and today I tried to open my old VS2010 project (MV1.sln) that I used to work with about 5 years ago.
When I tried to open it, it just says "more than one project in the solution was not loaded correctly. refer to the output window"(translated from Korean). The output window says
D:\My_Path\MV1\MV1.vcxproj : error : can't read project file "MV1.vcxproj"
D:\My_Path\MV1\MV1.vcxproj(34,5): can't find imported project "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\BuildCustomizations\CUDA 4.0.props". Check if the path specified in <import> declaration is correct and file exists in the disk.
So I checked the MV1.vcxproj file's line 34 which reads
<Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 4.0.props" />
which seems to be correct path because the value $(VCTargetsPath) is being used before line 34 in the same file and I can easily guess it points to C:\Program Files (x86)\MSBuild (I can see Microsoft.Cpp.props folder and BuildCustomizations\CUDA 4.0.props file referred to in the .vcxproj file)
I had CUDA4.0.props file which specifies include path and library path for CUDA4.0 under C:\Program Files (x86)\Microsoft Visual Studio 10.0 (I kept those files there at that time) but copied it to the location specified in vcxproj file to make it appear there.
I found some similar questions and answers but they seem to be different from my case. What can be the most correct method other than making a new project and copying and specifying everything one-by-one?
I found the file name should have a space in 'CUDA 4.0.props' so I changed the file name(MSBuild/Microsoft.Cpp/V120/BuildCustomizations/CUDA 4.0.targets) , then it complained about CUDA 4.0.targets file missing, so I copied MSBuild/Microsoft.Cpp/v4.0/BuildCustomizations/CUDA 4.0.targets (it was there since 5 years ago) to MSBuild/Microsoft.Cpp/v4.0/V120/BuildCustomizations/CUDA 4.0.targets. Now I can see the files in the project browser but when I build the project, it says
error MSB8020: The build tools for Visual Studio 2010 (Platform
Toolset = 'v100') cannot be found. To build using the v100 build
tools, please install Visual Studio 2010 build tools. Alternatively,
you may upgrade to the current Visual Studio tools by selecting the
Project menu or right-click the solution, and then selecting "Upgrade
Solution...". C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.Cpp.Platform.targets 64 5 MV1
But in my VS2013 I don't see such "Upgrade Solution" or upgrade menu. So I looked for method to change the toolset and found
Visual Studio 2013 error MS8020 Build tools v140 cannot be found and seleted VS2013 and it tries to build now.
(though I have fix some errors cannot link external symbol _CUDAInit.. etc.)

Visual Studio 2013 not using include path

I have a simple empty Visual Studio 2013 C/C++ project to which added two files:
MyCode.cpp
MyCode.h
Inside MyCode.cpp, I have as the first line,
#include "mex.h"
mex.h is a MATLAB file located in C:\Program Files\MATLAB\MATLAB Compiler Runtime\v717\extern\include
I have gone to Project Properties -> C/C++ -> General and added "C:\Program Files\MATLAB\MATLAB Compiler Runtime\v717\extern\include" to my "Additional Include Directories".
And yet, VS never finds the file!
File 'mex.h' not found in current source file's directory or in build system paths.
It seems that the build system paths are not being updated with my additional include path.
I've tried using relative paths as well, deleting the .sdf file, and closing/reopening Visual Studio. It simply won't add the path.
For reference, this works fine in Visual Studio 2010.
Help!

How can I delete bad Visual Studio templates?

How do you remove the following noise templates that don't even work?
In Visual Studio: go to Tools > Extensions and Updates and then uninstall or disable the template.
To save a bit of time for 2010 users, the folder has moved:
...\My Documents\Visual Studio 2010\Templates\ProjectTemplates
For Visual Studio 2013, I found my template cache here:
%USERPROFILE%\AppData\Roaming\Microsoft\VisualStudio\12.0\ProjectTemplatesCache
Deleting them off of disk should do the trick. Where they exist will depend a bit on where you installed them. If you installed them for all users they will be at
%ProgramFiles%\Microsoft Visual studio 9.0\Common7\Ide\ProjectTemplatesCache
For a single user they will be at
%USERPROFILE%\Visual Studio 2008\Templates\ProjectTemplates
EDIT
If InstallVSTemplates fails, it is likely one of the following. The one I can't help with is some program randomly dumping files inside of the ProjectTemplatesCache directory.
The other more likely cause is there is a bad template in the ProjectTemplates directory. InstallVSTemplates really just goes through this directory, and unzips all of the files into the ProjectTemplatesCache directory. You will have to search through this directory and find the .zip file which contains the junk files being added to your project Once you find the file, delete it, delete ProjectTemplatesCache, and then re-run InstallVSTemplates.
After manually searching for some of the custom profile templates(.vstemplate),I found them at the following location:
%userprofile%\AppData\Local\Microsoft\VisualStudio\10.0\Extensions
It appears VS2010 installs some of the templates as extesions or the authors made it that way.I hope this helps someone.
May need to run "devenv /setup" at the run command to refresh the VS2010 after you delete the templates.
For me it was a matter of removing it from here using VS2017:
%USERPROFILE%\AppData\Roaming\Microsoft\VisualStudio\15.0_45552a03\ProjectTemplatesCache
Delete the bad/unwanted project folders from
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplates
Clear cache
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplatesCache
Delete stuff from (perhaps not necessary)
C:\Users[Your User Name]\Documents\Visual Studio 2008\Templates\ProjectTemplates
and finally open Visual Studio 2008 Command Prompt as Administrator and run
devenv /installvstemplates
For me the issue got resolved when I deleted the cache.bin file from ItemTemplatesCache folder. Full path of this folder is:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplatesCache
Also make sure you delete the template files from below locations:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplatesCache
C:\Users\Default\Documents\Visual Studio 2010\Templates\ItemTemplates
C:\Users[NT-USERNAME]\Documents\Visual Studio 2010\Templates\ItemTemplates
For Visual Studio 2019:
Extensions > Manage extensions > Installed > Uninstall
Worke for VS 2012 and 2015 :
In Visual Studio: go to Tools > Extensions and Updates and then uninstall or disable the template.
worke in VS 2019 :
1- In VS2019, custom templates can be removed by deleting the template folder from %USERPROFILE%\AppData\Roaming\Microsoft\VisualStudio{VSVersion}\ProjectTemplatesCache. Look for a {VSVersion} that begins with "16".
https://i.stack.imgur.com/V6SQ5.png
2- Delete What You Want From Templates Folder in {C:\Users\USERName\Documents\Visual Studio 2019\My Exported Templates}
Notes :
{ProjectTemplatesCache} Or {ItemTemplatesCache}
https://i.stack.imgur.com/9BM9p.png
For Visual Studio Express 2010 you should delete all folders under
%USERPROFILE%\AppData\Local\Microsoft\VCSExpress\10.0\Extensions
For Visual Studio 2013 Community, you have to delete {program folder}\Common7\IDE\ItemTemplatesCache\cache.bin after deleting all the unwanted files as described above. Afterwards VS will rebuild the templates listing in the New Project... dialog.
You could also try this:
dotnet new --uninstall <PATH|NUGET_ID>
It works for me in VS 2019 and VS 2022 to uninstall the Avalonia templates.
Description
The dotnet new --uninstall command uninstalls a template package at the PATH or NUGET_ID provided. When the <PATH|NUGET_ID> value isn't specified, all currently installed template packages and their associated templates are displayed. When specifying NUGET_ID, don't include the version number.
Examples
Uninstall the Avalonia templates
dotnet new --uninstall Avalonia.Templates
From MicrosoftDocs
If the template was installed by double clicking a VSIX file, it is considered an extension and can be uninstalled using the technique described by Hamid Behnam above. Otherwise, it can be deleted from one of the template directories mentioned above.
It looks like in each case we use different recipe. Unfortunately, commands line and VS menu command listed in this thread did not work in my case, which is MS VS 2019 Community Edition on Win7 x64:
First, close VS, remove unwanted *.zip files from all following folders, as well as hidden cache.bin file from the last \ProjectTemplatesCache folder (it will be restored at VS startup), then restart VS. Here are those 3 folders:
{Documents}\Visual Studio 2019\My Exported Templates
{Documents}\Visual Studio 2019\Templates\ProjectTemplates
{User}\AppData\Roaming\Microsoft\VisualStudio{Number}\ProjectTemplatesCache

Resources