Sending solution to new developer with tfs - package issues - c#

I have shared a solution with another developer via TFS and we are having some trouble with the packages.
In the source control explorer I see what is shared is a packages folder with each package folder and a .nupkg file in each.
I read that we needed to run Update-Package to install all of these based on the packages.config folder. When we did that there was an error on EntityFramework. Here are the logs.
No package updates are available from the current package source for project 'ConfigManager'.
Attempting to gather dependency information for multiple packages with respect to project 'BusinessServices.Tests', targeting '.NETFramework,Version=v4.5'
Attempting to resolve dependencies for multiple packages.
Resolving actions install multiple packages
Removed package 'NUnit 3.2.1' from 'packages.config'
Successfully uninstalled 'NUnit 3.2.1' from BusinessServices.Tests
GET https://api.nuget.org/v3-flatcontainer/nunit/3.5.0/nunit.3.5.0.nupkg
OK https://api.nuget.org/v3-flatcontainer/nunit/3.5.0/nunit.3.5.0.nupkg 56ms
Installing NUnit 3.5.0.
Adding package 'NUnit.3.5.0' to folder 'C:\WORK\TFS\TransitProjects\HmkApi\packages'
Added package 'NUnit.3.5.0' to folder 'C:\WORK\TFS\TransitProjects\HmkApi\packages'
Added package 'NUnit.3.5.0' to 'packages.config'
Successfully installed 'NUnit 3.5.0' to BusinessServices.Tests
Removing package 'NUnit 3.2.1' from folder 'C:\WORK\TFS\TransitProjects\HmkApi\packages'
Removed package 'NUnit 3.2.1' from folder 'C:\WORK\TFS\TransitProjects\HmkApi\packages'
Attempting to gather dependency information for multiple packages with respect to project 'PrintServices.Tests', targeting '.NETFramework,Version=v4.5'
Attempting to resolve dependencies for multiple packages.
Resolving actions install multiple packages
Removed package 'NUnit 2.6.4' from 'packages.config'
Successfully uninstalled 'NUnit 2.6.4' from PrintServices.Tests
Removed package 'Moq 4.5.9' from 'packages.config'
Successfully uninstalled 'Moq 4.5.9' from PrintServices.Tests
Executing script file 'C:\WORK\TFS\TransitProjects\HmkApi\packages\AutoMapper.3.3.1\tools\net40\uninstall.ps1'
Removed package 'AutoMapper 3.3.1' from 'packages.config'
Successfully uninstalled 'AutoMapper 3.3.1' from PrintServices.Tests
GET https://api.nuget.org/v3-flatcontainer/automapper/5.1.1/automapper.5.1.1.nupkg
OK https://api.nuget.org/v3-flatcontainer/automapper/5.1.1/automapper.5.1.1.nupkg 120ms
Installing AutoMapper 5.1.1.
Adding package 'AutoMapper.5.1.1' to folder 'C:\WORK\TFS\TransitProjects\HmkApi\packages'
Added package 'AutoMapper.5.1.1' to folder 'C:\WORK\TFS\TransitProjects\HmkApi\packages'
Added package 'AutoMapper.5.1.1' to 'packages.config'
Successfully installed 'AutoMapper 5.1.1' to PrintServices.Tests
GET https://api.nuget.org/v3-flatcontainer/moq/4.5.28/moq.4.5.28.nupkg
OK https://api.nuget.org/v3-flatcontainer/moq/4.5.28/moq.4.5.28.nupkg 113ms
Installing Moq 4.5.28.
Adding package 'Moq.4.5.28' to folder 'C:\WORK\TFS\TransitProjects\HmkApi\packages'
Added package 'Moq.4.5.28' to folder 'C:\WORK\TFS\TransitProjects\HmkApi\packages'
Added package 'Moq.4.5.28' to 'packages.config'
Successfully installed 'Moq 4.5.28' to PrintServices.Tests
Package 'NUnit.3.5.0' already exists in folder 'C:\WORK\TFS\TransitProjects\HmkApi\packages'
Added package 'NUnit.3.5.0' to 'packages.config'
Successfully installed 'NUnit 3.5.0' to PrintServices.Tests
Removing package 'AutoMapper 3.3.1' from folder 'C:\WORK\TFS\TransitProjects\HmkApi\packages'
Removed package 'AutoMapper 3.3.1' from folder 'C:\WORK\TFS\TransitProjects\HmkApi\packages'
Attempting to gather dependency information for multiple packages with respect to project 'PrintServices', targeting '.NETFramework,Version=v4.5'
Attempting to resolve dependencies for multiple packages.
Resolving actions install multiple packages
Removed package 'NLog 4.3.3' from 'packages.config'
Successfully uninstalled 'NLog 4.3.3' from PrintServices
GET https://api.nuget.org/v3-flatcontainer/nlog/4.3.11/nlog.4.3.11.nupkg
OK https://api.nuget.org/v3-flatcontainer/nlog/4.3.11/nlog.4.3.11.nupkg 283ms
Installing NLog 4.3.11.
Adding package 'NLog.4.3.11' to folder 'C:\WORK\TFS\TransitProjects\HmkApi\packages'
Added package 'NLog.4.3.11' to folder 'C:\WORK\TFS\TransitProjects\HmkApi\packages'
Added package 'NLog.4.3.11' to 'packages.config'
Successfully installed 'NLog 4.3.11' to PrintServices
Attempting to gather dependency information for multiple packages with respect to project 'Resolver', targeting '.NETFramework,Version=v4.5'
Attempting to resolve dependencies for multiple packages.
Resolving actions install multiple packages
Removed package 'Unity 2.1.505.0' from 'packages.config'
Successfully uninstalled 'Unity 2.1.505.0' from Resolver
Removed package 'CommonServiceLocator 1.0' from 'packages.config'
Successfully uninstalled 'CommonServiceLocator 1.0' from Resolver
GET https://api.nuget.org/v3-flatcontainer/commonservicelocator/1.3.0/commonservicelocator.1.3.0.nupkg
OK https://api.nuget.org/v3-flatcontainer/commonservicelocator/1.3.0/commonservicelocator.1.3.0.nupkg 8ms
Installing CommonServiceLocator 1.3.0.
Adding package 'CommonServiceLocator.1.3.0' to folder 'C:\WORK\TFS\TransitProjects\HmkApi\packages'
Added package 'CommonServiceLocator.1.3.0' to folder 'C:\WORK\TFS\TransitProjects\HmkApi\packages'
Added package 'CommonServiceLocator.1.3.0' to 'packages.config'
Successfully installed 'CommonServiceLocator 1.3.0' to Resolver
GET https://api.nuget.org/v3-flatcontainer/unity/4.0.1/unity.4.0.1.nupkg
OK https://api.nuget.org/v3-flatcontainer/unity/4.0.1/unity.4.0.1.nupkg 4ms
Installing Unity 4.0.1.
Adding package 'Unity.4.0.1' to folder 'C:\WORK\TFS\TransitProjects\HmkApi\packages'
Added package 'Unity.4.0.1' to folder 'C:\WORK\TFS\TransitProjects\HmkApi\packages'
Added package 'Unity.4.0.1' to 'packages.config'
Successfully installed 'Unity 4.0.1' to Resolver
Attempting to gather dependency information for multiple packages with respect to project 'BusinessServices', targeting '.NETFramework,Version=v4.5'
Attempting to resolve dependencies for multiple packages.
Resolving actions install multiple packages
Removed package 'NLog 4.3.3' from 'packages.config'
Successfully uninstalled 'NLog 4.3.3' from BusinessServices
Removed package 'EntityFramework 5.0.0' from 'packages.config'
Successfully uninstalled 'EntityFramework 5.0.0' from BusinessServices
Removed package 'AutoMapper 4.2.1' from 'packages.config'
Successfully uninstalled 'AutoMapper 4.2.1' from BusinessServices
Package 'AutoMapper.5.1.1' already exists in folder 'C:\WORK\TFS\TransitProjects\HmkApi\packages'
Added package 'AutoMapper.5.1.1' to 'packages.config'
Successfully installed 'AutoMapper 5.1.1' to BusinessServices
Package 'EntityFramework.6.1.3' already exists in folder 'C:\WORK\TFS\TransitProjects\HmkApi\packages'
Install failed. Rolling back...
Package 'EntityFramework 6.1.3' does not exist in project 'BusinessServices'
Removed package 'AutoMapper 5.1.1' from 'packages.config'
Package 'AutoMapper 4.2.1' already exists in folder 'C:\WORK\TFS\TransitProjects\HmkApi\packages'
Package 'EntityFramework 5.0.0' already exists in folder 'C:\WORK\TFS\TransitProjects\HmkApi\packages'
Package 'NLog 4.3.3' already exists in folder 'C:\WORK\TFS\TransitProjects\HmkApi\packages'
Removing package 'EntityFramework 6.1.3' from folder 'C:\WORK\TFS\TransitProjects\HmkApi\packages'
Removed package 'EntityFramework 6.1.3' from folder 'C:\WORK\TFS\TransitProjects\HmkApi\packages'
Update-Package : Failed to add reference to 'EntityFramework'.
At line:1 char:1
+ Update-Package
+ ~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Update-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.UpdatePackageCommand
At this point I am pretty stuck, not sure what my options are?

Related

Cannot uninstall entityframework package from mvc project

While trying to uninstall Entityframework in Package Manager Console by typing uninstall-package Entityframework, following error is showing up:
uninstall-package : Unable to uninstall 'EntityFramework.6.4.4' because 'Microsoft.AspNet.Identity.EntityFramework.2.2.3' depends on it.
While trying to uninstall Microsoft.AspNet.Identity.EntityFramework.2.2.3, following error shows up:
uninstall-package : Package 'Microsoft.AspNet.Identity.EntityFramework.2.2.3' to be uninstalled could not be found in project 'HMS'
After failing multiple attempts to uninstall entityframework package in Package Manager Console, I decided to manually delete the respective packages folders from Packages folder inside project directory, but Nuget is restoring the package folders again i.e.,
PM> uninstall-package entityframework
Restoring NuGet package EntityFramework.6.4.4.
Restoring NuGet package Microsoft.AspNet.Identity.EntityFramework.2.2.3.
Restoring NuGet package Microsoft.AspNet.Identity.Owin.2.2.3.
Restoring NuGet package Microsoft.AspNet.Identity.Core.2.2.3.
Adding package 'Microsoft.AspNet.Identity.EntityFramework.2.2.3' to folder 'E:\Visual Studio Projects\HMS\packages'
Adding package 'EntityFramework.6.4.4' to folder 'E:\Visual Studio Projects\HMS\packages'
Added package 'Microsoft.AspNet.Identity.EntityFramework.2.2.3' to folder 'E:\Visual Studio Projects\HMS\packages'
GET https://api.nuget.org/v3-flatcontainer/microsoft.aspnet.identity.owin/2.2.3/microsoft.aspnet.identity.owin.2.2.3.nupkg
GET https://api.nuget.org/v3-flatcontainer/microsoft.aspnet.identity.core/2.2.3/microsoft.aspnet.identity.core.2.2.3.nupkg
Added package 'EntityFramework.6.4.4' to folder 'E:\Visual Studio Projects\HMS\packages'
OK https://api.nuget.org/v3-flatcontainer/microsoft.aspnet.identity.owin/2.2.3/microsoft.aspnet.identity.owin.2.2.3.nupkg 170ms
OK https://api.nuget.org/v3-flatcontainer/microsoft.aspnet.identity.core/2.2.3/microsoft.aspnet.identity.core.2.2.3.nupkg 178ms
Installed Microsoft.AspNet.Identity.Core 2.2.3 from https://api.nuget.org/v3/index.json with content hash Mv5FpoaxspE8hlWLE4r1IdZtovg/OyFgVRhxQbx47J4sqdLImN1hnM1lnwCj+/wLmqtqFk/RYMoZ5GAcwm/00g==.
Installed Microsoft.AspNet.Identity.Owin 2.2.3 from https://api.nuget.org/v3/index.json with content hash gNr7dQGE23hAtWmSZVmKPJ+DKBw/obh68Ub7M5cCUiRNAqg6+6Jb3T7en4Fuw8R/8H5/sIsecrfT3MbK2/FzEg==.
Adding package 'Microsoft.AspNet.Identity.Core.2.2.3' to folder 'E:\Visual Studio Projects\HMS\packages'
Adding package 'Microsoft.AspNet.Identity.Owin.2.2.3' to folder 'E:\Visual Studio Projects\HMS\packages'
Added package 'Microsoft.AspNet.Identity.Core.2.2.3' to folder 'E:\Visual Studio Projects\HMS\packages'
Added package 'Microsoft.AspNet.Identity.Owin.2.2.3' to folder 'E:\Visual Studio Projects\HMS\packages'
Attempting to gather dependency information for package 'EntityFramework.6.4.4' with respect to project 'HMS', targeting '.NETFramework,Version=v4.7.2'
Resolving actions to uninstall package 'EntityFramework.6.4.4'
uninstall-package : Unable to uninstall 'EntityFramework.6.4.4' because 'Microsoft.AspNet.Identity.EntityFramework.2.2.3' depends on it.
At line:1 char:1
+ uninstall-package entityframework
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Uninstall-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.UninstallPackageCommand
Time Elapsed: 00:00:00.6990767
Where do I go now?

Why does dotnet build on a .NET Framework 4.5 project throw "This project references NuGet package(s) that are missing"?

The sample NotepadAndCalculatorTest project built in VS Code using the terminal command dotnet build throws the following errors:
C:\Program Files\dotnet\sdk\5.0.401\Microsoft.Common.CurrentVersion.targets(820,5): error : The BaseOutputPath/OutputPath property is not set for project 'NotepadCalculatorTest.csproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Debug' Platform='AnyCPU'. You may be seeing this message because you are trying to build a project without a solution file,
and have specified a non-default Configuration or Platform that doesn't exist for this project. [C:\Users\<username>\VSCode Projects\WinAppDriverTryout\Test\Samples\C#\NotepadAndCalculatorTest\NotepadCalculatorTest.csproj]
Or:
NotepadCalculatorTest.csproj(109,5): error : This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is packages\MSTest.TestAdapter.1.2.0\build\net45\MSTest.TestAdapter.props.
Could someone point me towards a possible way to get rid of the errors?
dotnet build carries out an implicit restore as part of the command.
This uses dotnet restore which does not support project references in packages.config & is exactly what this project is using.
dotnet restore only supports .csproj package references.
That's why, this project builds perfectly fine in Visual Studio but dotnet build throws errors.
You can migrate packages.config to package references by right-clicking on the file within Visual Stduio and clicking migrate, however that still won't fix your problem as dotnet cli works properly with .NET Framework only if the project was created using the dotnet new command.
I assume this project was created in Visual Studio since it has a Visual Studio solution file - .sln - and so commonly have a differently structured .csproj format.
This then usually breaks some CLI commands, even if you migrate the references in this case.
You have 2 workarounds.
1. Use nuget restore
The easiest option is to download the NuGet CLI executable from here, taken from the downloads page.
If you are not on Windows, use this guide by Microsoft.
Add it to your PATH or place it in the root folder of the project.
Run nuget restore, which is compatible with packages.config (run .\nuget restore if you're inside PowerShell to trust the command as PowerShell does not does not load commands from the current location by default for security).
Your should get output similar to this:
PS C:\Users\StackOverflow\NotepadAndCalculatorTest> .\nuget restore
MSBuild auto-detection: using msbuild version '16.9.0.16703' from 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\bin'.
Restoring NuGet package Microsoft.WinAppDriver.Appium.WebDriver.1.0.1-Preview.
Restoring NuGet package Selenium.Support.3.8.0.
Restoring NuGet package Selenium.WebDriver.3.8.0.
Restoring NuGet package Castle.Core.4.2.1.
Restoring NuGet package MSTest.TestFramework.1.2.0.
Restoring NuGet package Newtonsoft.Json.10.0.3.
Restoring NuGet package MSTest.TestAdapter.1.2.0.
Adding package 'MSTest.TestFramework.1.2.0' to folder 'C:\Users\StackOverflow\NotepadAndCalculatorTest\packages'
Adding package 'Selenium.Support.3.8.0' to folder 'C:\Users\StackOverflow\NotepadAndCalculatorTest\packages'
Adding package 'Castle.Core.4.2.1' to folder 'C:\Users\StackOverflow\NotepadAndCalculatorTest\packages'
Adding package 'Microsoft.WinAppDriver.Appium.WebDriver.1.0.1-Preview' to folder 'C:\Users\StackOverflow\NotepadAndCalculatorTest\packages'
Adding package 'Selenium.WebDriver.3.8.0' to folder 'C:\Users\StackOverflow\NotepadAndCalculatorTest\packages'
Adding package 'Newtonsoft.Json.10.0.3' to folder 'C:\Users\StackOverflow\NotepadAndCalculatorTest\packages'
Adding package 'MSTest.TestAdapter.1.2.0' to folder 'C:\Users\StackOverflow\NotepadAndCalculatorTest\packages'
Added package 'Microsoft.WinAppDriver.Appium.WebDriver.1.0.1-Preview' to folder 'C:\Users\StackOverflow\NotepadAndCalculatorTest\packages'
Added package 'Selenium.Support.3.8.0' to folder 'C:\Users\StackOverflow\NotepadAndCalculatorTest\packages'
Added package 'Selenium.WebDriver.3.8.0' to folder 'C:\Users\StackOverflow\NotepadAndCalculatorTest\packages'
Added package 'Castle.Core.4.2.1' to folder 'C:\Users\StackOverflow\NotepadAndCalculatorTest\packages'
Added package 'Newtonsoft.Json.10.0.3' to folder 'C:\Users\StackOverflow\NotepadAndCalculatorTest\packages'
Added package 'MSTest.TestAdapter.1.2.0' to folder 'C:\Users\StackOverflow\NotepadAndCalculatorTest\packages'
Added package 'MSTest.TestFramework.1.2.0' to folder 'C:\Users\StackOverflow\NotepadAndCalculatorTest\packages'
NuGet Config files used:
C:\Users\StackOverflow\AppData\Roaming\NuGet\NuGet.Config
C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.FallbackLocation.config
C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config
Feeds used:
C:\Users\StackOverflow\.nuget\packages\
https://api.nuget.org/v3/index.json
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
Installed:
7 package(s) to packages.config projects
Then run dotnet build.
It won't try to run dotnet restore as the packages have already been restored by NuGet already so you won't get any errors:
PS C:\Users\StackOverflow\NotepadAndCalculatorTest> dotnet build
Microsoft (R) Build Engine version 16.9.0+57a23d249 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
Nothing to do. None of the projects specified contain packages to restore.
NotepadCalculatorTest -> C:\Users\StackOverflow\NotepadAndCalculatorTest\bin\Debug\NotepadCalculatorTest.dll
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:01.08
2. Port the project
The 2nd workaround is to create a new project using dotnet new & port the code over so that your .csproj file works with dotnet restore and subsequently, dotnet build.
I would recommend option 1 unless you don't want to restore via NuGet.

'System.Xaml' which was not found in the GAC

Trying to update Microsoft.Build.Framework using Nuget in my SLN and getting the below error. This is VS 2017 Enterprise Version 15.9.1
Projects all target NET461 in this sln.
I duplicated this problem on 2 different windows 10 machines with the same project.
What can I do to get these packages updated?
Output
Attempting to gather dependency information for package 'Microsoft.Build.Framework.15.8.166' with respect to project 'Synovia.Service', targeting '.NETFramework,Version=v4.7.2'
Gathering dependency information took 3.08 sec
Attempting to resolve dependencies for package 'Microsoft.Build.Framework.15.8.166' with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'Microsoft.Build.Framework.15.8.166'
Resolved actions to install package 'Microsoft.Build.Framework.15.8.166'
Found package 'Microsoft.Build.Framework 15.8.166' in 'D:\git\sbss\Source\packages'.
GET https://api.nuget.org/v3-flatcontainer/microsoft.build.tasks.core/15.7.179/microsoft.build.tasks.core.15.7.179.nupkg
GET https://api.nuget.org/v3-flatcontainer/microsoft.build.utilities.core/15.7.179/microsoft.build.utilities.core.15.7.179.nupkg
Retrieving package 'Microsoft.Build.Tasks.Core 15.7.179' from 'nuget.org'.
Retrieving package 'Microsoft.Build.Utilities.Core 15.7.179' from 'nuget.org'.
Found package 'Microsoft.VisualStudio.Setup.Configuration.Interop 1.16.30' in 'D:\git\sbss\Source\packages'.
Removed package 'Microsoft.Build.Framework.15.6.82' from 'packages.config'
OK https://api.nuget.org/v3-flatcontainer/microsoft.build.utilities.core/15.7.179/microsoft.build.utilities.core.15.7.179.nupkg 53ms
Installing Microsoft.Build.Utilities.Core 15.7.179.
OK https://api.nuget.org/v3-flatcontainer/microsoft.build.tasks.core/15.7.179/microsoft.build.tasks.core.15.7.179.nupkg 78ms
Successfully uninstalled 'Microsoft.Build.Framework.15.6.82' from Synovia.Service
Installing Microsoft.Build.Tasks.Core 15.7.179.
Removed package 'Microsoft.Build.Tasks.Core.15.6.82' from 'packages.config'
Successfully uninstalled 'Microsoft.Build.Tasks.Core.15.6.82' from Synovia.Service
Removed package 'Microsoft.Build.Utilities.Core.15.6.82' from 'packages.config'
Successfully uninstalled 'Microsoft.Build.Utilities.Core.15.6.82' from Synovia.Service
Package 'Microsoft.Build.Framework.15.8.166' already exists in folder 'D:\git\sbss\Source\packages'
Install failed. Rolling back...
Package 'Microsoft.Build.Framework.15.8.166' does not exist in project 'Synovia.Service'
Package 'Microsoft.Build.Utilities.Core.15.6.82' already exists in folder 'D:\git\sbss\Source\packages'
Added package 'Microsoft.Build.Utilities.Core.15.6.82' to 'packages.config'
Package 'Microsoft.Build.Tasks.Core.15.6.82' already exists in folder 'D:\git\sbss\Source\packages'
Added package 'Microsoft.Build.Tasks.Core.15.6.82' to 'packages.config'
Package 'Microsoft.Build.Framework.15.6.82' already exists in folder 'D:\git\sbss\Source\packages'
Added package 'Microsoft.Build.Framework.15.6.82' to 'packages.config'
Executing nuget actions took 6.84 sec
Failed to add reference. The package 'Microsoft.Build.Framework' tried to add a framework reference to 'System.Xaml' which was not found in the GAC. This is possibly a bug in the package. Please contact the package owners for assistance.
Reference unavailable.
Time Elapsed: 00:00:10.1224742
========== Finished ==========
'System.Xaml' which was not found in the GAC
Your project is probably target .Net 3.5, which does not have this DLL. You can update the framework version in Project Properties.
If above not resolve your issue or you do not want to change your framework version, you can manually add the reference System.Xaml to your project:
Go to References -> Add Reference... and then click on Browse..
Add the file, which is located on (Windows 10): C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Xaml\v4.0_4.0.0.0__b77a5c561934e089\System.Xaml.dll
Then update your nuget package.
Hope this helps.

A package from a private Nuget Server (which has dependencies from nuget.org) does not install

Here are the steps that I follow to create and publish a class library to a private nuget server:
Create a class library project using VS2017.
Install log4net package from nuget.org using the nuget package manager.
Open cmd.exe, locate the project folder, execute:
nuget pack.
Verify that the mylibrary.version.nupkg file is created in the project folder.
On the terminal window, execute:
nuget push mylibrary.version.nupkg -source http://private.nuget.server
No problem till here. Now let's consume the package from another project:
Create another VS2017 project.
Open cmd.exe, locate the project folder, execute:
nuget install mylibrary -source http://private.nuget.server -source https://api.nuget.org/v3/index.json
At this poing I get the error below:
Attempting to resolve dependency 'log4net (≥ 2.0.8)'.
Unable to resolve dependency 'log4net (≥ 2.0.8)'.
It seems that the installation of an external package reference relative to the private nuget server fails. Nuget.exe looks for the dependent package (log4net, for this example) at the private nuget server, not at nuget.org.
I tried many options (including creating and using a special nuget.config file) but can't find a way through. Any thoughts?

Installing Entity Framework fails in Visual Studio 2015

I'm reading/coding along with the Apress book Pro ASP.NET MVC 5 by Adam Freeman. In chapter 7 (p. 174), we're supposed to install Entity Framework using the following commands:
Install-Package EntityFramework -projectname SportsStore.Domain
Install-Package EntityFramework -projectname SportsStore.WebUI
But this fails. Here is the output:
Attempting to gather dependencies information for package 'EntityFramework.6.1.3' with respect to project 'SportsStore.Domain', targeting '.NETFramework,Version=v4.5.1'
Attempting to resolve dependencies for package 'EntityFramework.6.1.3' with DependencyBehavior 'Lowest'
Resolving actions to install package 'EntityFramework.6.1.3'
Resolved actions to install package 'EntityFramework.6.1.3'
Adding package 'EntityFramework.6.1.3' to folder 'C:\git\SportsStore\packages'
Added package 'EntityFramework.6.1.3' to folder 'C:\git\SportsStore\packages'
Added package 'EntityFramework.6.1.3' to 'packages.config'
Executing script file 'C:\git\SportsStore\packages\EntityFramework.6.1.3\tools\init.ps1'
Executing script file 'C:\git\SportsStore\packages\EntityFramework.6.1.3\tools\install.ps1'
Type 'get-help EntityFramework' to see all available Entity Framework commands.
Successfully installed 'EntityFramework 6.1.3' to SportsStore.Domain
Install failed. Rolling back...
Removed package 'EntityFramework 6.1.3' from 'packages.config'
Removing package 'EntityFramework 6.1.3' from folder 'C:\git\SportsStore\packages'
Access to the path 'C:\git\SportsStore\packages\EntityFramework.6.1.3\tools\EntityFramework.PowerShell.Utility.dll' is denied.
Access to the path 'EntityFramework.PowerShell.Utility.dll' is denied.
Removed package 'EntityFramework 6.1.3' from folder 'C:\git\SportsStore\packages'
Install-Package : An item with the same key has already been added.
At line:1 char:1
+ Install-Package EntityFramework -projectname SportsStore.Domain
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
One or more packages could not be completely uninstalled: 'C:\git\SportsStore\packages\EntityFramework.6.1.3'. Restart Visual Studio to finish uninstall.
The book is instructing us to install specific versions of all other libraries (e.g. Microsoft.Aspnet.Mvc 5.0.0), but does not mention which version of EF to install, so I've tried installing different versions of EF, but keep getting the same error. (Install failed. Rolling back...)
I'm running VS2015 as administrator.
Seems NuGet itself was causing these issues (probably related to https://github.com/NuGet/Home/issues/1239, as I was seeing the same 'always rolling back' issue as discussed in that thread)
Updating NuGet solved it for me. (Updated from version 3.0.60624.657 to 3.1.60724.766)
These references were set up earlier in the project:
SportsStore.WebUI -> SportsStore.Domain
SportsStore.UnitTests -> SportsStore.Domain and SportsStore.WebUI
I removed the references for each project and then ran the install-package command for the Entity Framework as directed. That worked fine.
I then re-added the references.
Try to remove all the EF nuget packages installed on your solution and then reinstall the only one that you need.
Try to disconnect references between projects and than try to install EF. Hope it'll help
Relaunching Visual Studio as Admin and retry to install the package did the trick for me.

Categories