Safely move Microsoft SDKs folder - visual-studio

I have a folder on my hard drive, C:\Program Files\Microsoft SDKs, and I was wondering if it is safe to move it to an external drive. Does Visual Studio or any other tool depend on this particular folder?

There are quite a number of entries in the registry (at least in my registry) that point to that location, so it seems something would work in a less than optimal fashion. At a minimum, it would make the uninstaller a bit confused. It is probably safe to simply rename the directory temporarily and try your builds to see if they still work. Ultimately, though, it seems it would be cleanest to run the installation again to actually remove it and then install to a new location.

Yes. Most Unmanaged code in VSStudio refer to certain include files present in the include folder.
Also some exes in bin folder are also referred to (especially VS2008).
VS2005 refers to an internal Platform SDK location.
VS2008 refers to C:\Program Files\Microsoft SDKs\Windows\v6.0A
However most projects refer to this location via a macro. So if you can find a way to update the macro with the new location, then you should be fine.

Doing this may break some of your applications. If you added a reference to a project by browsing to a DLL installed in this folder, that project will not compile after you move this folder. If you haven't added any references in this manner, you might be OK.

Related

Can I safely delete files created by Visual Studio from external drive?

When I installed Visual Studio, it also placed hundreds of files on my external hard drive. And now the folder structure is full of "junk" that I don't want.
Is it safe to delete these files? Will deleting these files affect my Visual Studio installation (which is on a different disk) at all? Why does VS do this anyway? Why does it place all this crap on a drive I never even gave it permission to put it on in the first place?
You can safely delete any of those files, since, quoting Microsoft KB,
These temporary files are erroneously generated by the installer into the root directory of one of your drives, instead of the temp directory
Those are temporary files indeed and they, still quoting Microsoft,
are generated on the root directory of a drive that has the largest available space in the system
Check Microsoft knowledgebase pages like this for more detail.
What about archiving those files, opening visual studio and check it is still working?
If it doesn't just put the files back where they were...
You should be safe deleting those files. Someone already asked this question. :D
Visual Studio 9.0 Beta Program files in C:\
hope I was helpfull
Jasper.
Cause
These temporary files are erroneously generated by the installer into the root directory of one of your drives, instead of the temp directory.
Resolution
These files are unnecessary and can be safely deleted from the system. The functioning of the runtime library will not be affected by this.
Its a known bug and is fixed in VS2008 SP1.
Ref: https://support.microsoft.com/en-us/kb/950683

How do I Set an Executable's Search Path?

I'm not using the default Visual Studio project path to build my program into, because I want to emulate a release, and write tools to search for resources. After tinkering with the settings, I've got VS to output to the right folder, and to copy the DLLs to a bin folder in the main folder. However, I can't get the .EXE it generates to find the DLLs, it will only find what's in it's directory, but I don't want to be messy like that. The debugger works fine, but it won't work standalone. How do I tell VS to tell the .EXE where to find it's DLLs? Do I have to edit the PATH? That seems messy, as I've never had good experiences with it. I've tried Project Settings -> VC++ Directories, but it still won't find it, as I'm assuming that that's for .LIB files.
Here is a diagram of my folder hierarchy.
-root
--bin
---[Required DLLs]
--data
---[Program Resources (images, sounds, configs, etc.)]
--Program.exe
Using Visual C++ 2010 Express Edition.
How do I tell VS to tell the .EXE where to find it's DLLs?
Edit the Release Run Configuration and change the working directory where your dlls reside.
You will still have to run your exe through the ide for this to work.
Do I have to edit the PATH?
No
This doesn't have anything to do with Visual Studio. It is Windows that can't find the DLL. It has no reason to look in an arbitrary subdirectory for a DLL. It isn't otherwise clear whether these are implicitly loaded DLLs or if you use LoadLibrary to load them yourself.
You don't have much of a problem if you use LoadLibrary(), just pass the full path name of the DLL. GetModuleFileName(NULL, ...) helps you build the path string. You'll have a Big Problem if these are implicitly loaded. In that case, there should be preciously few reasons to not store the DLLs in the same directory as the EXE. And yes, you don't want to mess with the PATH environment variable. Or the current working directory.

Adding 3rd party libraries to Visual Studio source control

This is a problem that has been eating at me for a while, and I just haven't found a good solution (no pun intended) for it.
I'm using Visual Studio 2010 with Subversion and Ankhsvn. It works very well, however, my biggest problem with it is that it only retrieves and manages files that are "included in the project". This is great in many situations, but kind of sucks when you want a folder with objects that you want to include in the solution, but do not want to have in the project itself (in this case a web project).
In this case, I want to include some 3rd party DLL's into source control (so they can be kept up to date when syncronizing with version control). I don't want the developers to have to install the 3rd party dll's seperately. What normally happens is that you reference the DLL's from some other location and they get copied into your bin folder at compile time.
I do not wish to include them in the project because i don't wan them copied to the web server when I publish the site (other than via the bin directory where they should be). I thought of creating a seperate project for these, but that would create a useless dll with no purpose that would then get copied to the bin folder because it's referenced.
I've also tried to check them in from the bin folder, but this has caused a number of problems where files did not syncronize prolerly, with subversion saying things about an already version folder being present etc.. This seems to be a subversion or ankhsvn problem rather than a visual studio one. As such, i try to keep the bin folder untouched by version control.
How have you solved this problem in your projects?
This is how we do it in our project.
We have a SourceCode folder which has the subfolders for the projects which contain the code.
Additionally this has a folder called Library which has the correct version of any 3rd party dll's that we use. This folder in in version control and hence everyone always has the correct version of the 3rd party dll's
All references in the projects to 3rd party dll's are relative from this Library folder.
Since everyone has the SourceCode folder on their machine, it works fine with no issues.
EDIT:
Added image of Solution Folder with library contents to it

Adding a Visual Studio reference to a product under source control

As an example, I'm trying to add a reference to WatiN in Visual Studio 2008. I download WatiN and I have a folder on my desktop containing 5 files:
WatiN.Core.dll
WatiN.Core.xml
Interop.SHDocVw.dll
Microsoft.mshtml.dll
WatiN.Core.UnitTests.dll
WatiN.Core.UnitTests.dll.config
I can add my reference to WatiN.Core.dll and start coding in Visual Studio. But I have some questions:
Can I now delete the folder on my desktop? Were the files copied to the project bin?
What happens when I check my project into source code and another developer checks it out? Does he/she have to have the same folder on their desktop.
My thought was to create a lib folder in the project and reference the files in the lib folder. This folder will get added to source control so that everything should work for the next developer. But I have some questions about this solution:
Do I need all 6 of those files?
I believe the .config files have something to do with intellisense, but the project will build and run without them right?
How do I know what files to include apart from the WatiN.Core.dll. The project builds and runs with only WatiN.Core.dll and Interop.SHDocVw.dll. How am I meant to know what the dependencies are?
Any insight is much appreciated.
Adding a reference does just that. It adds a reference, so if the reference is to your desktop folder other developers will not be able to see the files. Also, if you delete the files you will have dangling references in your project. In general, don't reference files on your desktop.
Making a lib folder in the same source control tree as the project as you have suggested is a much better solution. Visual Studio will store the references as relative paths enabling other developers to compile the project.
You will have to study the documentation for the WatiN library to know which files are required by your application. You should not delete the .config file as it is not related to intellisense.
I would create a developement tree with all source files, library files, tools, docs, resources so that any developer can get a working project straight from source control without having to search for references.
Having referenced DLLs in a lib folder means that projectA is able to use version 1.0 of the DLL and projectB is able to user version 2.0 of the DLL.
When the solution builds it will get the DLLs from where they are referenced. If it cant find them the project wont build.
Have a look at the following articles.
http://www.codeplex.com/treesurgeon
As for which dlls you need to reference, you can go the way of only referencing what you need.
WATiN needs the WATiN.Core.dll and the Interop.SHDocVw.dll in order to run. As others have suggested, it's best to have a lib folder in your source control tree for external libraries so everyone can use relative references.
TreeSurgeon, mentioned above, is a good tool or you can at least use their folder structure as a model.
The Watin.Core.xml file should give you intellisense if you put it in the bin with the dll.
I believe you can only delete the folder if you are referencing the file directly from the bin folder (cut and pasted it there). If you are referencing the file from the folder than I believe you need to keep it there.
You may run into problems deleting the other files if the dll your referencing, references the classes in the other dll's.

Visual studio relative reference path

I usually format my project directory like J-P Boodhoo. a main dir containing solution file, then a lib folder for all third-party lib, a src dir, a tools lib for third-party that wont be deployed.... For more info look here
I set in my project the reference path for all the needed folder, but if a developper checkout the trunk, he have to set all the reference path. Is there a way to simplify this ?
And am I using Visual Studio 2008.
Thank you.
I'm not sure which Visual Studio language you use, but if it's C++, then then file paths are stored in the .vcproj project file which should also be under version control. (NOTE: the .sln solution file does NOT store path settings) If you are careful to use relative, rather than absolute paths, it should be easily sharable among multiple developers.
In Visual C++ 2008, project files are XML so you can edit them directly. If you want to get really fancy, you can use .vsprops property sheets for additional control.
I use a shared folder on the network for stuff like that. And give that folder full trust. on the PDC i just have a login script that maps approriately. Its might not be the best way, but its worked for me without any issues.
Another solution I have used in the past is a common folder on each machine where all dependancies go, and have it syncronize with some sort of tool. I use Backup Exec which comes with Desktop and Laptop option which has a syncing feature, but other things work as well.

Resources