Questions tagged [packagereference]
100 questions
2
votes
1 answer
Create nuget package that include other nuget package
I have created a .NET Standard project where I installed the version 4.4.4 of the System.ServiceModel.Http nuget package. This package include also the dll System.ServiceModel.Primitives... I add image:
I have created a nuget package from my…

Simone
- 2,304
- 6
- 30
- 79
2
votes
2 answers
Switch back to packages.config - clarification on answer
In line with the rules, I have to ask a new question, to get some clarification on another question/answer.
This answer is this one: https://stackoverflow.com/a/45964469/305916
Then what? Just did the accepted answer, but the packages.config file is…

Dennis
- 63
- 1
- 10
2
votes
0 answers
NuGet CLI not restore the package for the packagereference
I have created a new .net core project with Visual Studio 2017, then add a nuget package Newtonsoft.Json to the project. After that I know the package will cached at the folder C:\Users\\.nuget\packages.
For some reason, I have to delete…

Joy
- 1,171
- 9
- 15
2
votes
0 answers
How do I get msbuild /restore to work for a standalone/non-SDK project file?
I want to use msbuild /restore with my project file. However, my project file is more like a script which orchestrates building multiple projects with particular properties, etc. Thus, it doesn’t make sense for me to set Sdk="Microsoft.NET.Sdk"…

binki
- 7,754
- 5
- 64
- 110
1
vote
1 answer
Clarify how VisualStudio "PackageReference" works
My test scenario using "PackageReference" mode:
Project A reference project B.
Project B use third party library installed via packagemanager.
The Third party library depends on other third party library (tpl2 for brevity).
I try to use tpl2 from A,…

Mirko Collura
- 61
- 6
1
vote
1 answer
MSBuild Conditional PackageReference based on .Net TargetFramework
INTRODUCTION
I am building a class library which could be used by some legacy applications targetting .Net Framework 4.0 and new applications targetting .Net Framework 4.6.1
I am adding some database/Hibernate new code in the class library that…

Philibert Perusse
- 4,026
- 5
- 24
- 26
1
vote
0 answers
.NET Core - why do 'classic' assembly references not get put into the generated .deps.json files at a higher level?
In .NET core, the generated .deps.json file controls assembly loading - if your dependencies aren't in the .deps.json for your top level application, they will not get loaded unless you start handling AssemblyResolve events and all that stuff.
The…

RobinG
- 369
- 2
- 6
1
vote
0 answers
Migration of .NET Framework packages.config to PackageReferences removed most References and shows warnings and errors
I have a legacy .NET Framework solution (ASP.NET) which I am trying to slowly fix the technical debt for. I tried to move the packages.config to PackageReferences in 4 of the 5 projects in the solution (the non-ASP.NET ones). One of the projects, an…

Ross Gustafson
- 1,182
- 3
- 16
- 32
1
vote
0 answers
What is the difference between binding redirection under packagereference and packages.config?
On multiple GitHub issues, you can see that there are differences between packages.config and Package Reference.
Most explanations: packages.config is bound during download and Package Reference is at runtime, but what are the specific differences?…

Smart
- 21
- 3
1
vote
0 answers
how to add dotnet compile time only dependency
I have a package which should only be a compile-time dependency, i.e.
included in the build but not part of output. Like "CopyLocal=false" works in non-sdk projects.
I tried runtime on PackageReference which sort of…

adrianm
- 14,468
- 5
- 55
- 102
1
vote
0 answers
Assembly references of PackageReference missing when building with jenkins and devenv.com
I'm building a solution that contains a class library, a UnitTest Project and a .vdproj setup project. Because MSBuild cannot handle vdproj I'm using devenv.com. I'm calling C:\NuGet\nuget.exe restore "%WORKSPACE%\solution.sln" -ConfigFile…

M. Jud
- 11
- 2
1
vote
3 answers
MSBuild Conditions Not Evaluating
I have an app which can come in one of 3 "flavors", the flavor depends only on the NuGet packages that are referenced in the project.
In order to simplify the build, I want to use a custom property to define the flavor and then use conditions on the…

Mickey Cohen
- 997
- 7
- 23
1
vote
1 answer
Visual Studio References shows NuGet package that is not referenced
I converted a .NET Framework 4.7.2 project from packages.config to PackageReferences format by right clicking the packages.config file within VS 2019.
Since then Visual Studio shows blue icons of a NuGet package which I uninstalled from the project…

Nikhil
- 3,304
- 1
- 25
- 42
1
vote
1 answer
Load csproj The attribute "ExcludeAssets" in element is unrecognized
Using Microsoft.Build component to load a csproj using method ProjectCollection.GlobalProjectCollection.LoadProject. Documentation here.
Loading a csproj with PackageReference and ExcludeAsset attribute in one of the references, example:
…

Ricardo Rocha
- 31
- 6
1
vote
1 answer
How control what depenent version is installed when using PackageReference
I have a C# project that uses PackageReference to manage dependencies using NuGet. I am able to install top-level packages using the NuGet manager with no issues. However, I am looking for a way to force Nuget to install a specific version of one of…

John
- 245
- 3
- 8