VisualStudio: Find implementation inside my nuget package - visual-studio

I have a project, that uses my own nuget package from my nuget feed. I've set up a source server in devops, so I'm able to step into the code inside this package by pressing F11.
But also I'd like to be able to jump to this code using Ctrl+F12 (go to implementation). Now when I try this, I get "The symbol has no implementations".
Is it possible?

VisualStudio: Find implementation inside my nuget package
I am afraid there is no such out-of-box way to do this at this moment.
As we know, the symbol server is used for debugging. We could step into the source code by the Debugger and symbol.
But if we use Ctrl + F12 directly from your code, it would only search for implementations in your code. It does not invoke the debug mechanism, so it can not find the implementation in the nuget package, even if we provide the symbol server.
So, if you still want to find implementation inside nuget package, as workaround, you can try to add the source code into the reference project, we could include the source code in to the content folder in the .nuspec file,like:
<files>
<file src="TestDemo.cs" target="content\Implementation" />
</files>
In this case, the source code will be added to the reference project, we could use Ctrl+F12 to find implementation.
Hope this helps.

Related

How to determine version of iTextSharp?

I'm using VS2022, and I received an old project, where iTextSharp was used, but I can't determine a specific version of the mentioned.
I've tried - Tools -> Nuget Package Manager -> Manage Nuget Packages for Solution...
But was unable to find iTextSharp.
Thanks in advance.
It sounds like the assembly has been included directly in the source control, as was common place before nuget. Take a look in your project's references and you should be able to locate the dll. Checking the file's properties in VS should show you the assembly's details in the properties panel and should also show you which version is being used, if not the path or filename may give you a clue as to the version being used.

ErroCS1929 'IHtmlHelper<IPagedList<Book>>' does not contain a definition for 'PagedListPager'

This is the full error
Error CS1929 'IHtmlHelper<IPagedList>' does not contain a definition for 'PagedListPager' and the best extension method overload 'HtmlHelper.PagedListPager(HtmlHelper, IPagedList, Func<int, string>)' requires a receiver of type 'HtmlHelper' BookSystem E:\source\TelerikAlpha\BookSystem\BookSystem\Views\Manage\Index.cshtml 52 Active
And all I followed was the code in microsoft's tutorial for paging: https://learn.microsoft.com/en-us/aspnet/mvc/overview/getting-started/getting-started-with-ef-using-mvc/sorting-filtering-and-paging-with-the-entity-framework-in-an-asp-net-mvc-application
Does anyone have any idea why it happens like this?
I had this issue as well. There are many NuGet packages related to PagedList, so it's the matter of finding the right one.
For an MVC app, the NuGet package that I needed was X.PagedList.Mvc.Core.
In Visual Studio, go to Tools --> NuGet Package Manager --> Manage NuGet Packages for Solution. Browse for X.PagedList.Mvc.Core and install it for your project.
In your view where you are implementing paging, add:
#using X.PagedList.Mvc.Core

Unable to install NuGet pck - Microsoft.Web.Infrastructure is not in my GAC

The error:
Failed to add reference. The package 'SimpleInjector.Integration.WebApi.WebHost.QuickStart' tried to add a framework reference to 'Microsoft.Web.Infrastructure' which was not found in the GAC. This is possibly a bug in the package. Please contact the package owners for assistance.
Cannot find assembly 'Microsoft.Web.Infrastructure'.
First of all. Why the error when I have the dll and reference to it in my project?
Second. How do I fix this?
Obviously I've tried to add the assembly to my GAC with various guides from Mircosoft. None of them makes sense imo.
https://learn.microsoft.com/en-us/dotnet/framework/app-domains/how-to-install-an-assembly-into-the-gac
This results in "Failure adding assembly to the cache: The system cannot find the file specified." I guess that's because it's not a strongly typed name with a key pair or what ever. So I looked into this https://learn.microsoft.com/en-us/dotnet/framework/app-domains/how-to-sign-an-assembly-with-a-strong-name
which makes absolutely no sense. It says:
"In the Choose a strong name key file box, choose , and then navigate to the key file. To create a new key file, choose and enter its name in the Create Strong Name Key dialog box."
What key file? Create a new and just come up with a random name? Wtf? How is that related to a specific assembly?
I faced a similar issue with error "Unable to uninstall 'Ninject.3.2.2' because 'Ninject.Extensions.ChildKernel.3.2.0, Ninject.Extensions.Conventions.3.2.0, Ninject.Web.3.2.0, Ninject.Web.Common.3.2.0' depend on it.".
It was caused by multiple projects in the solution having a dependency on those DLLs and so package manager was not able to uninstall it.
The command with "uninstall package-name -RemoveDependency" too doesn't work here.
I removed the dependency one by one to fix it.
As #Schadensbegrenzer and #LeoLiu-MSFT pointed out, the Infrastrcuture assembly is not part of the .NET framework (anymore).
The issue has been reported as a bug on SimpleInjectors repo:
https://github.com/simpleinjector/SimpleInjector/issues/509
The package owners solution:
"I'll add this issue to the v4.1 backlog, and will fix the NuGet package (and that of SimpleInjector.Integation.MVC3 as well) with v4.1.
In the meantime, you can manually add the Microsoft.Web.Infrastructure NuGet package to your Web API project or don't add the SimpleInjector.Integration.WebApi.WebHost.QuickStart NuGet package to your project, but just the SimpleInjector.Integration.WebApi NuGet package and add the required code manually. The WebHost.QuickStart package is in fact nothing more than a reference to the integration package while injected some code into your application anyway.
The Web API integration page in the documentation describes how to set up a Web API project using Simple Injector."

Titanium module source code

I have Securely module installed.
It have createProperties() function inside, how can I jump to definition of this function?
I saw documentation, I just need straightforward source code of this function.
It has libbencoding.securely.a file, but there is no way I can uncompress it to view source code.
I tried a lot of options, but no luck.
Can I do it inside Appcelerator Studio, or any other IDE ?
The source code is available. Have a look here: https://github.com/benbahrenburg/Securely/blob/master/Android/src/bencoding/securely/PropertiesProxy.java#L79
The libs e.g. libbencoding.securely.so are created during compiling. The (android) project can be build completely from the source.
libbencoding.securely.a is inside the binary iOS version of the module, while the source-code is available at https://github.com/benbahrenburg/Securely/tree/master/iOS

Nuget - Writing tools for Package Manager Console (custom cmdlets)

I've installed nuget package manager and I really love mvc-scaffold extension. I would like to write similar tool for my projects.
Is there any API reference or some documentation for nuget I can learn from ? TIA for any suggestions.
Edit:
Question is already 'answered' (thx one more time), here are some links that can be helpful:
http://nuget.codeplex.com/releases/view/59864 - package explorer (download + see what it's inside the package - thank God for comments in mvc scaffolding ps scripts :))
http://channel9.msdn.com/Series/mvcConf/mvcConf-2-Steve-Sanderson-MvcScaffolding - video from mvcConf2
and of course Steve Sanderson's blog : http://blog.stevensanderson.com/
I wrote the current version of MvcScaffolding that you mention in your question. Here's how it adds PowerShell cmdlets to the Package Manager Console:
Cmdlets are written in C# and compiled into a .NET assembly (see http://msdn.microsoft.com/en-us/magazine/cc163293.aspx)
The .NET assembly is included in MvcScaffolding's "tools" folder (see http://docs.nuget.org/docs/creating-packages/creating-and-publishing-a-package#From_a_convention_based_working_directory)
MvcScaffolding also contains an init.ps1 file that NuGet runs each time you open a solution containing it (also described at http://docs.nuget.org/docs/creating-packages/creating-and-publishing-a-package#Automatically_Running_PowerShell_Scripts_During_Package_Installation_and_Removal). This script uses the PowerShell "Import-Module" command to import the cmdlets from the .NET assembly, making them available in the console.
Note that it's not actually necessary to write your cmdlets in C# and call Import-Module. A simpler alternative is to write them in PowerShell (see http://technet.microsoft.com/en-us/magazine/ff677563.aspx) and define them inline in your NuGet package's init.ps1 file.
Or, if your question is about how to add custom scaffolders to MvcScaffolding (e.g., so you can say "Scaffold MyCustomThing -somecustomparams"), then use the command "Scaffold CustomScaffolder MyCustomThing", and then edit the PS1/T4 files that appear in your CodeTemplates/Scaffolders folder. I'll blog more details about this soon.

Resources