Where are the .net core dlls stored on my computer? - asp.net-core

I cannot find the dlls. Visual Studio does not tell you where they are stored. I want to load them into .net Reflector.

I know this is an old question, but if you're looking for these then check out the following location...
C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App
Under there should be versions of .NET Core, and these are the runtime assemblies you'll need to load in Refelctor to see the source code.
Note - if you use an assembly reference from within Visual Studio (by maybe clicking F12 on a .NET Core datatype or interface), that will show the reference assembly and not the implementation assembly.
As an example, hitting F12 on ControllerBase gives me this...
C:\Program Files\dotnet\packs\Microsoft.AspNetCore.App.Ref\3.1.0\ref\netcoreapp3.1\
Microsoft.AspNetCore.Mvc.Core.dll
This is not the runtime assembly you need when using Reflector. GitHub is all fair and good for finding source code to one method, but you can't beat Reflector when you want to move between different classes in different files so as to work through an implementation pathway.
Hope this helps!

You can set them up I properties. They are still in the bin folder once the code is compiled. Although if you are planning on using the dll directly you can publish then first

Related

Add DLL in LinqPad 6

I'm using LINQPad 6 and I can't figure out how to add System.DirectoryServices.AccountManagement DLL. I see where I can pick from NuGet stuff, but not standard windows DLL. Previous versions used to list all the DLL and let me pick directly from there. Is that gone?
I don't think System.DirectoryServices.AccountManagement is part of the standard netcore library, but is available as a Nuget package.
If it was part of the standard library, then you would not need to add the dll, but just reference it.
There's no longer an option to add Framework assembly references. In keeping with Visual
Studio, all .NET Core Framework assemblies are referenced automatically.
From the Things that behave differently in LINQPad 6 section of https://www.linqpad.net/LINQPad6.aspx

Getting nunit framework not found error when adding a controller

Please bear with me on this, since I am a Java developer just dipping a toe into the ASP.Net world
I started coding in an existing C# VS2012 codebase. It uses nuget and Newtonsoft is mentioned in the packages.config
When I right-click on Controllers > Add a new controller, I get the following error.
Could not load file or assembly 'nunit.framework, Version=2.2.4.0, Culture=neutral, PublicKeyToken=...' or one of its dependencies.
The system cannot find the file specified.
Now looking around in Google, it seems the GAC is missing an NUnit assembly. Not sure what I should do about that. Should I get NUnit? Why is it looking for a certain version of nunit (& that too a very old one)?
Any help for me to resolve this problem will be highly appreciated!
When you click "Add new Controller' Visual Studio will try to complete the parse/build to populate a number of values in the window that it is supposed to show you (with the available Models and available Views). It looks like at least one of your projects is missing a dependency (probably your Unit Test project).
NUnit 2.2.4.0 is indeed a pretty old version, it doesn't even exist on NuGet yet (which would have been an easy fix). It makes sense that NUnit is not installed in the GAC, since you normally don't put everything in the GAC just because it seems to be possible. If you're willing to upgrade to the latest NUnit version, the easiest way is to add the NUnit NuGet package to your project through the Package Manager.
I would assume that when you'd open the project file for the project that is generating this warning in Notepad, you'd see a <hintpath> tag as a sibling of the NUnit Reference (it may not be there) which points to the folder where it is telling Visual Studio to look for NUnit.
I suggest you install the NUnit version your project is looking for from here and then update the reference in your project to point to the correct location. That should fix the issue.
As for your remark on the specific version, .NET Assemblies are compiled with a specific version number (usually set in the AssemblyInfo.cs) a reference in a project file can be to a specific version or to any assembly with that name (highlight the reference in the Solution Explorer and check the properties window (ctrl+w,p or alt+enter). You'll see a property "Specific Version" which in your case is set to "true" which caused Visual Studio to store the assembly version in the project file.
Add the code files into a workable solution project.
It is workable for me.
Or, try to create a new Nunit test project with the codes
I also try the following method, but not working for me
Install Nunit, adapter, SDK from the Nuget package
Clean-Rebuild

Visual Studio won't find references

I'm working with some application handed over by another person in which I must document the requirements, build and deploy processes.
The problem here is that Visual Studio (2005) is throwing a lot of errors since it can't find the references for the dlls.
This obviously won't let VS build the project.
Everything works fine on the persons computer but not on mine, even though the project references the same folder where the dlls are, the bin folder.
How can I circumvent these problems and get VS to properly reference the dlls?
The following printscreen shows the references screen for the project.
My guess is that your DLL uses a more recent .NET framework than your application does.
Check the properties for your DLL source (right-click on the DLL code in the solution explorer and choose Properties). Go to Application - Target .NET framework and compare the version to the one the application itself uses (right-click on the project code). Note: under your application properties check both the settings under Application - Target .NET framework AND under Publish - Prerequisites.
For what it's worth, even after changing the .vbproj file and removing many lines about hard coded values,
I eventually checked out the project again removed all references to the given DLL and then added it using the GUI.
Lesson learned, don't try to change out one DLL for a newer version without using VB2005 GUI.
The easiest solution will probably be to transfer everything to another project. It will be incredibly time consuming to find where visual studio has left the hard coded path at.
WOOT!!!! Compile the DLL file to a lower version of the .NET framework, and it will fix the problem!!!!
The paths in the project file cannot be the same or the assemblies referenced have a different version.
It might be worth unloading your project and the editing it to inspect where it's looking and for what version.
I had the same problem with an older Visual Studio Project that I opened in Visual Studio 2008. I tried to add new references to the project and got permanent errors that the dll's cannot be found. After the migration of the Project to Visual Studio 2010 I got the following error message when I tried to add a new reference:
'mySample.dll' or one of its dependencies, requires a later version of the .NET Framework than the one specified in the project. You can change ...
After changing the projects .NET Framework to a newer version everything works fine.
Good suggestions in other answers. In my case, it was because the libraries weren't copied (downloaded) successfully: the files existed, but were 0 kB.
Did a clean, which removed all the DLL's and then VS2008 complained it couldn't find the references (Duh!!!) and wouldn't rebuild....luckily I had and old version of the dll's and replaced them in the directory AND THEN did a rebuild to replace them...all references are now OK and we're back to normal....good old VS 2008

Where are the symbols for ASP.NET MVC 4.0 RTM?

I'm trying to configure Visual Studio 2012 to allow me to step into ASP.NET MVC 4.0 source code. (System.Web.Mvc.dll). I've followed SymbolSource's recommended configuration but when I try to load the symbols, Visual Studio can't locate them.
Recommended configuration
To configure Visual Studio for symbol/server
use, follow these instructions:
Go to Tools -> Options -> Debugger -> General.
Uncheck “Enable Just My Code (Managed only)”.
Uncheck “Enable .NET Framework source stepping”.
Yes, it is misleading, but if you don't, then Visual Studio will
ignore your custom server order (see further on).
Check “Enable source
server support”.
Uncheck “Require source files to exactly match the
original version”
Go to Tools -> Options -> Debugger -> Symbols.
Select a folder for the local symbol/source cache.
Add symbol servers
under “Symbol file (.pdb) locations”. Pay attention to the correct
order, because some servers may contain symbols for the same binaries:
with or without sources. We recommend the following setup:
http://referencesource.microsoft.com/symbols
http://srv.symbolsource.org/pdb/Public or the authenticated variant
(see above)
http://srv.symbolsource.org/pdb/MyGet or the authenticated
variant (see above) (other symbol servers with sources)
http://msdl.microsoft.com/download/symbols (other symbol servers
without sources)
I am aware that the source code is available on CodePlex, however I'm specifically interested in stepping into the code using a symbol server instead of having to unreference Mvc from the GAC and reference a locally built assembly.
Has anyone had success doing this with MVC 4.0?
Just add a symbol server that serves more then just major releases.
Try this one, contains most minor builds.
http://srv.symbolsource.org/pdb/Public
Verify:
Run VS as administrator.
Check that something have been downloaded to your symbol cache directory.
Goto select only specified modules.
Add "System.Web.Mvc.dll"
Set a break point in your code. Start debug.
When break point hits rightclick in callstack on any mvc.dll row. Verify that symbols are loaded.
if loaded, try dubbleclick on one callstack row to open mvc source.
Get back with where you get in trouble.
I will make some refinements to Luke Gumbley's anwser.
Microsoft tries to make a developer's life easier. Whenever it release an MVC version installer, there should also be a Source to download. So people can use the source to explore what is installed by the Installer, as well as to debug the MVC.
Back to the way of downloading the MVC debug info. Your Visual Studio (I use 2010) will never try to download MVC PDB files from the aforementioned servers if you have MVC4 installed on your system. In this case, your Visual Studio will use the MVC from your GAC when you run debugger.
I have tried the way suggested by Luke Gumbley. However, once you uninstall MVC, your MVC project will not be loaded, and you cannot create a new MVC project since the Template is gone. So please don't unistall MVC. If you do so, you still need to reinstall it. This wastes time.
What you really need to do is exit your Visual Studio, run command
gacutil /u System.Web.Mvc
Then go to C:\Windows\Microsoft.NET\assembly\GAC_MSIL, remove or rename the offending System.Web.Mvc folder. After this, lanuch your Visual Studio, and fetch the MVC package from NuGet.
I can't answer on your question directly and provide you URL with symbols (.pdb) for System.Web.Mvc.dll for ASP.NET MVC 4.0, but probably I can help you to solve the problem in another way.
As well known (see here for example) Microsoft provide the current source code of .NET on http://aspnetwebstack.codeplex.com/. In the post it's described how to use the Nightly version of ASP.NET (the current developer state of the code). If you didn't used Git before you can have problems with downloading RTM version of ASP.NET 4.5 (with ASP.NET MVC 4.0) which you could prefer to use instead of Nightly version. Nevertheless the downloading of the full source code of RTM version is easy enough. You need just to know that Git allows to save copy of the code in branches or tagged versions. In the way you can get access (and download it) to some previous versions of the full code. The link for example provide you jQuery 1.8.2 instead of another link get you the latest developer version which can be unstable. So to download the source code of RTM version you just need to choose "v2-rtm" branch and then click on "Download":
You can use the link to select "v2-rtm" branch directly.
I can repeat that it's not exactly what you asked and I know that compiling of ASP.NET source code could be also a little tricky, but I decided do write the information. If somebody would suggest you the better solution it would be interesting for me too.
I had exactly the same issue (correct version but no symbols), but after a day or so of trying everything I've been able to get it working. These are catch-all instructions that worked for me, they may contain unnecessary steps:
Sign up for SymbolSource and follow the VS instructions using the
authenticated URL form
Uninstall all versions of MVC with add/remove programs
Remove MVC assembly from the GAC (the question is about modifying
MVC but the GAC answer is good)
Remove and then reinstall the MVC 4 reference to your project with
NuGet
Start debugging, open the modules window, and cross your fingers
that ‘Symbols loaded’ is next to System.Web.MVC when it appears.
(sprinkle in restarts as you see fit, for me the key final step was reinstalling the NuGet reference)
My theory is that as the GAC library is used at runtime in preference to the local reference, the symbols are not found when they are searched for. By removing MVC from the GAC and then reinstalling the NuGet reference, it seems the local reference is used and the symbols are found. It's counterintuitive as the System.Web.MVC.dll files are binary-equivalent between NuGet and the GAC, although they are dated differently.
I'm not totally convinced though as I tried to do the same thing for Razor and that didn't work.
Let me start with that ReSharper provides a handy dialog to step in the code at any time:
So you get the following code screen if you drill to the source code:
But I became curious to accomplish this by hand. I started with proper pdb configuration:
After that I got the following error:
Next I copied the C:\Users\Andrew\AppData\Local\Temp\SymbolCache\MicrosoftPublicSymbols\System.Web.pdb\CA49C4332DE847FA967F58AFF370B70E1\System.Web.pdb to C:\Users\Andrew\AppData\Local\Temp\SymbolCache\System.Web.pdb (to match the lookup path). After that i encountered this:
And it turned out that the mismatching builds are only good for browsing the source, not debugging. (Current machine has VS2012 RC, hence MVC libraries are not RTM). If they match, you'll the the source.
I still don't know why doesn't the lookup path adjust to symbol configuration. Hope this helps.
I just solved this same problem.
The problem is that the dll stored in the GAC does not correspond exactly to the published pdbs on symbolsource.org. The one on symbolsource corresponds apparently to the latest version available through Nuget, and the one in the GAC must the one installed with .NET Framework 4.5. (.Net uses whatever is on the GAC before attemting to use anything local to your proyect, you can see this, when debuggin, go the Debug->Windows->Modules, there the System.Web.Mvc.dll is the one from GAC according to its path)
What I did was to include in the GAC the System.Web.Mvc.dll on the package folder of my solution, the one downloaded through Nuget. This you can do by using gacutil on a VS Command Prompt (run the VS Cmd as admin).
You can check on the same Modules Windows, right clicking on the System.Web.Mvc.dll, and then on Symbol Load Information. With the "old" GAC dll you get a message like (part of it)
SYMSRV: http://srv.symbolsource.org/pdb/Public/System.Web.Mvc.pdb/1E540B87149F4031B9CDEACAD8D771231/System.Web.Mvc.pdb not found
Notice here the subfolder 1E540B87149F4031B9CDEACAD8D771231 (yours might be different)
After replacing the GAC dll for the one recently downloaded through Nuget, the message is
SYMSRV: System.Web.Mvc.pdb from http://srv.symbolsource.org/pdb/Public: 336067 bytes
http://srv.symbolsource.org/pdb/Public: Symbols downloaded from symbol server.
C:\Users\\AppData\Local\Temp\SymbolCache\System.Web.Mvc.pdb\68B2330E48624B6C9DE05BED1C8C320F1\System.Web.Mvc.pdb: Symbols loaded.
Notice the subfolder 68B2330E48624B6C9DE05BED1C8C320F1, which is the one that is searched for in symbolsource.org is the correctly found.
Hope this helps
There's some related info here: http://aspnetwebstack.codeplex.com/discussions/399312
And here: Debug into nightly build of ASP.NET MVC4 using Symbolserver

Serialized Assembly Won't Upload to Database

I have a CLR project that calls a simple HTTP web service. Its x64-targeted and I got it to serialize properly only after going through the steps outlined at the following link which talks about the changes required to have VS2010 point to the correct target architecture (x64) - the changes just required unloading and changing the .csproj file with a few extra lines to reference the correct version of sgen.exe: http://geekswithblogs.net/akraus1/archive/2011/12/10/148002.aspx
Now, I am able to build this project and its .XmlSerializers.dll by setting "Generate serialized assembly" to on. I wanna do this because my CLR project is going to get deployed on the database, and I don't want it to runtime serialize any objects since those DLLs are not referenced in my database and I don't want to give my CLR project permissions higher than EXTERNAL_ACCESS for security reasons because this will be used in a production environment where security is important, and also because my database is NOT trustworthy.
Long story short, I am following the guide at the following link to upload my serialized assembly into the database but I get an error: http://footheory.com/blogs/bennie/archive/2006/12/07/invoking-a-web-service-from-a-sqlclr-stored-procedure.aspx
The error is: CREATE ASSEMBLY for assembly '.XmlSerializers' failed because the assembly is built for an unsupported version of the Common Language Runtime.
Does anyone know how to correct this by forcing sgen.exe to serialize a CLR-supported version of the assembly? Viva the Stack.
SQL Server 2005/2008/2008R2 supports only .Net 2.0. You need to change your project to target this, see How to: Target a Specific .NET Framework Version or Profile. You do not need to specify x64 for the build target, SQLCLR assemblies should be Common target built.
That said, calling web services from SQLCLR is a really really really bad idea. Don't do it. Have an external process handle the HTTP calls.
I found that the problem was actually not the fact that I'm using .NET 3.5 as a target, but I was referencing the wrong version of the sgen.exe tool, which in this case I needed the x64 version of 6.0A (which translates to .NET 3.5) at this path: C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\x64\sgen.exe. Now I am able to build the correct version of the serialization assembly, upload it, and also use it.