Embed *.pdb files in managed library with Visual Studio 2022 17.1 - nuget-package

The 17.1 update for Visual Studio 2022 recently hit and one of the added functionalities is:
When building managed libraries developers can choose to embed their source files with the debug information (PDB file) that is produced by the build, and even embed the PDB file into the assembly itself. We now surface embedded source as part of Go to Definition if a referenced assembly has embedded source and the PDB is available. This allows you to navigate to the original source files that declare the target symbol. Place your cursor on a symbol and press F12 to navigate to the original source file.
However I can't find anything on how to do that.
Does anyone know?
In addition, if I want to publish a package to NuGet and make it so anyone who adds that package to their solution can debug my package's code, do I only need to embed the PDBs or is something more required?

Turns out it's an option found in project properties:

Related

Opened project in android studio and all packages/symbols are marked as incorrect

I am trying to contribute to my first open source project but after forking and cloning from the repo, all files are marked as an error.
Sample error
This is after selecting a source folder.
Current project source
Under package it says: package name does not correspond to filepath
... but I have this
misnamed packages?
Android studio isn't picking up those libraries.
IME there are 2 ways of importing these (I have only had success with the first):
1) copy the source parallel to your own (ie example.com)
2a) include the jar in a libs folder and tell AS to look out for it. (right click will typically provide a good option that I can't recall)
2b) because Android can struggle (ie I couldn't do it, though inroads may have been made since) with importing jars, you may need to use AAR's (android library packages, Android Archive Library (aar) vs standard jar)
However, because this is an open source project, this should all be handled auto-magically for you via the gradle scripts included in the distro.

What's the best way to debug a nuget package with its souce code?

I'm using a NuGet package in my project and sometimes I need to debug into the source code.
The NuGet package itself is open sourced on github.com so its source code can be downloaded as well. I can build and generate .dlls on my local computer.
But during my debugging, I can see the function names of the package, and even the file path of the source code (or course it's from someone else's computer), but it's grayed out and I can not double click to go into the source code. I checked the right-click menu, there's no way to load symbols there.
In this case, how can I let visual studio load the debug symbols so I can debug into the package's source code?
My understanding is that you install the specific package in your project, if you want to debug the package in your project, you could add the source file to the solutions Common Properties -> Debug Source Files list.
If you download the source code of the package and open/compile it in your VS, I think you could refer them manually to your previous project, and then debug it directly like add breakpoint or others as general class library project.
Reference:
How to debug using Nuget source code
How to debug into my nuget package deployed from TeamCity?

How to attach library source to JetBrains Rider

How can I attach the library source, such as MySql.Data.dll (source code file:mysql-connector-net-6.9.9-src.zip), to the IDE?
When I Ctrl + Click the library class, it decompiles the dll file automatically, but I want to attach the source code to it.
This is not possible. Rider will always either decompile sources or download sources from a symbol server.

Getting others to use my apps with Visual C++

I am learning how to build games in Visual C++ and when I upload them so friends can check them out, they all end up with messages saying it can not run. I did some research and found that it is because I am compiling against a Dynamic library instead of a static library. Correct me if I am wrong anywhere please. Upon further research, I found that a lot of people do not advise going this direction but instead include the files needed by my game.
How would I go about distributing my games to friends and make it real easy for them to just open up my .exe and play the game?
If you link to any DLLs, you also need to ship those along. If you produce a single .exe in your output, you probably need your friends to install the MS Visual Studio redistributable package for your version of visual studio. This is an example link for the VS 2010 one, but the one you give your friends should match your version.
There are essentially two options: Keep everything as-is and provide them with the runtime files (also named Microsoft Visual C++ * Redistributable Package or similar; the * has to be replaced with your version, e.g. 2005, 2008 or 2010). Downloads can be found on Microsoft's download site as well as in your Visual Studio installation folder (look for a folder called "Redist").
Alternative solution: In your project settings you're able to select the runtime environment (under linker options). Change your release build to use "Multithreaded" instead of "Multithreaded-DLL".

Stanford Engineering Everywhere CS106B Library

I am currently a C# programmer and have been interested in learning more about C++ and data structures. I found the CS106B class offered free online through the Stanford Engineering Everywhere program which seems like it would be a good fit.
I've tried to install the library files they use for the class and keep getting a message that I have to have visual studio 2005 installed for the setup file to run. I don't have 2005, but I've tried the express editions of both vc++ 2008 and vc++2005. Is there any way around this that I can get the proper files installed?
The zip file containing the libraries came with two files, an exe and an msi.
Just got it to work by using some information I found here: http://www.functionx.com/visualc/libraries/staticlib.htm
I'm using Visual C++ 2008 Express. Here's how I did it:
Download the PC Starter Code ZIP file for Assignment 1 from the
current semester's CS106B class website.
http://www.stanford.edu/class/cs106b/ In that file you'll find a
folder named "StanfordCPPLib". In that folder, you'll need the
StanfordCPPLib.lib and the *.h files you want to include.
In Visual Studio, create a new project (File -> New -> Project). Select a Win32
Console Application, choose a name, and click Next.
When the Application Wizard pops up, click Next (not Finish). In the
Application Settings, check the box marked "Empty Project". Click
Finish.
In the Solution Explorer, right click on the Source folder and
create a new .cpp file. (Add -> New Item -> Code -> C++ File)
Find your new project's folder in Windows Explorer. In that folder,
you should be able to find your new .cpp file you just created.
Paste the StanfordCPPLib.lib and your needed *.h files you
downloaded earlier into the same folder that contains your new .cpp file.
Finally, you need to add the library to our new project. In Visual Studio, using
the main menu, click Project -> Add Existing Item. The dialog should
default to your project's folder where you just pasted
StanfordCPPLib.lib. Select StanfordCPPLib.lib and click Add.
You should now be able to add an #include "example.h" for whatever .h files you copied into your project folder.
Note: Since you'll be using a newer version of Stanford's custom library, there may be some small differences between the original handouts and the new library. For instance, when using #include "simpio.h", the handouts list a function called GetLine(). In the new library, that function is capitalized differently: getLine(). Make sure you check the header files for correct syntax/usage.
Thanks to Dani, with his help, I succeed in installing the library on vs2008(both express and professinal are OK) on win7. With Dani's help,
I have finished the first three assignments in cs106X(winter2010) - life, ADT, boggle - so far.
I'm just a undergraduate in China, thanks so much to the great education of stanford and power of internet.
http://abloggingattempt.blogspot.com/2010/05/stanford-cs106-lib-and-vs2008-express.html
the following are copied mainly from Dani's blog.
Stanford CS106 Lib and VS2008 Express
The CS106B is a great CS Stanford course available online (iTunes e.g.) in video and for free. All assignments and the course itself use an in-house developed library (not sure if it has a name, cslib, cs106 lib, dunno) available in all of the assignment zips as well as installable with the Xcode/VS2005 wizard installs. The problem - the VS custom wizard will install on VS2005 only (could be that a newer version exists but I couldn't find one). So how to port the VS wizard to VS2008 Express(professional)?
- I got the 2005 custom wizard setup, PCLibs-VS2005-ADT-Installer.zip and used a small tool , the LessMSIerables(Universal Extractor also works well) in order to extract the contents of the msi file. The msi contains four folders with all the stuff needed to create a new custom wizard. So, the tool extracted the following:
SourceDir
|- Includes Folder
|- Library Folder
|- Project Folder
|- Wizard Folder
Now some copying:
The CS106CPPInc folder inside the 'Includes Folder' goes to
C:\Program Files\Microsoft Visual Studio 9.0\VC\include (as a subfolder!)
'Library Folder'\CS106CPPLib.lib goes to
C:\Program Files\Microsoft Visual Studio 9.0\VC\lib
'Wizard Folder\AppWiz\CS106 Assignment Wizard' to
C:\Program Files\Microsoft Visual Studio 9.0\VC\VCWizards\AppWiz
(meaning CS106... should appear as a sub-folder of AppWiz)
The three files in 'Project Folder' will go into
C:\Program Files\Microsoft Visual Studio 9.0\VC\Express\VCProjects\Stanford. One of those three files, the CS106 Assignment Wizard.vsz, needs to be edited (a text file) and its second line should become:
Wizard=VsWizard.VsWizardEngine.9.0
Was having the same problem. I found both the .h and the .c files online.
You can find them here:
http://www.ime.usp.br/~pf/Roberts/C-library/standard/cslib/
I suggest to go to the CS106B page directly:
http://www.stanford.edu/class/cs106b/
And grab newest assignments. They are compatible with VS 2008.
The assignment material from SEE is outdated (VS 2005). The assignments are not discussed in the video, so you won't miss anything by doing that.
Just download from the CS106B page and open in VS 2008, that will work!
Reading through handout 5P makes it seem like the installer will expect the file structure VS2005 will create - especially this sentence: "Run (and quit) Visual Studio (you can go ahead and register your copy if it asks you). It is important that you have done this at least once before proceeding to the next step."
Try creating a folder structure like: (under "My Documents") "Visual Studio 2005\Projects" and see if setup.exe will work.
I am using visual studio express, and all I did was to just unzip the files it works fine.. here I have done the CS106B assignment with also the full zip'd up files of that assignment as well, all I did was to uncompress the assignment from the cs106b website and open up the sln (solution) file within visual studio express.
There is no c++ library available for cs106b in unix system. I hope they publish the library in source.

Resources