PostSharp is continually asking for "Some NuGet packages may need to be installed" - postsharp

PostSharp is already installed to the package, or at least it's already been attempted to be added multiple times.
Instead, it warns on every compilation, and on top of that "add PostSharp to project" doesn't disappear after the same action is executed, leading me to believe that the "Add PostSharp" action isn't completing properly.
How can this be manually installed to get around this OR
Can we just fix PostSharp so the add issue is removed (eg the bug is fixed)

You can validate which of your projects have PostSharp NuGet package installed with the "Manage NuGet Packages for Solution..." dialog box. You can also try to re-install the packages using the same dialog and see if it fixes the issue.
The "Some NuGet packages..." PostSharp dialog box can be disabled with "Do not show this dialog" check-box. The option is also available in "PostSharp" -> "Options" -> "Advanced" -> "Disable NuGet dependency verification before build".
Normally, the project that has PostSharp NuGet package installed should not appear in this dialog.

Related

Since I updated the Unity editor version to the last beta I can't find the unity packages. Is that a bug?

Where is the Standard package or the characters package ?
It can now be found in the package manager.
Go to Window -> Package manager.
You can then switch between the "in project" tab and the "all" tab.
Your characters package should be listed in the "all" tab. Hit install/ update in the top right corner to get it.

Visual Cobol 2012 and Nuget

I'm developing a DLL using Visual Cobol 2.2, and I want to make it a NuGet package so that other people in my shop can leverage it. In my VC project, the first time I tried to do this, I right-clicked on References and clicked on "Manage NuGet Packages." I received a message along the lines of "Not compatible with project." Not sure of the exact message text because I only got it once. After that, if I right-click on References, I do not even get the "Manage NuGet Packages" option. If I try to add the Nuget package at the solution level, I get a message "...could not be installed because it is not compatible with any project in the solution."
What am I missing? Is there something I need to do to the project properties for it to support NuGet? Something with the NuGet configuration? Something to the VC config?
Thanks for the help,
Mike

How to make sure nuget never update itself automatically?

I want to use Nuget in a situation where it should not update itself automatically. How can I configure / enforce this?
It seems Nuget is sometimes updated automatically. From the documentation it seems it is only a matter of not using the -Self option. But this seems to be incorrect. How can this be disabled?
In the Visual Studio Nuget options dialog there is a "Automatically check for updates" checkbox. Where is this setting stored?
Is there some setting / trick to "pin" the Nuget version explicitly?
To turn off the automatic check for updates, go to the NuGet settings dialog and uncheck Automatically check for updates.
This feature was actually added in NuGet 1.3, but would not be visible, of course, until an update to 1.3, such as NuGet 1.4, was made available.

NuGet Source Control Integration

I checked out my project using git and saw the assembles I installed with NuGet as missing. I tried building and got a missing assembly error so I tried to re-add it with NuGet but NuGet says I have added that dll/reference to my project (it has a green checkmark).
I went into the options and checked get missing ref during build and did a rebuild and I am still getting missing asm errors.
How do I use NuGet with source control?
Right Click Solution (and projects) -> Enable NuGet Package Restore
or...
Check the packages folder into source control.
YMMV, NuGet is terrible at integrating with source control.
What exact error are you seeing with package restore ?
http://docs.nuget.org/docs/workflows/using-nuget-without-committing-packages - has more details around enabling package restore.
[For the benefit of those who land here via a web search]
As of NuGet 2.0, "Restore Packages" is a step that can be performed by the build before attempting to build your solution:
See this from official NuGet docs
Enabling package restore for a solution can be done through Visual Studio GUI and the changes made to the project are similar to what #Precipitous suggests in his comment. In essence you do this:
Right click on the solution in Visual Studio and click "Enable NuGet Package restore".

Problem with uninstalling NuGet Packages

I'm trying to uninstall some packages installed by NuGet. According to the doc described here, I should see an Uninstall button (first screenshot below) when I select the installed package. However, I only see a Manage button (second screenshot below). Can anyone please tell me how to uninstall the packages?
If you scroll down to the Managing Installed Packages section of the NuGet documentation page you linked to you will see the Manage button and an explanation.
In NuGet 1.4 a new feature was introduced allowing you to select the solution in the Solution Explorer and add/remove packages from multiple projects in one step. Previously you had to select each project in the Solution Explorer and add/remove the package from each project one at a time.
If you click the Manage button a Select Projects dialog will be displayed where you can uncheck the projects that you want the NuGet package to be uninstalled from.
If you select the project instead of the solution in the Solution Explorer you can add/remove packages from that selected project. In this case you will only see the Install and Uninstall buttons.
Finally, I found I had to manually edit the .sln solution file and remove these lines:
GlobalSection(ExtensibilityGlobals) = postSolution
EnterpriseLibraryConfigurationToolBinariesPath = packages\Unity.2.1.505.0\lib\NET35;packages\Unity.Interception.2.1.505.0\lib\NET35;packages\EnterpriseLibrary.Common.5.0.505.0\lib\NET35;packages\EnterpriseLibrary.Data.5.0.505.0\lib\NET35
EndGlobalSection
After removing the above lines in the solution file, those packages disappeared in the NuGet Packages Window "Installed package" page. There is only one package left and I can now see the "Uninstall" button.
EDIT:
I also had to delete the packages folder in my solution directory.
Sometimes there are dependencies that disallow uninstalling a package, but you need to do so anyway (i.e. if you inadvertently install two different versions of a package with dependencies).
When this happens, the only way to uninstall the packages is to force the uninstallation, and this can only be done through the Package Manager Console.
Before going to the Console, you should open the Manage NuGet Packages window, and note down the Id and Version of your package, which appears on the right pane when you click on the package.
Then you can close the Manage window, and open the console (Package Manager Console), and run this command:
uninstall-package -Id YourPackageId -Force -Version YourPackageVersion
Note the -Force parameter. For example
uninstall-package -Id Unity -Force -Version 3.0.1304.0
This command allows to uninstall the version 3 when it is installed in parallel with version 2, which can't be done throgh the Manage window.
I had similar issues recently. My project worked fine but I couldn't add or remove any packages via the NuGet package Manager anymore because EnterpriseLibrary 5.0.505 was shown as missing from the source. But trying to either restore or delete it failed with an error "unable to find version '5.0.505. of package 'EnterpriseLibrary'".
I traced this down to having the following reference in the packages.config file:
<package id="EnterpriseLibrary" version="5.0.505" targetFramework="net4" />
Comparing this with other solutions to which I added the package more recently I changed it to, the following, which fixed the issue:
<package id="EnterpriseLibrary.Common" version="5.0.505.0" targetFramework="net4" />
I never edited any package.config files manually, so I don't know how the mismatch happened. Maybe the reference changed since originally including the package without updating the config file...?
I had a problem to remove Code first lib CTP5 that had dependences, uninstall did not return any message and did not remove anything. Delete references from packages.config that you need to remove. After that it will not show in nuget anymore and you can reinstall or continue without.
After using the VS IDE Manage NuGet Packages dialog or Package Manager Console you may have to manually remove solution files or other files on the file system that are part of the package not in the packages folder.
I was evaluating the Microsoft.AspNet.FriendlyUrls package which added a master page, a user control, a class code file and a packages.config file to my ASP.NET web application project / solution. I made the mistake to manually undo / remove these files from the solution before using the NuGet Packages dialog to remove the package. Everything got confused at that point.
As others have said, deleting the packages folder was the solution. But then I had to manually figure out the other files outside that folder that also should be deleted.