I'm developing an Nuget Package. I have icon.png placed inside Images folder inside my package code. In my .csproj file I have added required tags related to icon. But still icon is not getting displayed. Instead default blue icon is displayed in Nuget.
Here is my .csproj file,
<PropertyGroup>
<PackageIcon>icon.png</PackageIcon>
</PropertyGroup>
<ItemGroup>
<None Include="Images\icon.png" Pack="true" PackagePath=""/>
</ItemGroup>
Am I missing anything? please assist.
Currently, displaying the icon by using the <PackageIcon/> or <icon/> property on packages showed on NuGet in Visual Studio is not supported. You can preview your package icon in the upload preview in https://nuget.org
The tracking issue for supporting embedded icons in NuGet for Visual Studio is: https://github.com/NuGet/Home/issues/8189
Related
Is it possible to switch back to packages.config scheme of things? I moved to PackageReference scheme when I created the project, but for some reasons need to move to old way of things now.
I have tried Package Manager Console commands like restore with Update and Reinstall options. They do not generate packages.config anymore. I also switched Tools > Options > NuGet Package Manager to packages.config. No good.
You'll need to:
Add an "empty" packages.config file to the project (that is, xml as in the example but without individual <package> elements)
Unload the project or close vs and open the csproj file in a text editor.
Remove all PackageReference elements out of the project file.
Make sure that <RestoreProjectStyle> is not set in the project file.
Reopen the project in VS.
There was one step missing for me:
4.5. Make sure that Tools>Options>NuGet Package Manager>General>Default package management format is set to Packages.config
Wanted to add one more thing. I tried all above steps and Visual Studio kept trying to use the global-packages location, instead of repositoryPath from Nuget.config. Finally found that there was a package-lock.json file in the obj dir of my projects that had the global package dir stored in it. For some reason the Clean operation, in Visual Studio, didn't delete the file, so I wound up doing a
git clean -x -d -f
At the root of my repository. Which deletes all un-tracked files and directores, and ignores the patterns the .gitignore file. It was a bit excessive, I could have tried to find them all by hand, but it got the job done. Now Nuget restore properly uses the repositoryPath setting specified in the Nuget.Config file.
How I made it work:
Take of screenshot of the packages we use in this project
Add an "empty" packages.config file to the project and copy this into it:
<?xml version="1.0" encoding="utf-8"?>
<packages>
</packages>
Unload the project and open the csproj file in a text editor.
Remove all PackageReference elements out of the project file.
Make sure that <RestoreProjectStyle> is not set in the project file.
Make sure that:
Tools >
Options>
NuGet Package Manager >
General>
Default package management format is set to Packages.config
Delete the obj folder in the project
Use the screenshot to re-download the packages again
I am trying to install the Active Directory Authentication Library in Linqpad Nuget manager and I am getting the path/location too long message:
I have attempted to change the install location by adding a setting for repository path to the LinqPad.nuget.config, which now looks like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="repositoryPath" value="C:\Ng" />
</config>
</configuration>
However, the packages are still being installed in the user/appdata folder.
How can I fix this?
You can now, from version v5.06.05 (in beta at time of writing).
Go to LINQPad's NuGet package manager and click Settings, then Advanced.
In 2021 and with Linqpad 6 you can change the path for local packages by adding a system variable "NUGET_PACKAGES" with value set to whatever path you like.
I had the same issue with my LINQPad 5 (v5.44.02).
All the Nuget packages you download from LINQPad will be saved/stored in some folder on your computer. By default, these packages will be saved in the %LocalAppData%\LINQPad\NuGet.FW46 folder.
NuGet Settings -> Advanced
If you happen to have a long username then sometimes the file path of the package you are going to download will exceed the maximum limit.
I was able to fix this issue by updating this folder to a location something like "E:LP_Nuget". This actually reduced the file path length, and I was succesfully able to download the packages. With this change, all your LINQPad NuGet package will now be downloaded to this new folder.
Open LINQPad NuGet Manager
Ctrl + Shift + P
Click on the "Settings" button at the bottom left corner.
Select the "Advanced" tab and you should be able to see/change the NuGet package folder location.
Update this to a folder which has short file path. For instance, something like "C:\LINQPad_Packages".
We use a custom location for our packages folder which we specify in a nuget.config file in the same folder as our solution:
<settings>
<repositoryPath>..\..\lib\packages</repositoryPath>
</settings>
Visual Studio 2013 picks this up fine and the NuGet package manager installs packages into the specified folder, lists installed packages correctly, etc.
In Visual Studio 2015 RC the NuGet package manager pops up the "Some packages are missing from this solution, click here to restore" message and if I click the button it creates a new packages folder in the same folder as the solution rather than using the location specified in the nuget.config. Installing a completely new package also puts it into a packages folder under the solution folder rather than the specified one.
How do I get Visual Studio 2015 RC to respect the repository path specified in the nuget.config?
Make sure your nuget.config is configured like this:
<configuration>
<config>
<add key="repositoryPath" value="..\..\lib\packages" />
</config>
</configuration>
I filed this bug with NuGet: https://github.com/NuGet/Home/issues/626
A fix has been made but I'm not sure when it will be released.
I am writing a website in VS2015 using the ASP.NET Preview template. Unfortunately, Dropbox has added a bunch of .dropbox.attr files in each folder of my project, which the Solution Explorer is displaying:
Note that I have not added them to the project manually, (they are not referenced in my Web.xproj,) and I do not have "Show All Files" selected. I have already added them to my .gitignore. There is no "Remove" option when selecting the file:
Lastly, I have tried adding them to my project.json's exclude section:
...
"publishExclude": [
"node_modules",
"bower_components",
"**.xproj",
"**.user",
"**.vspscc",
".dropbox.attr"
],
"exclude": [
"wwwroot",
"node_modules",
"bower_components",
".dropbox.attr"
]
...
Is there any way to get all files with this name to not appear in my Solution Explorer?
I'm not sure exactly of the interaction between VS2015 and the new project structure, so it could be a result of any of those factors.
You can modify the .xproj file of your project and add the following to exclude folders:
<ItemGroup>
<DnxInvisibleFolder Include="wwwroot\jspm_packages\" />
<DnxInvisibleFolder Include="wwwroot\node_modules\" />
<DnxInvisibleContent Include="wwwroot\tsd.json" />
</ItemGroup>
You can use DnxInvisibleFolder for folders and DnxInvisibleContent for files.
Some folders (like node_modules) have sometimes thousands of folders/files which seem to pose a major problem for VS2015 to scan and load.
In a DNX project in visual Studio 2015 the solution explorer does not use the project.json to determine what is shown. The "exclude" properties in project.json are used by dnx to determine which folders/files should be excluded from compilation or publishing but this does not affect Visual Studio's solution explorer.
Generally speaking "everything" is shown but that isn't exactly true as VS excludes certain folders (such as .git, .vs, artifacts, etc). It also adds back others (i.e. bower components is excluded by default from compilation but VS adds it back as a meta folder under dependencies). The "filter" for Solution Explorer is not exposed to the user so it can't be edited or changed by configuration file.
Your best bet would be to request via user voice that some method of configuration be added. Really the functionality is already there it just needs to be made customizable by the user.
With the latest Visual Studio you just need to right-click the folder/file and chose "Hide from Solution Explorer".
That will change the "xproj" this way like Corneliu wrote before:
<ItemGroup>
<DnxInvisibleFolder Include="wwwroot\" />
</ItemGroup>
How do I enable the nuget package restore feature in Visual Studio 2015?
The feature is just missing in my context menu (Yes - I've double checked that I try it on the solution instead of a project)
My only project is a .NET 4.5 console application - there is no .nuget folder yet. There is an actual nuget package installed.
I had the same problem as you and the way I solved it was to delete the packages folder from my solution and also bin and obj folders from every project in the solution and give it a rebuild.
As it turns out, the real solution is to migrate to Automatic Package Restore. We experienced issues with NuGet after upgrading to VS 2015 after working in 2013 for a while. Turns out the old way of doing NuGet completely hoses the new way of doing it.
The solution is simple, though tedious. Apparently the NuGet.targets file signals VS to use the old NuGet way of doing things, and it's absence means that you are now using "Automatic Package Restore". You can migrate to Automatic Package Restore by following these steps:
Delete .nuget/NuGet.exe
Delete .nuget/NuGet.targets
For each project:
Unload the project
Right click -> Edit the project
Delete all references to the NuGet.targets file, i.e. the following:
<RestorePackages>true</RestorePackages>
...
<Import Project="$(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>
There is also a powershell script that will perform the migration for you, if you are feeling bold. You can find it on github.
For others this option is available in the Nuget settings section in Visual Studio Options
I had problem with restoring package with error 401 unauthorised. I found the solution by unchecking available local package sources.
Debug > Options > NuGet Package Manager > Package Sources
Only allow nuget.org packages
My Visual Studio 2015 Professional was installed using the default settings. The options for "Allow NuGet to download missing packages" and "Automatically check for missing packages during build in Visual Studio" were already checked by default, but I still could not download the packages. I was getting an error that a package version could not be found.
I needed to click a checkbox under Tools > Options > NuGet Package Manager > Package Sources to enable NuGet Package Restore to work as expected.
I had a problem with accessing the packages folder after starting Visual Studio 2015 in Administrator mode, so I deleted it with the intention of performing a restore.
But no restore was performed when rebuilding the solution, and there was no Restore Packages to be found at the solution level or in the Nuget window.
However, if you right-click the References nodes on the projects in the solution, there is a Restore Packages option. Running this on all projects fixed it for me.
enter image description here
Well it is pretty simple with VS2015, all i had to do was to right click on my project solution and click on restore nuget.