Nugets packages from .net Standard 2.0 projects not showing in NuGet packages tab in TeamCity - nuget

We have a .net solution that contains .net standard 2.0 projects and .net framework projects.
On each build with TeamCity we have a step with NuGet Installer to restore the nuget packages for solution (nuget version 4.3.0). The step works fine, it restores the nuget packages but on Nuget Packages tab at Used Packages section we see only the nugets from .net framework projects.
Only the .net framework projects have packages.config file, the .net standard 2.0 ones doesn't have this files because nuget package manager uses PackageReference by default (as stated here https://learn.microsoft.com/en-us/nuget/consume-packages/package-references-in-project-files) so the nugets used are included in .csproj files.
What can be done in order for nuget packages for .net standard 2.0 projects show up on on Nuget Packages tab at Used Packages section ?
Thank you,
Adriana

Seems is a known issue of TeamCity, and if we need it fixed we should vote for it here: https://youtrack.jetbrains.com/issue/TW-52327
If anyone else has a workaround till is fixed please post it :)

Related

.net core installation and nuget

If I install .net core sdk does this also install nuget?
Cant seem to find anywhere that says yes. Looking to know as I am looking to do this on our build server
Looking at cli there is dotnet restore, dotnet nuget delete etc, so I am presuming yes.
If yes can I configure nuget in the same way as it is when I install nuget i.e. through this file location on windows:$env:APPDATA/nuget/NuGet.Config
Yes, the .NET Core Sdk ("CLI") contains a distribution of NuGet.
This integrated distribution is similar to the NuGet integration of VS 2017.
As you already inferred, it powers dotnet restore and the implicit restore performed during builds. There are also additional NuGet commands available via the dotnet nuget verb.
However, this is not a version of nuget.exe and most prominently does not support restoring packages.config based projects and dotnet nuget only supports a subset of features that nuget.exe offers.
Also, it uses the user-wide NuGet.Config from %APPDATA%\NuGet\NuGet.Config directory on windows and ~/.nuget/NuGet.Config on non-windows systems.

dotnetcore Nuget enable Pre-Release

I've started using dotnetcore for a hobby project.
I'm having an issue trying to install NLog. The Visual Studio Code editor seems to recognise the beta version as the intelisense suggests it inside the project.json file. However nuget doesn't seem to restore it.
Is there a way to enable pre-release on Nuget packages in the new dotnet core platform?
Is the package on the Nuget repo? Check this link to see if its listed:
https://www.nuget.org/packages/NLog
If it's on there you can just add it to your project.json and then run a dotnet restore to install the nuget, no intellisense required.
I came across the answer to my question whilst watching a PluralSight video on Entity Framework Core By Dr Scott Allen.
One option is to use the visual studio package manager console and use the -pre flag. e.g:
install-package Microsoft.EntityFrameworkCore.tools -pre

NuGet packages from TeamCity are not visible in DNX project

I have Nuget Server on TeamCity and when i try download package from server to dnx project list of the packages is empty, but when i try manualy add to project (by project.json) then it works.
How i should configure my TeamCity Nuget server or something other?
It appears that this is an issue with TeamCity's NuGet server as NuGet's public servers behave just fine. If I were to guess, there is some problem with passing in arguments for .NET Core assemblies / framework projects.
You want to have the TeamCity .NET Core plugin installed on TeamCity and use the "dotnet restore" command -- with the TeamCity URL for your NuGet package - and it should work as expected after that. For solutions mixed with csproj and xproj files, it has been my experience that you need a NuGet Installer and dotnet restore build step to get the job done. For NuGet, you want to have 3.5.0 (only available in beta at the time of this writing) or later to understand projects that contain a project.json -- and to not error out.

How do I find the right NuGet package for my framework version

I need the Microsoft ASP.Net Web Pages NuGet package, but I need the version which targets .net 4.0
How do I figure this out?
Is there a way to figure this out for any given NuGet Package?
The later versions of the Microsoft.AspNet.WebPages NuGet package only support .NET 4.5
The older version 2.0.30506.0 supports .NET 4.0
To figure this out I used the NuGet Package Explorer, displayed the list of package versions and opened a few of the NuGet packages to see what .NET frameworks they support. As far as I am aware you cannot get the supported .NET frameworks from the metadata returned by the nuget.org OData feed. The only way I know is to look inside the NuGet package itself.

Referencing a .net 3.5 version of a nuget package from a .net 4 project

I want to make my .net 4 project load the .net 3.5 version of a nuget package so that other .net 3.5 references don't get the nuget dll overwritten in the output directory.
Yikes! If the package has a .NET 3.5 and a .NET 4 version of the DLL, there's no real way to do that other than changing your project to target 3.5 itself.
I can think of a couple of workarounds though. They're not ideal, but they'd probably work.
After you install the nuget package, go into the "packages" directory (it'll be next to your solution (.sln) file. Find the package. Delete the "\lib\net40" folder. This way, NuGet will reference the next version down. You'll have to manually change the assembly reference. Note if you even upgrade this package, you'll have to do this again.
You could create a custom version of this package that only contains your 3.5 version of the DLL. Perhaps put this up in a custom feed at http://myget.org/ and install it from there.
One of those ought to work.