Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all 3156 articles
Browse latest View live

How to override nuget dependencies id in nuspec file

$
0
0

I have projectA and projectB in the same solution.

projectA creates its own package, but I override the package id by using a prefix:

<PackageIdPrefix></PackageIdPrefix><PackageId>$(PackageIdPrefix)$(MSBuildProjectName)</PackageId>

The command to generate the package is :

dotnet pack  .\$(ProjectName).csproj  --include-symbols --no-build -o C:\dev\UPP\Packages -p:PackageIdPrefix=MyPrefix."

Therefore the generated package name is MyPrefix.ProjectA.nupkg

projectB references projectA as a project reference since they belong to the same solution.projectB creates its own package, in the same way:

<PackageIdPrefix></PackageIdPrefix><PackageId>$(PackageIdPrefix)$(MSBuildProjectName)</PackageId>

However in the nuspec of the generated MyPrefix.ProjectB.nupkg I end with :

<dependency id="ProjectA" version="1.0.0" exclude="Build,Analyzers" />

So the prefix was not used to create the dependency in the nuspec. Obviously this leads to an error when I try to install this package since the dependency ProjectA does not exist...

How can I prefix the dependency ?


Is there a NuGet Package for compiling Sass to CSS (like NSass) in C# / ASP.NET? [closed]

$
0
0

in my C# ASP.NET project I'm getting Sass Code and need this to be compiled to CSS. I found the NSass.Core NuGet Package but it seems some kind of outdated (version 0.0.3, last updated 7/13/2013). At least sometimes it throws exceptions fot Sass Code which seems OK.

Is there maybe another NuGet Package for the same purpose which is up to date?

Install NuGet package from GitHub Package Registry

$
0
0

After a lot of trial and error I eventually got my NuGet package on the Github package registry with the following actions/commands:

  1. Go to GitHub
    • Click your avatar (top-right) → Settings → Developer settings → Personal access tokens
    • Generate a token with following scopes: write:packages, read:packages, delete:packages
    • This will automatically check the repo scope for your OAuth token
  2. Open cmd
    • Navigate to your project directory or the directory containing your NuGet package
    • Add a new nuget source
      • dotnet nuget add source --username [GithubUserName] --password [YourApiKey] --name github https://nuget.pkg.github.com/[UsernameOrOrganizationName]/index.json
    • Push the package to the github source
      • dotnet nuget push --source github bin\Release\MyAwesomePackage.1.0.0.nupkg

I can see my NuGet package on GitHub, so now I want to install it.

  1. I created a new project → Manage NuGet packages → Settings
  2. Add package source:

Now I should be able to install my package. But when I select my source and browse for packages, a GitHub login window pops up. And even when I login with my user account credentials, I still can't access my packages (pushed to an organization Github). Now when I use the NuGet package manager for my custom package source I always get the following error in the Output Window:

Error occurs while browsing for packages from custom GitHub source in NuGet package manager

[source-name] Failed to retrieve metadata from source 'https://nuget.pkg.github.com/[UsernameOrOrganizationname]/query?q=&skip=0&take=26&prerelease=true&semVerLevel=2.0.0'.  Response status code does not indicate success: 401 (Unauthorized).

The packages pushed to the GitHub registry should be public, and even with my user account I can't access them for installation. However they appear on my organization's GitHub page.Also the other users shouldn't have to add my personal GitHub package source, but rather the package should appear in some global GitHub feed inside the package manager, not?

What am I doing wrong?

Adding reference to another project from visual studio code

$
0
0

If a library (eg, on github) doesn't distribute itself via a nuget package, I'd have to manually include it as a reference, correct? I see a lot of reference posts for how to add a reference to a project for Visual Studio, but I can't seem to figure out how to do it on Visual Studio Code.

In this case, I've downloaded the library's zip, and moved the expanded folder into my project, and then tried using <namespace>, which did not work.

EDIT:

I noticed that this downloaded zip contained a .nuspec. Is there something I can do with this file extension to import it in my project?

Error code -532462766 when using FunctionMonkey

$
0
0

I'm trying to follow the "Build elegent REST APIs" for a project.

When I get to the section where you build and run it, I get the error:

Severity Code Description Project File Line Suppression State Error MSB3073 The command "dotnet "C:\Users\ext-patrik.ek.nuget\packages\functionmonkey.compiler\3.0.17\build\netstandard1.0....\tools\netcoreapp2.1/FunctionMonkey.Compiler.dll""C:\Users\ext-patrik.ek\source\repos\ServerlessHSAzureFunctions\ServerlessHSAzureFunctions\bin\Debug\netcoreapp2.1\bin\ServerlessHSAzureFunctions.dll" --netcore21" exited with code -532462766. ServerlessHSAzureFunctions C:\Users\ext-patrik.ek.nuget\packages\functionmonkey.compiler\3.0.17\build\netstandard1.0\FunctionMonkey.Compiler.targets 21

Now, I've been trying to find out what the issue is and when I open it up, it goes to the Function Monkey.Compiler.targets and highlight this set of code in an XML file:

<!-- we ensure the functions post build has run first --><!--<Target Name="_FunctionMonkeyCompiler" AfterTargets="Build">--><Target Name="_FunctionMonkeyCompiler" AfterTargets="_GenerateFunctionsPostBuild"><Exec Command="$(FunctionCompilerExe) $(FunctionCompilerParams)" /></Target>

So, My question is: What could be the issue here?

Several project nuget package. Unable to find package

$
0
0

I have to netstandard2.0 projects:

  1. projectA/src/client/client.csproj
  2. projectB/src/lib/lib.csproj

project A client reference project b lib like:

...<ItemGroup><ProjectReference Include="..\..\..\projectB\src\lib.csproj"><ReferenceOutputAssembly>true</ReferenceOutputAssembly><IncludeAssets>lib.dll</IncludeAssets></ProjectReference></ItemGroup><Target DependsOnTargets="ResolveReferences" Name="CopyProjectReferencesToPackage"><ItemGroup><BuildOutputInPackage Include="@(ReferenceCopyLocalPaths-&gt;WithMetadataValue('ReferenceSourceTarget', 'ProjectReference'))" /></ItemGroup></Target>...

I try to create nuget package: dotnet pack projectA/src/client.csproj --configuration Client

.nupkg contains lib.dll, but...

When I try to reference package to projectC I get projectC.csproj: [NU1101] Unable to find package projectB. No packages exist with this id in source(s): nuget.org

How to fix it?

The type or namespace name 'ApiController' could not be found - Nuget is installed

$
0
0

FrameWork : .Net Framework 4.7.2.

Web api project:After pull code from git (worked and compiled on a different local machine), and trying to build,getting:

**The type or namespace name 'ApiController' could not be found (are you missing a using directive or an assembly reference?)**

regarding all apiController inherited class attributes and keywords :ApiController, HttpPost, FromBody, etc.),

using System;using System.Collections.Generic;using System.Net.Http;using System.Web.Http;namespace POC_Book_Api.Controllers{    public class MyController : ApiController    {        [HttpPost]        public void Post([FromBody] SomeCollection items)

System.Web Assembly is referenced in the project References.Nuget Microsoft.AspNet.Api is installed and updated in the project.

What am I missing here ?

How to get custom nuget package list by programming?(.net core)

$
0
0

I can search for a package from an public nuget server feed and learn the version information. How do i access private nuget server package feeds. The code below gives an error on private nuget server feeds when working for public nuget server feeds. How do i get authorization or access?

SourceRepository repository = Repository.Factory.GetCoreV3(nugetSource);        PackageSearchResource resource = await repository.GetResourceAsync<PackageSearchResource>();        SearchFilter searchFilter = new SearchFilter(includePrerelease: true);        IEnumerable<IPackageSearchMetadata> results = await resource.SearchAsync("json",            searchFilter,            skip: 0,            take: 20,            logger,            cancellationToken);        foreach (IPackageSearchMetadata result in results)        {            Console.WriteLine($"Found package {result.Identity.Id} {result.Identity.Version}");        }

error inner exception : {"Response status code does not indicate success: 401 (Unauthorized)."}


Visual Studio and code not recognizing NuGet install packageI

$
0
0

I had a project that was written some time ago that utilized a few NuGet packages and was working great. Today I had to clone the repo to update it and noticed that the NuGet package that was working perfect was now had red lines stating it couldn’t find the packages. I looked at the installed packages via the NuGet manager and all appeared ok. I uninstalled the packages and reinstalled them. The packages reinstalled fine, but the using statements that were working still refuse to see the installed packages???

Has anyone experienced this and or have any idea what could cause this how to resolve?

Thanks

Not able to build/run default ASP.Net 3.1 core react redux app even though i installed dotnet-sdk-3.1.301-win-x64 and 16.6.2 visual studio

$
0
0

Package Microsoft.Extensions.FileProviders.Physical 3.1.5 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Package Microsoft.Extensions.FileProviders.Physical 3.1.5 does not support any target frameworks.Package Microsoft.Extensions.FileProviders.Abstractions 3.1.5 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Package Microsoft.Extensions.FileProviders.Abstractions 3.1.5 does not support any target frameworks.Package Microsoft.Extensions.FileSystemGlobbing 3.1.5 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Package Microsoft.Extensions.FileSystemGlobbing 3.1.5 does not support any target frameworks.Package Microsoft.Extensions.Logging.Console 3.1.5 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Package Microsoft.Extensions.Logging.Console 3.1.5 does not support any target frameworks.Package Microsoft.Extensions.Logging.Configuration 3.1.5 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Package Microsoft.Extensions.Logging.Configuration 3.1.5 does not support any target frameworks.Package Microsoft.Extensions.Options.ConfigurationExtensions 3.1.5 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Package Microsoft.Extensions.Options.ConfigurationExtensions 3.1.5 does not support any target frameworks.

How to debug code in a nuget package created by me

$
0
0

I have a nuget package I created and installed in another solution but now I need to debug de code of the package when called from my new solution.

I tried referencing the solution of the package but is not working.

I am using Visual Studio 2013.

Is there a way to view which package source an installed NuGet package is from, in Visual Studio?

$
0
0

In Visual Studio's NuGet Package Manager, you can view which NuGet packages have been installed in a solution by clicking the "Installed" tab in the package manager.

However, in situations where the same package is in multiple NuGet Package Sources, it would be useful to see which package source a particular NuGet package has come from. Is there a way to see this in the NuGet Package Manager, or any where else in VS?

Edit:Copying in my comment below for clarification:

I'm creating a project using a preexisting one as a model. Both projects will need to reference the same Nuget packages, so I open up the model project in Visual Studio, open the Nuget Package Manager, and look at its installed packages. The model project has "PackageA" installed. I open the new project, open the Nuget Package Manager for it, and Browse for "PackageA". I notice that "PackageA" is available in multiple Package Sources. (These are internal to my company, not nuget,org) In my new project, I'd like to install "PackageA" from the same Package Source as the model project

Xamarin forms: Version conflict detected for Xamarin.Android.Support.Compat

$
0
0

Getting below error in my visual studio.

Severity Code Description Project File Line Suppression State Error NU1107 Version conflict detected for Xamarin.Android.Support.Compat. Install/reference Xamarin.Android.Support.Compat 28.0.0.1 directly to project MyProject.Android to resolve this issue. MyProject.Android -> MyProject -> Xamarin.Essentials 1.2.0 -> Xamarin.Android.Support.Compat (>= 28.0.0.1) MyProject.Android -> Xamarin.Android.Support.Design 27.0.2.1 -> Xamarin.Android.Support.Compat (= 27.0.2.1).

I tried to install the Xamarin.Android.Support.Compat 28.0.0.1 to my android project. It also ended up with another error.

Severity Code Description Project File Line Suppression State Error NU1107 Version conflict detected for Xamarin.Android.Support.Core.Utils. Install/reference Xamarin.Android.Support.Core.Utils 28.0.0.1 directly to project MyProject.Android to resolve this issue. MyProject.Android -> MyProject -> Xamarin.Essentials 1.2.0 -> Xamarin.Android.Support.Core.Utils (>= 28.0.0.1) MyProject.Android -> Xamarin.Android.Support.Design 27.0.2.1 -> Xamarin.Android.Support.Core.Utils (= 27.0.2.1).

So I tried to install the Xamarin.Android.Support.Core.Utils 28.0.0.1 but it again redirects me to the first error. How can I fix this error, because of this error I can't add new Nuget packages to my project.

What does it mean when a .nuget package has no elements in a dependency group? What version of Microsoft.Charp do I need?

$
0
0

I'm trying to understand the dependency tree of the CSVHelper nuget package

Under dependencies it indicates it's dependencies by Framework. We're using .NETFramework4.5. Each of the dependencies is a nuget package reference and thus my understanding is the version indicated in the "Microsoft.Csharp (>= 4.5.0)" is saying that it depends on the nuget package versioned 4.5 which technically does not mean that the assembly itself (Microsoft.CSharp.dll" is v4.5.0.

Going to the link for Microsoft.CSharp and downloading the nuget package, the .net45 folders have no content. How do I know what version of the Microsoft.CSharp assembly CSVHelper is using?

From what I can tell, .net framework 4.5 installs v4.0.3.30319 of Microsoft.CSharp and not v4.5 like one might imagine. So its unclear to me whether the Microsoft.Csharp assembly installed with .net framework 4.5 is sufficient for use with CSVHelper. If not, we'd have to include the necessary assembly as part of our installation package; however, again there is no indication what version to use only a nuget package version with empty .net framework folders. There are folders for .net standard that I suppose could be used as long as we follow the .net framework .net standard compatibility chart

Any insight would be appreciated.

Anyo

Could not load file or assembly or one of its dependencies Microsoft.VisualStudio.Shell.Immutable.10.0, Version=10.0.0.0

$
0
0

After digging and digging everywhere I came back here.

The issue is the following: I need to setup on my local machine a website but I'm stuck here:

Could not load file or assembly 'Microsoft.VisualStudio.Shell.Immutable.10.0, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

I enabled assembly bind failure logging (Fusion) in .NET and the page when the site is loaded shows this:

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dllRunning under executable  c:\windows\system32\inetsrv\w3wp.exe--- A detailed error log follows. === Pre-bind state information ===LOG: DisplayName = Microsoft.VisualStudio.Shell.Immutable.10.0, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (Fully-specified)LOG: Appbase = file:///C:/x/y/z/t/Build/Instance/Website/LOG: Initial PrivatePath = C:\x\y\z\t\Build\Instance\Website\binCalling assembly : Microsoft.VisualStudio.Shell.10.0, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.===LOG: This bind starts in default load context.LOG: Using application configuration file: C:\x\y\z\t\Build\Instance\Website\web.configLOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.configLOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.LOG: Post-policy reference: Microsoft.VisualStudio.Shell.Immutable.10.0, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3aLOG: The same bind was seen before, and was failed with hr = 0x80070002.

I added the requested dll to gac:

gacutil -i Microsoft.VisualStudio.Shell.Immutable.10.0.dll

But still no results, as the gac adds the version 15.0.0.0

 Microsoft.VisualStudio.Shell.Immutable.10.0, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL

I can't find anywhere what references that specific version of dll. Any ideas what else I can do ?


An error occurred while trying to restore packages. Please try again

$
0
0

I am trying to restore the missing nuget packages and it keeps giving me this Error:

An error occurred while trying to restore packages. Please try again.

Any experience solving this?How can I find out what exactly is causing the error?

Submodule(Git) project is missing a restored NuGet package in a Visual Studio solution

$
0
0

I have a C++ console application in Visual Studio under Git, in which I have a submodule static library called LibrarySubmoduleSolution. This LibrarySubmoduleSolution uses Windows Implementation Library NuGet package.

After I download Git submodule in my VCPPConsoleApplicationSolution main solution and restore NuGet packages in the solution, I get these errors:

Severity Code Description Project File Line
Suppression State Error This project references NuGetpackage(s) that are missing on this computer. Use NuGet PackageRestore to download them. For more information, seehttp://go.microsoft.com/fwlink/?LinkID=322105. The missing file is..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets. LibrarySubmoduleSolution
D:\Projects\Tests\VCPPConsoleApplicationSolution\LibrarySubmoduleSolution\LibrarySubmoduleSolution\LibrarySubmoduleSolution.vcxproj166 Severity Code Description Project File Line
Suppression State Error C1083 Cannot open include file:'wil/resource.h': No such file or directory
VCPPConsoleApplicationSolution
D:\Projects\Tests\VCPPConsoleApplicationSolution\LibrarySubmoduleSolution\LibrarySubmoduleSolution\SomeClass.h3enter image description here

I searched for answers on Google and here on Stackoverflow and even after I edit my LibrarySubmoduleSolution.vcxproj file and change packages folder from ..\packages to $(SolutionDir)\packages:

<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /><ImportGroup Label="ExtensionTargets"><Import Project="$(SolutionDir)\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('$(SolutionDir)\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" /></ImportGroup><Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"><PropertyGroup><ErrorText>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 {0}.</ErrorText></PropertyGroup><Error Condition="!Exists('$(SolutionDir)\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" /></Target>

I still can't build with the error:

Severity Code Description Project File Line Suppression StateError C1083 Cannot open include file: 'wil/resource.h': No such fileordirectory VCPPConsoleApplicationSolution D:\Projects\Tests\VCPPConsoleApplicationSolution\LibrarySubmoduleSolution\LibrarySubmoduleSolution\SomeClass.h 3enter image description here

Only after I install Windows Implementation Library NuGet package in my main console application project, it starts to build without errors.

Here is main and submodule solutions to quickly reproduce errors:https://github.com/KulaGGin/VCPPConsoleApplicationSolutionhttps://github.com/KulaGGin/LibrarySubmoduleSolution

How to fix a missing NuGet package error?

$
0
0

I have a C++ console application in Visual Studio under Git, in which I have a submodule static library called LibrarySubmoduleSolution. This LibrarySubmoduleSolution uses Windows Implementation Library NuGet package.

After I download Git submodule in my VCPPConsoleApplicationSolution main solution and restore NuGet packages in the solution, I get these errors:

Severity Code Description Project File Line
Suppression State Error This project references NuGetpackage(s) that are missing on this computer. Use NuGet PackageRestore to download them. For more information, seehttp://go.microsoft.com/fwlink/?LinkID=322105. The missing file is..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets. LibrarySubmoduleSolution
D:\Projects\Tests\VCPPConsoleApplicationSolution\LibrarySubmoduleSolution\LibrarySubmoduleSolution\LibrarySubmoduleSolution.vcxproj166 Severity Code Description Project File Line
Suppression State Error C1083 Cannot open include file:'wil/resource.h': No such file or directory
VCPPConsoleApplicationSolution
D:\Projects\Tests\VCPPConsoleApplicationSolution\LibrarySubmoduleSolution\LibrarySubmoduleSolution\SomeClass.h3enter image description here

I searched for answers on Google and here on Stackoverflow and even after I edit my LibrarySubmoduleSolution.vcxproj file and change packages folder from ..\packages to $(SolutionDir)\packages:

<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /><ImportGroup Label="ExtensionTargets"><Import Project="$(SolutionDir)\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('$(SolutionDir)\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" /></ImportGroup><Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"><PropertyGroup><ErrorText>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 {0}.</ErrorText></PropertyGroup><Error Condition="!Exists('$(SolutionDir)\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" /></Target>

I still can't build with the error:

Severity Code Description Project File Line Suppression StateError C1083 Cannot open include file: 'wil/resource.h': No such fileordirectory VCPPConsoleApplicationSolution D:\Projects\Tests\VCPPConsoleApplicationSolution\LibrarySubmoduleSolution\LibrarySubmoduleSolution\SomeClass.h 3enter image description here

Only after I install Windows Implementation Library NuGet package in my main console application project, it starts to build without errors.

Here is main and submodule solutions to quickly reproduce errors:https://github.com/KulaGGin/VCPPConsoleApplicationSolutionhttps://github.com/KulaGGin/LibrarySubmoduleSolution

NuGet Package manager stuck on "Retrieving information..." on VS 2013

$
0
0

Using VS 2013 with NuGet Package Manager installed, I can view all Installed packages, but when I pick Updates or Online, I get an endless busy indicator showing "Retrieving information..."

I've verified I have a good connection. I uninstalled/reinstalled NuGet Package Manager.

Any other suggestions?

Thanks

How to make the Nuget restore work faster?

$
0
0

We are building CD pipeline using VSTS hosted build servers. It takes more than 3 minutes to restore Nuget. This is too much time.

How can I make it run faster? Is there any sort of caching system we can use?

Viewing all 3156 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>