NuGet; unable to get package as wrong version reported in Visual Studio 2012 - visual-studio-2012

I'm trying to build a solution but I get this error,
he 'Microsoft.Bcl.Build 1.0.14' package requires NuGet client version '2.8.1' or above, but the current NuGet version is '2.6.40619.9041'.
I've just upgraded NuGet package manager in Tools/"Extensions and Updates" which reports the version as 2.8.50313.31.
I've restarted VS2012, restarted the computer, cleaned the project and rebuilt, but I still can't get Visual Studio to recognise the new version and hence can't compile.
Thanks

Run Console (cmd) as Administrator
Locate your .nuget folder that contains the NuGet.exe file (you may check error message to locate the path)
execute this command NuGet.exe update -self
Took me all day to find that NuGet was bound to the individual project.

I had to use the package manager console and run
Install-Package Microsoft.Bcl.Build -Version 1.0.14
to get it to work manually.
Edit (5/11/2014). The problem is actually that Nuget gets bundled with the solution and it is this that needs upgrading. I did this by finding the directory in the project with the nuget.exe file in it (.nuget for me, YMMV) going to that directory and running nuget update -self. If you go with the original solution, you have to do this manually for each package. HTH.

This worked for me in VS 2017 Enterprise-
Right click your solution and go to "Manage NuGet Packages for Solution..."
In the window that opens up, click the gear icon at the top right corner.
Select "General" and click the "Clear Clear All NuGet Cache(s)" button. This will run for a few seconds depending on the size of your
cache.
Clean and rebuild your solution.

Related

Error running android: Gradle project sync failed. Please fix your project and try again

Android Studio (1.2 RC0) keeps telling me
Error running android: Gradle project sync failed. Please fix your project and try again.
How can I find out what the problem is? Unfortunately the solutions from this SO thread did not help.
Goto File -> Invalidate caches / Restart
Shutdown Android Studio
Rename/remove .gradle folder in the user home directory
Restart Android Studio (It will download gradle metadata and data)
Gradle build succeed
Rebuild project. Done.
Solution is
Connect your computer to the internet
Click
Sync project with Gradle files
On toolbar
It will automatically sync the gradle.
Just ignore the error and try running the project anyway.
It will fail, but this time you will get a link in the error description. Clicking the link will trigger the automatic update/download of the outdated/missing component.
In my scenario, the project failed to launch two times, each time another API/SDK component being the culprit.
In my case I was just trying to launch a sample project I downloaded, having no clue what API level was being targeted or where to look for this information.
Download the latest Gradle package distribution for example (gradle-2.11-all.zip).
Extract this zip file in a folder as for example (D://Gradle)
Load your project in Android Studio and go to File->Settings->Gradle. Click on Use local Gradle distribution and point it to the folder where you unzipped the latest Gradle project.
Restart your project
It is a very common issue and the solution is very easy...
Just update the SDK in SDK manager(see full instructions below)
Open Android Studio and go to your SDK Manager(File>Settings>SDK
Manager)
Check for (-) icon in front of any package and click on it.
Click OK to start updating the SDK.
Thanks for asking that question :)
Delete "build" folder from project's root folder. Then do "invalidate cache and restart". This will restart your Android Studio and then build the app again, will solve the issue.
Go to
file->settings->build,execution,deployment->gradle.
(and set gradle home path from your directory)
If no error messages are shown: sometimes the command-line gradle shows them. Just go the the command-line, change to the app directory and type
gradle installDebug
or, if the details are missing
gradle --info installDebug
This can provide additional information how to debug the problem.
I had the same issue yesterday. After opening the "Android SDK Manager", updating all packages and restarting Android Studio, the project compiled again.
For me, the problem was the SDK Tools License had not been accepted. Clicking on the "Build" tab at the bottom uncovered the issue.
From there, I went into the AVD, uninstalled the tools and then reinstalled them, which prompted to accept the license.
All of these have not worked for me, what did is reading the very bottom of the log file located around here
C:\Users\madri\AppData\Local\Google\AndroidStudio2020.3\log\idea.log
and it said the following
So i fixed the problem by going into Tools > SDK Manager and installing the required SDK version
it looks different from one situation to another.
for me i did an installation and update a lot of things that the sdk manager said to then i had this problem.
all i did was:
from file -> Invalidate caches/Restart
(a dialog will pop-up) choose Invalidate and restart.
after the restart is done. everything was fixed but i needed to create a new emulator and delete the old one.
(android studio 1.3.1)
(one professional must edit this to be more understandable)
.
.
.
Here everything was fine, but your machines also needs restart because some system files are changed, to sync them we have to restart the system.
This could be due to Android Studio version conflict of v3 and v4 especially when you import a project in android stdio v4 which was previously built in v3.
Here are the few things you need to do:
remove the .gradle and .idea folders from the main Application folder.
import the project in the android studio.
after the sync finished, it will ask you to update the android studio supported version.
click update.
done.
I had the exact same error message
Error running android: Gradle project sync failed. Please fix your project and try again
Steps to solve:
Close Android Studio.
Remove the .gradle and .idea folders from the Application folder.
Open Android studio with your project.
After these steps android studio gradle will sync and download the required files to run the project (don't forget to disable offline mode).
I got this error going from Gradle 3.5.3 to 5.4.1 (Android Studio prompted and I clicked "Upgrade".)
Gradle proceeded to upgrade but yielded some errors such as:
ONFIGURE SUCCESSFUL in 1m 27s
ERROR: The Android Gradle plugin supports only Crashlytics Gradle plugin version 1.25.4 and higher.
The following dependencies do not satisfy the required version:
root project 'Android%20App' -> io.fabric.tools:gradle:1.25.1
Update plugins
Affected Modules: app
INFO: API 'variant.getExternalNativeBuildTasks()' is obsolete and has been replaced with 'variant.getExternalNativeBuildProviders()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variant.getExternalNativeBuildTasks(), use -Pandroid.debug.obsoleteApi=true on the command line to display more information.
Affected Modules: app
INFO: The specified Android SDK Build Tools version (27.0.3) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.5.3.
Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '27.0.3'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
Install Build Tools 28.0.3, update version in build file and sync project
Affected Modules: app
The thing that fixed it was opening Settings --> Appearance & Behavior --> System Settings --> Android SDK and I then selected some recent versions of Android SDK like 8, 9, and 10. (I had only had 5.1, 6.0, and Android N Preview installed.)
Once that's installed, I had to modify my build.gradle file for my Module: app
Removed buildToolsVersion '27.0.3'
Then I clicked the "Sync Project with Gradle Files" button on the toolbar. The Sync output window offered an option to "Update Plugins" and once I clicked through that everything seemed to work. For good measure I again clicked "Sync Project with Gradle Files" followed by Build --> Clean Project, and finally I was able to run my project again.
Resolution is simple. Open the "Android SDK Manager", update all packages and then restart your Android Studio. After that you project should compile without any issues.
It took me some time to resolve this.
Updated SDK Build-Tool [Didn't help]
Updated CMake [Didn't help]
Updated Android SDK Platform-Tools [Didn't help]
Updated Android SDK Tools [Didn't help]
Updated NDK [Problem solved]
There was a reason, I didn't want to update NDK. When all else failed, I updated NDK and that did the trick.
If your got timeout, Check Gradle Scripts -> gradle.properties in Android Studio, I found that I do have set a socket proxy in Android Studio settings, but in this gradle.properties file, my proxy became to http, so I just removed this http proxy setting lines, and finally works.
I got this problem on Android studio, there in either sync or build square were this link like blue text about this issue, press that button and it download something that fix this problem
I ran into the same issue, but then did the following, and my issue was resolved:
updated Gradle
installed the latest version of Android studio (mine was out of date)
And that solved my problem.
Note: It also helped me to click on the event log, because it has more detailed info about errors. https://developer.android.com/studio/releases/gradle-plugin#updating-plugin also has great info.
I've installed Android SDK Command-Line Tools from SDK Manager and after, juste Sync again and all is worked well.
it was hard to solve but i did it
look go to
C:\Users(user name)
delete .gradle file
its you didn't see it it may be in hidden files so if you use windows 7
right click then click on properties and click on hidden to be not checked
then the file will appear then delete it
i hope this works
It could be that you are using gradle in offline mode.
To uncheck it go to File > Settings > Gradle, uncheck the Offline Work checkbox, and click Apply
Make sure you have internet connection and sync the project again.
Its because the gradle is not synced because of many reasons.
Go to project folder and remove .gradle folder and start sync. It will work
Apparently, some platforms could be missing. This is how I solved the problem:
Do you see an error message that is shown at the bottom of your Android Studio window? It could be a smaller window on the bottom right also.., which looks like:
Now, Click on that blue link, do as the dialog boxes say (if any)...
That solved the problem. Hope it helps...
Download grade files from this url and extract all in a folder:
 https://gradle.org/releases
Open file -> Setting in windows OS or Preferences in mac OS and in "Build, Execution, Deployment"
Click on "Gradle"
Check “Use local cradle distribution” and give that extracted folder path.
Run gradle.bat for Windows OS and gradle file for mac OS in that folder.
Then check “Offline work”.
"your extracted folder path"/gradle-4.10.2/bin/.gradle (for version 4.1.2 you can set your version)
Press OK and enjoy it.
I had the exact same error message
Error running android: Gradle project sync failed. Please fix your project and try again
, but if none of the above fixes your error, then I would highly suggest for you to check your syntax inside the AndroidManifest.xml file.
That fixed if for me. I don't understand why the error-message is so misleading, since it had nothing to do with the build gradle directly.
Please also see this SO-answer here, which has lead many of us in the right direction.
It was yelling at me about a line in my xml file (which was perfectly valid and never had problems the entire time I've worked on the project). I deleted the line and even after running again and cleaning and rebuilding it kept yelling at me about the completely blank line. I restarted android studio and removed the .gradle folder and it finally worked. Hopefully someone in my shoes that had all of the other answers in this thread fail them will see this answer and save a few hours.
I had this problem (clicked a prompt to "sync with gradle" on my perfectly valid and working project and it killed everything) and I researched for hours trying to figure out how to fix this, including this thread among many others. I finally found my solution, so hopefully, it'll help somebody (and hopefully they fix this terrible system)
I encountered this in a unique situation: had refactored the word "time" to "distance" for one of my variables. And when I did the refactor, accidentally had it change the name of one of my gradle dependencies / implementations.
This is a rare cause of the error, but a possibility. So make sure all your dependencies are properly implemented in build.gradle
Delete .gradle folder(root directory) and build folder(project directory) and then invalidate caches/restart android studio, run your project again hopefully it will work. It might take some time for the background tasks. In some countries, you may need to turn on the VPN to download.

How to upgrade nuget packages if the installed version is missing?

Running into a situation where I deployed an application to production a few months ago and now I need to do some work on it, on an entirely new machine. The first I do is pull source and nuget restore won't restore because it can't find the particular version of the package it was developed under. When I check nuget.org for this package version it is not there. So how do I upgrade my solution to the latest binaries?
Visual Studio 2013 trying to update ServiceStack '4.0.39' to latest, which is '4.0.40' at the time of this post.
Thank you,
Stephen
The best solution I've come up with for this is to manually edit the Packages.config file(s) and set the version number to whatever you want. Restore should then work. It's not a perfect solution but it has dug me out of some holes.
(I know this is an old answer, but it just came up in some Googling)
One issue with the accepted answer (of just updating the version # in packages.config) is that this is just triggering a "package restore"--and will skip any "installation steps" the package might have (things that were done automatically when you first added the package, such as adding assembly references, modifying config files, etc.).
An alternative way would be to edit the packages.config and REMOVE the package in question from there---then start up VS and add the new version. This will trigger the package's usual install routine to do it's thing.
I recommend you to use the NuGet Package Manager Console of Visual Studio:
TOOLS > NuGet Package Manager > Package Manager Console
Command to update a NuGet package to the latest version:
Update-Package ServiceStack
Command to update a NuGet package to a specific version:
Update-Package ServiceStack -version 4.0.40

NuGet Package restore failed for project myProjectWeb: Unable to find version '3.0.1' of package 'AppForSharePoint16WebToolkit'

It's a provider hosted project. It used to work until very recently.
If I create a completely new project/solution, then it works.
If I start the old one, or redownload it from source control, I get the following error:
NuGet Package restore failed for project LocalTheaterWeb: Unable to find version '3.0.1' of package 'AppForSharePoint16WebToolkit'
I tried Update-Package -Reinstall but the problem stays.
Any ideas?
The solution of Scott Hillier did it for me:
http://www.shillier.com/archive/2014/08/05/nuget-package-restore-fails-for-sharepoint-2013-provider-hosted-apps.aspx
I often take advantage of the NuGet Package Restore capability to
reduce the size of my projects when saving or sharing them. Today, I
discovered an issue with this process when building SharePoint 2013
Provider-Hosted Apps against SharePoint Online. Here are the steps to
reproduce and the fix:
Create a Provider-Hosted App in Visual Studio 2013 using a SharePoint Online site for debugging.
Right click solution and "Enable NuGet Package Restore"
Save and Close Project
Delete the “packages” folder from project directory
Open Project in Visual Studio 2013
Rebuild, receive error “Unable to find AppForSharePoint16WebToolkit”
Open Packages.config file
Change “AppForSharePoint16WebToolkit” to “AppForSharePointWebToolkit”
Rebuild – successfully this time. Apparently, the "AppForSharePoint16WebToolkit" package is not available through the
NuGet Package Manager, but the older "AppForSharePointWebToolkit"
package is available.
The error message suggests that NuGet cannot find the AppForSharePoint16WebToolkit package in your package sources. So check the following:
The correct package source is selected whilst doing the Update-Package -Reinstall.
Check the package source that hosts the NuGet package is enabled. If you are using a recent version of NuGet the package restore should use all the enabled package sources.
See if the solution or project has its own NuGet.config which is overriding the package sources.
Without further information my guess is 3. since you say it works for a new project.
You can also run Fiddler to see what package sources NuGet is using as it tries to restore.
For older "locked down" projects with specific package version numbers that you can't update, un-check "Automatically check for missing packages during build in Visual Studio" which is found via:
Nuget Package Manager > Package Manager Settings
This means that if you toggle between newer projects and older projects you need to check and un-check this setting

Android studio isn't starting

I have installed an Android studio from here. It worked, i wrote a hello world project and then closed it. But the IDE does not start second time. It gives me an error "caches are locked".
I installed unlocker and it says that no process blocks this folder. Does anybody know where is the problem? Thanks in advance.
I also faced this problem. I have solve my problem as follows:
Go to folder where android-studio is installed. (C:\Program Files (x86)\Android\android-studio)
Now go back to previous folder. (C:\Program Files (x86)\Android)
Right click on the android-studio folder and go to properties.
Now in Properties window, go to Security Tab.
Click the Edit Button
Now, a new window will open, here you click the Users(your-username-or-your-group-name)
Now, from the List below, Check "Allow" in front of "Full control"
Now press "OK", then again "OK"..
Its done.. Now you can use Android Studio easily instead of Running it As Administrator every time..
For details please visit this page
If you're like me, you could be trying to start a version prior to 0.2.0 (in my case 0.1.6)
Following Google's notes here: http://developer.android.com/sdk/installing/studio.html
You'll need to remove and re-install Android Studio 0.2.0 & up
"Note: There is not a patch update available from 0.1.9 to 0.2. To update from Android Studio 0.1.x to 0.2.x, you must install a new Android Studio bundle from this page. The reason for that is that we have made changes to the bundled SDK such that it includes a pre-configured local Maven repository which can serve up the v4 support library and which is required for creating new projects."
Also be aware that if you have your Android SDK files stored here:
C:\Program Files (x86)\Android\android-studio\sdk
You should move them before the uninstall or you'll need to download the SDK files again.
After the un-install and re-install now working on my Windows 7 64-bit system

Manage NuGet Packages not visible on menu

Using Visual Studio 2012 Premium on Win 7 x64, I make a new project (an MVC 4 project). When right-clicking on the project, I see no 'Manage NuGet Packages' option. A packages folder exists in the solution directory, as does a package.config file in the project directory. When going to Tools, there is no Manage NuGet Packages option, either. When going to Tools->Extensions and Updates..., the NuGet Package Manager is installed and up to date.
Any idea why my project is unable to manage the NuGet packages for itself?
Here's a screenshot of the menu:
I had a similar problem. The problem was next:
I've installed NuGet Packager instead of NuGet Package Manager (from Extensions and Updates). Once I've installed the last one, it appeared in the context menu. Maybe you faced the same problem.
I had to uninstall the Nuget Package Manager from Extensions and Updates, and then reinstall it. After restarting Visual Studio, the missing menu entries appeared.
My solution came in the form of wiping out all traces of the NuGet Package Manager, including all registry files. Because the registry files have weird names, searching for things like NuGet.Core as well as just about anything in the Program Files\Microsoft Visual Studio\11.0\Common7\IDE\Extensions folder. After clearing those out, restarting the computer, reinstalling NuGet, and then restarting again seemed to clear up the issue.
First of all there are something's you should check
Make sure you are in debug mode
Make sure your not running the debugger
The 'NuGet Package Manager' is installed and not the 'NuGet
Packager'
Your project was created using the VS IDE - to check this, you can
simply create a new solution in VS and see that you are still
missing the 'Manage NuGet Packages' option in the menu.
Now if this issue still appears you can try taking the following steps:
Clean out your Extensions folder.
Extensions folder can be found
under the VS folder \Common7\IDE\Extensions. i.e. if vs2013 in 64
bit, then C:\Program Files (x86)\Microsoft Visual Studio
12.0\Common7\IDE\Extensions
Uninstall the NuGet Package Manager from Extensions and Updates
Restart VS
Install the NuGet Package Manager from Extensions and Updates
Hope this was helpful
Because of reasons, It seems that Nuget Package Manager was not installed on my fresh Visual Studio Professionnal 2013 edition.
Installing it fixed the problem.
You can also check your Extensions folder in [if vs2013 in 64 bit, then C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions]
Each extension has folder in here with manifest file extension.manifest, check these xml files - node "Name" and if found duplicate, remove duplicate folders, restart Visual Studio.
If there is same extension in different folder, VS is confused and will not load it...
In my case the project was running. When stopped, the menu items appeared.

Resources