Microsoft.Extensions.Configuration.Json missing Manage Nuget Packages - c#

I'm just trying to access appsettings.json using following article
https://makolyte.com/csharp-when-setbasepath-and-addjsonfile-are-missing-for-configurationbuilder/
However, when I try to browse Microsoft.Extensions.Configuration.Json it's not there. I can using Install-Package to get it though.
Can someone share some insight as to why this is?

Related

How can I find the networkcomms DLL, I can't find it in Github

I am trying to create a Client Server app, and I found this tutorial
I tried to download the DLL to use the lib but I can't find the DLL. Is anyone using this lib and can tell me how do I download it? Thanks.
Is this what are you looking for? Everything you need to know about getting started with NetworkComms.Net, including a short introduction video can be found here
You can also add it through Nuget Packet Manager using:
Install-Package NetworkCommsDotNet -Version 3.0.3
Nuget Gallery | NetworkCommsDotNet

Publish c# symbols to NuGet package using NuGet Package Manager

I know there is a way to do this using CLI. Is there a way to publish symbols for debugging packages in development using the NuGet Package Manager?
Asked another way, how to debug a package when the package is not able to run in a stand alone manor?
Boy...do I feel stupid! After sleeping on it it hit me.
Create a new Solution [MySolution].
Add the project [MyNuGetSolution] that is targeted toward making a NuGet package.
Add a reference to the [MyNuGetSolution] from inside [MySolution].
Develop to your hearts content! When you get the [MyNuGetSolution] to the point that you are happy then work on packaging it and using it in other solutions.
Sometimes the obvious eludes me!

Where is FunctionInvocationFilterAttribute located?

I've been reading about the extension points of azure functions using the function filters - https://github.com/Azure/azure-webjobs-sdk/wiki/Function-Filters
However I'm stuck at the first hurdle of creating my own class that inherits FunctionInvocationFilterAttribute. I just can't find the type anywhere.
FYI - I'm also pointing at the nightly builds nuget feed (http://www.myget.org/F/azure-appservice/api/v2)
Where is the FunctionInvocationFilterAttribute type located?
Finally found the location of the FunctionInvocationFilterAttribute, It looks like it is part of the 2.x.x line of packages on the nightly build feed not the 3.x.x packages. Thus Updating to the latest pre-release package didn't contain the class.
For anyone interested - this is currently in the dev branch on the github project - https://github.com/Azure/azure-webjobs-sdk/blob/dev/src/Microsoft.Azure.WebJobs.Host/Filters/FunctionInvocationFilterAttribute.cs
and also details on this functionality can be found on this github issue
So to install the correct package:
Install-Package Microsoft.Azure.WebJobs -Version 2.1.0-beta1-10998
or
dotnet add package Microsoft.Azure.WebJobs --version 2.1.0-beta1-10998

How to use #Scripts in MVC3 VS10 application

I have a MVC3 application in Visual Studio 2010 . I need to refer the scripts/styles in layout page using following tag
#System.Web.Optimization.Styles.Render("~/Content/css")
#System.Web.Optimization.Scripts.Render("~/Scripts/script")
But I am unable to use like this, since System.web,optimization is not available from _Layout.cshtml( even though the dll is referred in the project).Please refer to below image
how to resolve this?
First install Microsoft.AspNet.Web.Optimization using Package Manager Console using below command.
Install-Package Microsoft.AspNet.Web.Optimization
Next you need to reference the dll System.Web.Optimization.dll in your web project then you can add this namespace #using System.Web.Optimization in your_Layout.cshtml`.
Also make sure System.Web.Optimization.dll is present in bin folder in project.
Install-Package Microsoft.AspNet.Web.Optimization
In the Nuget Package Manager Console.

How to handle packages such as EF, MVC4, WebPages and friends in my project repository

I have an asp.net application using EF, MVC4 and some additional packages. Whenever I try to open the project on a different PC I have issues with the installed packages. My references are marked as missing, and the code is far from compilable. Last time I solved it by deleting references and packages and installing the needed packages one by one. I find the solution tedious. Is there any better, global solution for this? How is this supposed to be done? Shouldn't this be automated?
Thanks for the help and pointers!
UPDATE
I DO use NuGet Packages, (otherwise it would be very hard to get all these dlls) but somehow I always end up with uninstalling and reinstalling the packages to make my project work. I always end up with wrong versions and not compiling code.
I end up doing the following:
Delete package.config
Delete dependencies from the web.config file
NuGet Package Manager Console:
PM> Uninstall-Package A.B.C
PM> Install-Package A.B.C
Clean - rebuild project and hope for the best
I think Uninstall - Install can be replaced with Update-Package –reinstall A.B.C
I was hoping that there is a simpler solution for this.
If using visual studio; you can enable automatic package restore; this article outlines nuget in detail.
If you go to Tools -> Options -> NuGetPackage Manager you can make sure that the auto download is enabled. See the screenshot below.
Without knowing which references are broken, I would assume that you can at least use NuGet Packages to manage Entity Framework and additional framework references.
As lucian.jp said nuget it probably the way to go. At my company, we usually will go out of our way to find and use only packages that have maintained nuget packages, and even most of the core Microsoft ones have them, for example https://www.nuget.org/packages/Microsoft.AspNet.Mvc/
For the other ones, keeping a little thirdparty folder with external assemblies/dlls in the root of your repository and then reference from your project to that instead of from some random place on your hard-drive. I.e. check the third party assemblies into your project somewhere that is not your bin directories.
So if you have an existing project, here is what I suggest you do to avoid future issues:
For each of the assemblies, including your MVC ones, find the nuget equivalent, remove the dll from your project and add it back using the nuget package manager.
Get a copy of all the remaining assemblies and create a folder in the root of your repository and place them in there, then delete all of them and add them back in referencing the dlls from that folder.
If you are using git I'd also use .gitignore to not check in your bin directories. Which will force a new deployment of your code to get the assemblies from their respective sources.
Use Nuget for DLL packages like EF and MVC. But do not use Nuget for JS / CSS packages instead go for bower. Nuget packages for CSS and JS libraries are good but just their installation and uninstallation is tricky and may not match your project structure.

Categories

Resources