I am using VSC for Unity v2019.4. I have the package from package manager installed. Also I have installed dotnet. The thing is that when I open VSC (through Unity) it shows in the output:
Attempted to update project that is not loaded: C:\workspaces\Unity\MyGame\Assembly-CSharp.csproj.
am able to use the editor, but the Intellisense is not working. I also have tried to change the omnisharp version to latest and it is still not working.
You can try a few things in order to make Visual Studio Code works properly with Unity.
First of all make sure that the editor package is installed in your project via Package Manager. Latest version should be installed.
Just to be sure it's better to close the project, delete Library folder and all .csproj and .sln files.
Then you can open your project in Unity again, wait it to load and try to remember to open scripts not by double clicking, but instead use right click in Project window and select Open C# Project. This will load the scripts without any issues.
In case anyone is still having this problem, try to install .net framework 4.7.1
Try uninstalling then reinstalling vs code and dotnet latest version. Also make sure vs code is installed in a folder with permissions to edit. If not it will not save any files until you run as admin
I am using FIle Utils plugin (https://marketplace.visualstudio.com/items?itemName=sleistner.vscode-fileutils) for Visual Studio Code.
When I try to >File Duplicate, Visual Code says "command 'fileutils.duplicateFile' not found".
I uninstall the plugin then re-install it, does not work.
I closed Visual Code, restarted mac, clear Visual Clear Editor History.
I still can not use the plugin to duplicate file or rename file.
Update VSCode to the latest version will fix the issue. I posted in File Utils github issue
For me following worked
Uninstall extension
Close VSCode
Open VSCode and install extension
Should start working
I downloaded Notepad++ from https://notepad-plus-plus.org/repository/7.x/7.5.1/npp.7.5.1.Installer.x64.exe.
And I installed the same. Now I need to install few plugins, but in the menu option Plugins there are only Converter and MIME tools listed, but not Plugin Manager.
Edit: They have removed Plugin Manager with the version 7.5. Still it can be added by following #johnny 's instruction in the best solution.
P.S: The plugin manager is only supporting the 32-bit version.
As of Notepad++ version 7.5, plugin manager is no longer shipped with Notepad++
From the Notepad++ release notes:
You may notice that Plugin Manager plugin has been removed from the official distribution. The reason is Plugin Manager contains the advertising in its dialog. I hate Ads in applications, and I ensure you that there was no, and there will never be Ads in Notepad++.
A built-in Plugin Manager is in progress, and I will do my best to ship it with Notepad++ ASAP.
If the above doesn't put you off, and you want to proceed and install the plugin manager anyway, it looks like there's a GitHub repository for nppPluginManager - though I haven't personally used it, so cannot comment on it's validity.
The nppPluginManager installation instructions state:
To install the plugin manager, simply download (links below) the .zip, and place the PluginManager.dll file in the Notepad++ plugins directory, and the gpup.exe in the updater directory under your Notepad++ program directory. (e.g. "C:\Program Files\Notepad++\updater")
In fact, if you prefer, you can just add the PluginManager.dll to the plugins directory, then do a reinstall of Plugin Manager from the plugin itself, which will place the file in the right place! Of course, if you're already using an earlier version of the plugin manager, you'll be able to just update from the update tab (or when you get the notification that the update has happened).
The GitHub repository also contains the latest release.
Follow the steps given below:
Download Plugin Manager from here.
You can find the most updated version in the release section in the Git repository:
Extract the contents of zip file under "C:\Program Files\Notepad++"
Restart Notepad++
That's it !!
To install a plugin without Plugin Manager:
Download your plugin and extract contents in a folder. You will find a .dll file inside. Copy it.
Open C:\Program Files (x86)\Notepad++\pluginsand paste the .dll
Run Notepad++
You can download the latest Plugin Manager version PluginManager_latest_version_x64.zip.
Unzip the file.
Copy
PluginManager_latest_version_x64.zip\updater\gpup.exe
into
path-to-installed-notepad\notepad++\updater\
Copy
PluginManager_latest_version_x64.zip\plugins\PluginManager.dll
into
path-to-installed-notepad\notepad++\plugins\
Start or restart Notepad++.
Enjoy!
The way to install plugins seems to have changed, the previous answers here did not work for me.
The current (checked with 7.8.1) way to install plugins is to install it in a sub folder:
The plugin (in the DLL form) should be placed in the plugins subfolder of the Notepad++ Install Folder, under the subfolder with the same name of plugin binary name without file extension. For example, if the plugin you want to install named myAwesomePlugin.dll, you should install it with the following path: %PROGRAMFILES(x86)%\Notepad++\plugins\myAwesomePlugin\myAwesomePlugin.dll
from https://npp-user-manual.org/docs/plugins/
So PluginManager.dll goes into PluginManager sub folder.
Notepad v7.6 includes a Plugin Admin and from this you can install Plugin Manager(note1) but it doesn't work fine with npp v7.6(note2)
On the other hand Plugin Admin is only available on NPP "Setup version" and after following conditions
on Custom installation, "Plugin Admin" checkbox is enabled
on Choose Components "Don't use %APPDATA%" checkbox is disabled
Plugin Admin will place plugins at C:\ProgramData\Notepad++\plugins
(note1)Installation from Plugin Admin is not complete and \updater\gpup.exe is missing
(note2) Plugin manager is not using new plugins path and folder structure; from version 7.6 npp Plugins will be stored in individual folders (having same name than file.dll)
If you want to use npp7.6 portable, you can copy updater folder from Setup version, copy plugins from Setup version, or copy Plugins from npp v<7.6 and place each one in a individual folder.
Latest version of Notepad++ got a new built-in plugin manager which works nicely.
My system was 32 bit. I removed and re-installed Notepad++. After that from below got PluginManager_v1.4.12_UNI.zip and extracted it.
https://github.com/bruderstein/nppPluginManager/releases
I created a folder called PluginManager at C:\Program Files (x86)\Notepad++\plugins\ and copied PluginManager.dll into it. I restarted my notepad++ and now I see Plugin Manager.
A direct process to install / configure Plugin Manager :
Download the latest version of NotepadPlus Plugin Manager from the
official Github handle.
Extract the zip file.
Copy the pluginmanager.dll file and paste in C:\Program Files\Notepad++\Plugins\PluginManager directory.
Restart the Notepad++
Note: Create the
PluginManager directory if it is not present.
Notepad++ v8.1.2 has it where it used to be
I changed the plugin folder name. Restart Notepad ++
It works now, a
It can be installed with one command for N++ installer version:
choco install notepadplusplus-nppPluginManager
I checked in a project on one computer, checked out on another, and find that the binaries installed by NuGet are missing. I could check them in to source control as well, but it looks like there's a better solution:
http://docs.nuget.org/docs/workflows/using-nuget-without-committing-packages
I followed those instructions, now have a .nuget folder where one should be, have the following entries in my .csproj file:
<RestorePackages>true</RestorePackages>
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
and yet when I rebuild my solution, the missing packages are not restored.
What am I missing? How can I diagnose this problem?
Note you can force package restore to execute by running the following commands in the nuget package manager console
Update-Package -Reinstall
Forces re-installation of everything in the solution.
Update-Package -Reinstall -ProjectName myProj
Forces re-installation of everything in the myProj project.
Note: This is the nuclear option. When using this command you may not get the same versions of the packages you have installed and that could be lead to issues. This is less likely to occur at a project level as opposed to the solution level.
You can use the -safe commandline parameter option to constrain upgrades to newer versions with the same Major and Minor version component. This option was added later and resolves some of the issues mentioned in the comments.
Update-Package -Reinstall -Safe
For others who stumble onto this post, read this.
NuGet 2.7+ introduced us to Automatic Package Restore. This is considered to be a much better approach for most applications as it does not tamper with the MSBuild process. Less headaches.
Some links to get you started:
The right way to restore NuGet packages
Migrate away from MSBuild-based NuGet package restore
Migrating MSBuild-Integrated solutions to use Automatic Package Restore
You have to choose one way of the following :
Re-installing a package by it's name in all solution's projects:
Update-Package –reinstall <packageName>
Re-installing a package by it's name and ignoring it's dependencies in all solution's projects:
Update-Package –reinstall <packageName> -ignoreDependencies
Re-installing a package by it's name in a project:
Update-Package –reinstall <packageName> <projectName>
Re-installing all packages in a specific project:
Update-Package -reinstall -ProjectName <projectName>
Re-installing all packages in a solution:
Update-Package -reinstall
Did you enable package restore mode in the project that has the missing packages/binaries ? There's a known issue that requires the packages to be correctly installed when enabling the restore mode :
http://nuget.codeplex.com/workitem/1879
Original link is dead; this might be a replacement: https://github.com/NuGet/Home/issues/1968
VS 2017
Tools>NuGet Package Manager>Package Manager Settings>General
Click on "Clear All NuGet Cache(s)"
I have run into this problem in two scenarios.
First, when I attempt to build my solution from the command line using msbuild.exe.
Secondly, when I attempt to build the sln and the containing projects on my build server using TFS and CI.
I get errors claiming that references are missing. When inspecting both my local build directory and the TFS server's I see that the /packages folder is not created, and the nuget packages are not copied over. Following the instructions listed in Alexandre's answer http://nuget.codeplex.com/workitem/1879 also did not work for me.
I've enabled Restore Packages via VS2010 and I have seen builds only work from within VS2010. Again, using msbuild fails.My workaround is probably totally invalid, but for my environment this got everything working from a command line build locally, as well as from a CI build in TFS.
I went into .\nuget and changed this line in the .nuget\NuGet.targets file:
from:
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" -o "$(PackagesDir)"</RestoreCommand>
to: (notice, without the quotes around the variables)
<RestoreCommand>$(NuGetCommand) install $(PackagesConfig) -source $(PackageSources) -o $(PackagesDir)</RestoreCommand>
I understand that if my directories have spaces in them, this will fail, but I don't have spaces in my directories and so this workaround got my builds to complete successfully...for the time being.
I will say that turning on diagnostic level logging in your build will help show what commands are being executed by msbuild. This is what led me to hacking the targets file temporarily.
If anything else didn't work, try:
Close Project.
Delete packages folder in your solution folder.
Open Project again and restore Nugget Packages again.
Worked for me and it's easy to try.
If none of the other answers work for you then try the following which was the only thing that worked for me:
Find your .csproj file and edit it in a text editor.
Find the <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> tag in your .csproj file and delete the whole block.
Re-install all packages in the solution:
Update-Package -reinstall
After this your nuget packages should be restored, i think this might be a fringe case that only occurs when you move your project to a different location.
Just for others that might run into this problem, I was able to resolve the issue by closing Visual Studio and reopening the project. When the project was loaded the packages were restored during the initialization phase.
For me, I had an empty tag NuGetPackageImportStamp in .csproj
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
It should ideally contain some valid GUID.
Removing this tag and then "Restore Nugets" worked for me.
In VS2017, right-click on the solution => Open CommandLine => Developer Command Line.
Once thats open, type in (and press enter after)
dotnet restore
That will restore any/all packages, and you get a nice console output of whats been done...
None of the other solutions worked in my situation:
AspNetCore dependencies had been installed/uninstalled and were being cached. 'AspNetCore.All' would refuse to properly update/reinstall/remove. And regardless of what i did, it would use the cached dependencies (that it was not compatible with), because they were a higher version.
Backup Everything. Note the list of Dependencies you'll need to reinstall, Exit VisualStudio
Open up all .proj files in a text editor and remove all PackageReference
In each project, delete the bin, obj folders
Delete any "packages" folders you find in the solution.
Open solution, go into Tools > Nuget Package Manager > Package Manager
Settings and Clear all Nuget caches. Check the console because it may
fail to remove some items - copy the folder path and exit visual
studio.
Delete anything from that folder Reopen solution and start
installing nuget packages again from scratch.
If that still doesn't work, repeat but also search your drive in windows explorer for nuget and delete anything cachey looking.
Sometimes something strange happens and using Visual Studio to automatically restore doesn't work. In that case you can use the NuGet Package Manager Console. That is opened within Visual Studio from Tools -> NuGet Package Manager -> Package Manager Console. The commands within the console are simple. And to get context help while typing a command just press the button and it will give you all options that start with the letters you're typing. So if a package isn't installed, for example log4net, type the following command:
Install-Package log4net
You can do a whole lot more, like specify the version to install, update a package, uninstall a package, etc.
I had to use the console to help me when Visual Studio was acting like a weirdo.
Automatic Package Restore will fail for any of the following reasons:
You did not remove the NuGet.exe and NuGet.targets files from the solution's .nuget folder (which can be found in your solution root folder)
You did not enable automatic package restore from the Tools >> Options >> Nuget Package Manager >> General settings.
You forgot to manually remove references in all your projects to the Nuget.targets file
You need to restart Visual Studio (make sure the process is killed from your task manager before starting up again).
The following article outlines in more detail how to go about points 1-3:
https://docs.nuget.org/consume/package-restore/migrating-to-automatic-package-restore
I had NuGet packages breaking after I did a System Restore on my system, backing it up about two days. (The NuGet packages had been installed in the meantime.) To fix it, I had to go to the .nuget\packages folder in my user profile, find the packages, and delete them. Only then would Visual Studio pull the packages down fresh and properly add them as references.
The best workaround that I found creating a new Project from scratch,
then import all the source files with the code.
My project was not so complicated so I had no problem from there.
I experienced this problem recently as well. The usual 'dotnet restore' and 'Update-Package -reinstall' didn't help.
I looked at the .csproj file and found that the values for these packages were inconsistent. Some were pointing to <solutiondir>\packages and some were <projectdir>\packages.
I made them all point to the same place (I believe that was to <projectdir>\packages) and then I was able to restore the NuGet packages.
I'm not sure how the .csproj file ended up pointing to two different places. Maybe from starting out in Visual Studio 2017 (or earlier) and then moving to Visual Studio 2019? Or different settings used by different programmers? I really don't know.
vs2015 no enable nuget restore problem.
My solution:
add folder .nuget, add file NuGet.Config and NuGet.targets in Directory .nuget
each project file add:
build
<RestorePackages>true</RestorePackages>
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
If the error you are facing is "unable to connect to remote server" as was mine, then it would benefit you to have this check as well in addition to the checks provided in the above comments.
I saw that there were 2 NUGET Package Sources from which the packages could be downloaded (within Tools->Nuget Package Manager->Packager Manager Settings). One of the Package Source's was not functioning and Nuget was trying to download from that source only.
Things fell into place once I changed the package source to download from: https://www.nuget.org/api/v2/ EXPLICTLY in the settings
In my case, an aborted Nuget restore-attempt had corrupted one of the packages.configfiles in the solution. I did not discover this before checking my git working tree. After reverting the changes in the file, Nuget restore was working again.
There is a shortcut to make Nuget restore work.
Make sure internet connection or Nuget urls are proper in VS Tools options menu
Look at .nuget or nuget folder in the solution, else - copy from any to get nuget.exe
DELETE packages folders, if exists
Open the Package manager console execute this command
paste full path of nuget.exe RESTORE full path of .sln file!
use Install-pacakge command, if build did not get through for any missing references.
The same problem I encountered but what solved my problem was to go to Nuget Package Manager (rightclick to the prj > select Manage Nugget Packages) and uninstall and install again the packages that are having issues.
BUT there are some packages having dependencies to other packages, so what I did was to uninstall the dependencies first and then followed by the nuget package that I wanted to uninstall and re-install.
You can find out if the nuget has dependencies when you tried to uninstall it and then visit the Output window, there will be a line saying that the nuget failed to uninstall because of its dependencies, and those dependencies are also listed there.
I know this is an old thread but it was the first search result today (in 2022) for "nuget package restore canceled". This is the message I got in VS when trying to rebuild a solution at my new job.
I've been in the new job for a few weeks and the build worked up to now.
The package source used by my solution is xxxxPackages, where xxxx is the name of my employer. So the package source is not nuget.org, which I normally use.
Occasionally, a message was appearing in VS saying:
"TF30063: You are not authorized to access xxxxdev.visualstudio.com."
Despite this, I had xxxxdev.visualstudio.com open in my browser and was able to work in it.
I tried many of the suggestions here. Then, chatting to a colleague, it turned out that my VS login had gone stale. In Visual Studio, I clicked on my icon in the top right and selected 'account settings'. There was an exclamation mark indicating that I had to refresh the login to my work account on visualstudio.com, using my xxxx email address.
Once I had done this the problem went away.
I hope this saves others the hassle I had this morning.