Make "Go to definition" navigate to the .NET reference source - visual-studio-2010

In Resharper, there's an option to navigate to sources from symbol files. If I enable downloading, the navigation works - I can step into the code of Console.Writeline and so forth.
However, I have already downloaded the entire reference source - is there a way to direct Resharper to that source, so it doesn't download unnecessarily?
I've configured the reference source according to the instructions on the site

It's not possible at the moment. Please vote/watch http://youtrack.jetbrains.net/issue/RSRP-126489

I was able to get this working with Visual Studio 2015 RTM and ReSharper v9.1.3 (and Visual Studio 2013). This is what I did...
NOTE: This is quirky. I'm not sure why, but sometimes the downloaded symbols have source code info in them and sometimes they don't. I had to repeatedly delete symbols from my cache and try to get the appropriate ones by attached the debugger to apps/websites and go to the Tools->Options->Debugging->Symbols and clicking Load All Symbols. I also did some source-stepping, and I had to copy the PDB files from my Symbol Cache into directories in the GAC and in C:\Program Files (x86)\Reference Assemblies. Finally, I went to the properties of the Visual Studio project and add F:\dd to the list of Reference Paths. I'm now able to right-click Navigate to Sources to most classes.
Short version:
You have to use http://referencesource.microsoft.com/symbols as your symbol server instead of the default Microsoft Symbol Server
The symbols expect to find the Reference Source files in F:\dd.
Delete all cached symbols so it pulls them fresh from the newly added symbol server.
Long version:
Configure Visual Studio according to the instructions found on the official .NET Reference Source site.
Go to Visual Studio's Tools->Options->Debugging->Symbols, stop using Microsoft Symbol Servers and use the Reference Source Symbol Server (http://referencesource.microsoft.com/symbols) instead.
Delete all of your cached symbols! The PDBs in your cache do not have any information about the source code files. Visual Studio may have locked some of them, so you may have to close it first.
Download the zipped up Reference Source file for the .NET Framework version you're working with.
.NET v4.5.1
.NET v4.5.2
.NET v4.6
Here's the tricky part. The zip file you downloaded contains a folder called Source. The symbol files will expect that folder to be F:\dd. You can open up one of the PDBs retrieved from the new symbol server you added to see what I mean:
If you have an F:\ drive, it's easy: extract the Source folder from the zip file to F:\ and rename it to dd and you're good to go.
If you don't have an F:\ drive, you create an F:\ partition or load a virtual disk. I used a mapped network drive by extracting the Source folder into the shared folder C:\Code.
Then I mapped a network drive to \\MYPC\Code:
I didn't want to rename the folder to dd, so I named it ReferenceSource and created a directory junction using Command Prompt (must run as Administrator):
cd C:\Code
mklink /j dd C:\Code\ReferenceSource
Voila. Now I have an F:\ drive mapped to C:\Code and a junction dd that points to C:\Code\ReferenceSource.

Related

How to update web-installed Microsoft Visual Studio 2017 offline (saved layout)?

I have Visual Studio 2017 which was installed from the web.
Meanwhile, the corporate firewall rules changed and it's no longer possible to update the installation (download.visualstudio.microsoft.com is blocked).
At home I was able to download a complete Visual Studio 2017 layout to an external drive.
Now, how can I instruct Visual Studio Installer to use the external drive layout instead of trying to download from the web?
After googling a bit, I found some clues here and there, but never got a direct answer. I had to do some experiments until I found a very simple solution:
Open folder C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances (or equivalent in your machine). This folder should contain a subfolder with the VS2017 instance GUID (from now on referred to as VS_GUID). Note: ProgramData is a hidden folder.
(Optional) Create a backup of file C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances\{VS_GUID}\state.json in another directory of your choice.
Edit file C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances\{VS_GUID}\state.json (note: VS_GUID is the sub-folder name found in step 1)
and change layoutPath to your local layout folder and installChannelUri to the full path to ChannelManifest.json (which should be present in the layout folder root).
Example (when layout path is D:\vs2017layout):
(...)
"layoutPath":"D:\\vs2017layout",
"installChannelUri":"D:\\vs2017layout\\ChannelManifest.json"
(...)
Save state.json and launch vs_professional_xxxxxxxxx.yyyyyyyy.exe (or equivalent) which is located in the layout folder. If it detects the updated installation files then the "download" progress should move to 100%.
This worked for me.

Visual Studio 2012 - cannot find vsvars32.bat to use gacutil to install extra tools

I am running Visual Studio 2012 (version 11.0.50727.1)
I have been trying to install https://jsonsource.codeplex.com/, a tool to allow JSON data to be imported using SSIS. To install this, once I have copied the dll's into the correct folder, I need to register them using gacutilexe. this is where my problem starts. I am supposed to run Gacutil.exe from the Visual Studio command line. This is supposed to be present in the Start Menu as VS2012 x86 Native Tools Command Prompt (it isn't), I am also supposed to be able to access it using vsvars32.bat (using the add external tools menu in Visual Studio, and supplying the location of vsvars32.bat as an argument). However, I cannot find vsvars32.bat anywhere within my C drive.
I have found several versions of GacUtil.exe in various subfolders of C:\program files(x86)\Microsoft SDKs\Windows, although the installation guide lead me to believe it should be in C:\Program Files\Microsoft SQL Server\120\DTS\PipelineComponents, i.e. where I copied the dll's for the tool I am installing. I'm not sure which of these (if any) I should be using once I get to the visual studio command prompt. Could do with advice here as well.
vsvars32 is meant to be somewhere within C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools, but it is definitely not present any where within the Visual Studio folder.. There are also folders for Visual Studio 9 and 10, but these do not contain vsvar32 anywhere within them either.
if anyone could help I would be very much indebted - My options as to how to deal with the JSON source files otherwise are extremely limited. (using Management Studio 2012 rather than 2016, so can't use OPENJSON. If anyone can suggest any alternatives, let me know. This includes just any option to get the entire JSON file file into a cell - I could probably build some kind of extensive string manipulation to script to split it all out once I've got them in there, although this seems like entirely the wrong way to go about things...)
The first time you install the 3rd party package in Nuget Package manager, it will automatically download the .dll to your user temp folder, once you close it, it will gone, but it will register for you. If you need to find where the exactly location is, simply double click that new added .dll in solution window, if you try to reinstall, but it does not allow you to do that, delete the package.config file, and try to reinstall that package. Once that is added again, do not forget to double click that .dll, to see where is reside, move to your own folder, register using gacutil -i command, and should be good.

Index sources files into a standalone source server without TFS 2010

I have a solution, which is built using Visual Studio 2010 from a command line. After build, a symstore from Debugging Tools for Windows is invoked to post PDBs and binaries to the network folder, which is then used as a symbol store.
I understand there also is a Source Server, which I could use together with Symbol Store to keep the source files. How do I have the source files added to that symbol store? I see there is a srcsrv directory in Debugging Tools, but I cannot find a way to create a source server system outside existing source control system using those tools
Typically you do not add the source files to the symbol store, instead you reference them in your source control systemm, and use Windows Source Server to pull them down as needed (just like it does with the symbols).
You must run a script on the source files to add info to the pdbs, this info contains which version of the files were used and is than used later when you debug to get them.

TFS and local folder permission problem

Environment: VS 2010, Windows 7, TFS
I have a solution1 with solution filder called Binaries(which is a physical path on local
computer, say it's c:\Binaries): I put all external assesmblies in this folder.
In another solution2, for each class library project in this solution, set property->build->Output path to c:\Binaries, so that the latest version of these assemblies can be referenced by any project in solution1
It's working fine.
Now I put solution1 and solution2 to TFS and all of them are under TFS source control, include Binaries folder.
Now I open solution 2 again and build the solution2, it give me permission error for each class library project like:
Error 49 Unable to copy file "obj\Debug\mycomponent.dll" to "....\Binaries\mycomponent.dll". Access to the path '....\Binaries\mycomponent.dll' is denied.
But if I check the permission in windows 7 on c:\Binaries, no problem.
So it should be something wrong with VS 2010 or TFS.
How to fix this problem?
Though I'm not a big advocate of binaries in your source control, there's a workaround for this.
When you get your source, you will need to specifically check out the binaries (to enable write access).
HOWEVER! If you have multiple developers working, this will (by default) put an exclusive lock on the binary files. And they will not be able to check out the files for edit.
The solution for this is in Visual Studio 2010. Go to
Team->Team Project Collection Settings->Source Control File Types and find "Executable Files" on the list. Change File Merging to Enabled and you'll be able to have shared locks on the file.
The other option is to either not "get" your binaries folder, or, if you do get it, "unget" it using
tf get "$/blah/project/Binaries" /server:servername /version:C1 /overwrite /force
You'll need to supply the itempsec and servername. This will get the first version of the binaries, which doesn't exist, so it will wind up deleting them locally and marking them as not gotten (or checked out).

Unable to load referenced library

I get this error in Visual Studio 2008 when developing a ASP.NET Web Application Project.
Unable to load referenced library
'Path-to-DotNetNuke\bin\file.dll': The
process cannot access the file because
it is being used by another process.
This is a DotNetNuke project with multiple modules. IIS loads all assemblies from /bin folder under the application root.
The projects in the solution are in their respective /DesktopModules/ProjectName folders and compile to a bin folder under the project.
The error occurs after I compile the solution and copy all the projects' dlls to the /bin with a script. Visual Studio does not let me recompile, but if I restart it, everything works ok. This is really annoying when recompiling and testing the whole solution. You have to restart Visual Studio between every recompile.
I couldn't find any file locks with Process Explorer when Visual Studio shows this error.
[UPDATE] There is an old MSDN document that tells you not to build all DLLs to a single folder if you reference any over 64KB DLL there. Particulartly, the document says:
It causes the build process to fail
with file lock errors when a
referenced assembly exceeds 64 KB in
size.
We do have references to over 64KB DLLs in /bin folder and copying recompiled DLLs there seems to trigger this, at least with VB IDE's background compiler.
The error occurs after I compile the solution and copy all the projects' dlls to the /bin with a script. Visual Studio does not let me recompile, but if I restart it, everything works ok.
I would suggest setting the output directory of each of your projects to be the bin directory of the DotNetNuke website. This will help you to avoid the manual step of copying files altogether.
To set the output directory of your project: Right click on your project in Solution Explorer and select properties. Select the build tab, select All Configurations (at the top) and set Output Path to "..\..\bin" (near the bottom). This assumes your project file is in it's typical spot within the module's home directory (e.g. DesktopModules/YourModule/YourProject.csproj) otherwise you can navigate to your web site's bin directory with the adjacent browse button.

Resources