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

Can't update support libraries and GooglePlay.Maps packages in my xamarin.android project

$
0
0

I am following a youtube tutorial for integrating PlacesApi in my Xamarin.android Project. I was using 28.0.0.1 version for support libraries and Android OS 8 (Oreo) as Target Framework and in the tutorial, it was required to update the support libraries to latest 28.0.0.3 and set the target Framework as Android 9 (Pie).

When I update all my packages and set the target framework to Android 9, I got tons of build errors. Even if I install the PlacesApi package, I can't reference it in any of my class. I know that these are compatibility issues but I have done almost everything like nuget-restore, deleting all the packages from Package Manager Console along with their dependencies but no luck. I am using mono.Android = 8.

Errors List:

1- The type or namespace name GoogleMap could not be found (are you missing a using directive or an assembly reference?) - Note that I have already import the google.maps using "using" directive at the top.

2- The Xamarin.Build.Download.XamarinBuildAndroidAarProguardConfigs task could not be loaded from the assembly C:\Users[Username][Project Path]\packages\Xamarin.Build.Download.0.4.11\build\Xamarin.Build.Download.dll. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

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


How to use ANRWatchDog with Xamarin.Forms

$
0
0

My app occasionally produces an ANR so I've installed the nuget package Xamarin.ANRWatchDog in the hope of finding where the issues are coming from but I'm having problems using the package so I'm hoping someone that has used it before can assist me.

I've installed the package, and started it as suggested in the ReadMe file new ANRWatchDog().Start(); (in OnCreate()). I've turned off the setting that ignores debugging (just so that I can test the package) by adding new ANRWatchDog().SetIgnoreDebugger(true).Start(); (in OnCreate()).

My hope was - running my app and getting it to hit a breakpoint, and then I was expecting some sort of listener to be fired as a result.

I'm not exactly sure what gets called during an ANR and where the stack trace can be found.

I've tried several things and cannot get it to work at all.

If someone has used this package, I would appreciate a helping hand getting this set up so that I can use it.

Cheers...

Automatically publish a NuGet package built with VS2017

$
0
0

New in Visual Studio 2017 is the ability to generate a NuGet package on build for some target types (namely, .NET Standard 2.0 which is what I'm using).

This works great, and the .nupkg file is generated on successful build.

However, I'm not able to figure out how to get the built package automatically published to our local repository.

I already tried a post-build event of:

nuget push -Source https://my.nuget.server/nuget/ "C:\Source\MyProject\bin\Release\MyProject.1.0.0.nupkg"

But this presents 2 problems:

  1. The name of the package includes the version number and this isn't available as a post-build event variable, so I can't say, for example, nuget push $(NugetPackage). I also can't figure out a combination of macros/variables that would get me the package name effectively.
  2. The automatic NuGet packaging process occurs after the post-build event, so at the time of post-build, the package has not even been generated yet!

Microsoft has provided this kick-ass automatic NuGet packaging, but no way to push it to a local repository (or so it seems)!

Has anyone gotten this to work? Am I missing something? Is there a workaround? Is this something being worked on?

VS2019 cannot load the project due to missing NuGet Microsoft.NET.Sdk.Functions package, but cannot add this package either

$
0
0

One of the projects I have in my solution is not loading in VSE2019. It throws this error:

C:\MyProgram\src\MyProgram.Functions.csproj : error  : The project file cannot be opened by the project system, because it is missing some critical imports or the referenced SDK cannot be found.
Detailed Information:
Unable to locate the .NET Core SDK. Check that it is installed and that the version specified in global.json (if any) matches the installed version.

The project was created by another Dev (who is not here), and the .csproj contains the following:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net472</TargetFramework>
    <AzureFunctionsVersion>v1</AzureFunctionsVersion>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.ApplicationInsights" Version="2.10.0" />
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.24" />
    <PackageReference Include="WindowsAzure.ServiceBus" Version="2.1.0" />
  </ItemGroup>
  <ItemGroup>
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="Microsoft.ServiceBus">
      <HintPath>..\packages\WindowsAzure.ServiceBus.2.1.0.0\lib\net40-full\Microsoft.ServiceBus.dll</HintPath>
    </Reference>
    <Reference Include="System.Configuration" />
    <Reference Include="System.Web" />
  </ItemGroup>
  <ItemGroup>
    <None Update="host.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="local.settings.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <CopyToPublishDirectory>Never</CopyToPublishDirectory>
    </None>
  </ItemGroup>
</Project>

Here are the following I have tried so far, but still with no positive results:

  1. I have commented out the line that refers to this package, and then reloaded the solution (even restarted VS2019):
<!-- <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.24" /> -->
  1. I tried to install the missing NuGet package, but since the project has not been loaded - I cannot install it into this project (as this project simply is not available in the available projects list, when installing NuGet).

I'm not sure why this project is getting so "stiky" to the package? Or how to force to install the missing NuGet to this project?

NuGet Package Manager Console returns InvalidOperation when trying to install the ZXing.Net library

$
0
0

I am trying to install the ZXing.Net library to VisualStudio 2019 to use in Unity but entering the command in the console returns a category of InvalidOperation

I just copy pasted the code right our of ZXing.Net in nuget.org but it returned this error:

PM> Install-Package ZXing.Net -Version 0.16.5

Install-Package : The current environment doesn't have a solution open.
At line:1 char:16
+ Install-Package <<<<  ZXing.Net -Version 0.16.5
    + CategoryInfo          : InvalidOperation: (:) [Install-Package], InvalidOperationException
    + FullyQualifiedErrorId : NuGetNoActiveSolution,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

How to instal jquery in .net core projet?

$
0
0

In VS2019 I created a .net core 3.0 project and from Tools>NuGet Package Manager>Manage NuGet Package.... installed jQuery 3.4.1 on my project.

Search and install it successfully but it doesn't copy any file on my lib or on my solution just added bellow line on .csproj file.

<PackageReference Include="jQuery" Version="3.4.1" />

How can I handle it?

c# Find a facebook profile from name, mobile number and city

$
0
0

I have installed the Facebook nuget package. I have a person name, mobile no, city detail with me, with this detail I want to get details from facebook like married status, education,birthdate or age, interests areas etc.

Can someone guide me how to achieve this ?

My own hosted NuGet server doesn't work properly anymore

$
0
0

I've hosted my own NuGet server, and it worked great for my libraries. In this case, I installed "NuGet.Server" package.

Recently, it doesn't work anymore and I can not push any version on it. When I've checked the issue, I found one of its dependencies which is "NuGet.Core", has been deprecated as it is legacy and is no longer maintained.

NuGet.Core

This package has been deprecated as it is legacy and is no longer maintained.

Additional Details

NuGet.Core is part of NuGet client v2 APIs. They have been replaced by NuGet client v3 and later APIs.

While installing "NuGet.Server" package, it still installing the deprecated package (NuGet.Core).

How do I host my own NuGet v3 server?

How to upgrade my existing NuGet servers to be v3 compatible?


How to get nuget package metadata via the API?

$
0
0

I am fairly new to the nuget side. So I might be missing something. I have a list of nuget packages in several of the solutions of my team. And I would like to get their metadata(only the latest version of each would suffice) for each one of them. I plan to run an API on each name of the package which will retrieve the data. This is the JS API which I am trying to run, but I believe something is missing.

https://api.nuget.org/v3/catalog0/${packageName}.json

https://stackoverflow.com/a/55386326/6630504 The answer here says that I need some {@id}. How do I get that? Is it required? What would be the end URL?

How to properly reference a library in nuget-based architecture

$
0
0

I'm trying to create couple nuget packages for internal company use: OurCompany.Infrastructure.Logging.Interfaces and just OurCompany.Infrastructure.Logging.

So I created two class library projects in the same solution, provided an implementation for OurCompany.Infrastructure.Logging.Interfaces and created a package.

Now I have a question: how to properly reference the OurCompany.Infrastructure.Logging.Interfaces library in OurCompany.Infrastructure.Logging project?

Should I add it as a nuget package or simply add as a project reference?

How to avoid update errors NU3018 in VS2019?

$
0
0

I want to update packages puts to each update I have the following error:

Severity Code Description Project File Line Delete Status Delete Status Error NU3018 Package 'jQuery 3.4.1' from source 'https://api.nuget.org/v3/index.json': Repository main signature found a string generation problem: A certificate chain has been processed but ended with a root certificate that is not trusted by the trust provider.

I tried with the console and as an adminstrator but still the same error

VS 2019 is looking for wrong assembly version of packages

$
0
0

I'm creating my first project using .Net Core but I'm having some issues getting two Nuget packages working probably.

When trying to debug the app, I get the following two errors:

Could not load file or assembly 'GalaSoft.MvvmLight, Version=5.4.1.0, Culture=neutral, PublicKeyToken=0ffbc31322e9d308'. The system cannot find the file specified.

Could not load file or assembly 'GongSolutions.WPF.DragDrop, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0ffbc31322e9d308'. The system cannot find the file specified.

Now, here's what it says for these packages under the solution explorer:

enter image description hereenter image description here

It's showing different versions than what the errors are showing. I searched through every file in my project and the only places I found the wrong versions showing was in my project's .deps.json file, which shows the following:

{
  "runtimeTarget": {
    "name": ".NETCoreApp,Version=v3.0",
    "signature": ""
  },
  "compilationOptions": {},
  "targets": {
    ".NETCoreApp,Version=v3.0": {
      "TestProject/1.0.0": {
        "dependencies": {
          "MvvmLightLibsStd10": "5.4.1.1",
          "gong-wpf-dragdrop": "2.1.0",
        },
        "runtime": {
          "TestProject.dll": {}
        }
      },
      "gong-wpf-dragdrop/2.1.0": {
        "runtime": {
          "lib/netcoreapp3.0/GongSolutions.WPF.DragDrop.dll": {
            "assemblyVersion": "2.0.0.0",
            "fileVersion": "2.1.0.2"
          }
        }
      },
      "MvvmLightLibsStd10/5.4.1.1": {
        "runtime": {
          "lib/netstandard1.0/GalaSoft.MvvmLight.dll": {
            "assemblyVersion": "5.4.1.0",
            "fileVersion": "5.4.1.0"
          }
        }
      },

I've tried changing the above to match the right versions, but it didn't change anything.

What else I've tried:

  • Uninstalling and Reinstalling the pacakages
  • Restarting Visual Studio

I did notice that the wrong packages do exist in other folders under: C:\Users\myname\.nuget\packages but they don't match the path that visual studio is showing me for the actual .dlls I'm using.

Some notes that might be useful:

The entire solution contains two projects: a WPF Windows Application which contains a single Window and a WPF Class Library, which has a UserControl hosted inside the wpf application project.

The Class Library is what contains the nuget packages.

Both projects are targeting .NET Core 3.0.

Update: I've tried putting the following inside a <PropertyGroup> tag in both my .csproj files:

<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>

None of them worked.

NuGet v4 contentFiles not getting copied to output

$
0
0

I'm having trouble with NuGet copying files to output, using NuGet v4 CLI.

My directory structure looks like this:

repo
repo\CodeAnalyzer.nuspec
repo\CodeAnalyzer.props
repo\contentFiles\any\any\StyleCop.ruleset

Here's my CodeAnalyzer.props file:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <PackageName>CodeAnalyzer</PackageName>
    <PackageVersion>0.1.0</PackageVersion>
  </PropertyGroup>
  <PropertyGroup>
      <CodeAnalysisRuleSet>StyleCop.ruleset</CodeAnalysisRuleSet>
  </PropertyGroup>
</Project>

And CodeAnalyzer.nuspec file:

<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
  <metadata>
    <id>CodeAnalyzer</id>
    <description>Provides standard code analyzer tooling and customisation.</description>
    <authors>Me</authors>
    <version>0.1.0</version>
    <dependencies>
      <dependency id="StyleCop.Analyzers" version="1.1.118" />
    </dependencies>
    <contentFiles>
      <files include="any/any/*" buildAction="Content" copyToOutput="true" flatten="false" />
    </contentFiles>
  </metadata>
  <files>
    <file src="contentFiles\any\any\StyleCop.ruleset" target="contentFiles" />
    <file src="CodeAnalyzer.props" target="build" />
  </files>
</package>

On CLI I am packing using:

.\nuget.exe pack .\CodeAnalyzer.nuspec

In the resulting .nupkg, there is a contentFiles directory with the StyleCop.ruleset file in, so that works.

If I then install the package in a project, it picks up on the StyleCop.Analyzers dependency fine, and it looks for the StyleCop.ruleset file, so the .props file is fine.

But the StyleCop.ruleset file isn't placed anywhere.

Feel like I've tried a lot of changing buildActions to None/Content, copyToOutput to true/false, different paths for the contentFiles.file element and the file.file element.

ASPNETCOMPILER error ASPCONFIG: Could not load file or assembly

$
0
0

I believe this is not the same question as this for a couple of reason

  1. There was no upgrading
  2. I tried doing the x86 and x64 build and that did not work
  3. The current versions of for newtorn.JSON are 4.5

First time working with TeamCity. The ASPNETCOMPILIER cannot load the assembly for 'Newtonsoft.json'

enter image description here

I do not know how to handle this. Some key points

  • NewtonSoft is in the packages folder
  • When restoring refences this could not be resolved enter image description here

Trouble installing AWS S3 C++ Sdk using nuget package manager

$
0
0

I want to install AWSSDKCPP-S3 using Nuget Package Manager but get error.

PM> Install-Package AWSSDKCPP-S3 -Version 1.6.20060301.25

Install-Package : Project 'Default' is not found.
At line:1 char:1
+ Install-Package AWSSDKCPP-S3 -Version 1.6.20060301.25
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Default:String) [Install-Package], ItemNotFoundException
    + FullyQualifiedErrorId : NuGetProjectNotFound,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

How to correctly specify version range for dependency..?

$
0
0

I'm creating an SDK and utilize Newtonsoft.Json. I want to allow any version of 11 and any version of 12, so I set my package ref like this:

<PackageReference Include="Newtonsoft.Json" Version="[11,13)" />

However, when I attempt to install my SDK into another existing solution, installation fails with the following error:

NU1603: MySampleSdk 0.0.1 depends on Newtonsoft.Json (>= 11.0.0 && < 13.0.0) but Newtonsoft.Json 11.0.0 was not found. An approximate best match of Newtonsoft.Json 11.0.1 was resolved.

Isn't 11.0.1 within >= 11.0.0 && < 13.0.0?

What am I missing here?

Updating Nuget caused Exception Unhandled: System.TypeLoadException

$
0
0

I'm starting a new master xamarin page for testing purposes and updated the nuget packages for the xamarin.android.support and xamarin.forms version. Afterwards, my program gets the exception:

The LoadApplication gets the exception error:

    base.OnCreate(savedInstanceState);
    global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
    LoadApplication(new App());


Unhandled Exception:

System.TypeLoadException: Could not load type of field 'Xamarin.Forms.Platform.Android.RendererPool:_freeRenderers' (0) due to: Could not resolve type with token 01000275 from typeref (expected class 'System.Collections.Generic.Stack`1' in assembly 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e') assembly:mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e type:System.Collections.Generic.Stack`1 member:(null) occurred

What is the reverse for Update-Database (used in Package Manager Console)?

$
0
0

I have been changing my domain classes and executed Update-Database in the Package Manager Console, After i realized that need to add an index and need to down-grade to the previous state. what is the proper command to down-grade one step in migration?

WiX installer should also add dependent assemblies (added by nuget packages) of the referenced project

$
0
0

I have a project (MyKafka) of type class library to which I have installed Confluent.Kafka package, which also adds dependent packages.

I have a WiX installer project that references the MyKafka project and includes the binary in the wxs file.

Now this nuget package does not include the assemblies into the WiX project, so I have to manually add the dll, but there are lot of other dependent assemblies placed in the packages folders under respective dependent package-folder named folders.

Is there a way that my WiX installer project could auto include all the packages of the referenced projects and the dependent packages?

edit projectFile.csproj after nuget package installed

$
0
0

I'm creating a package for nuget and I would like to edit the project.csproj file and replace some codes as part of the package installation process.

Can this be done with the nuspec file?

Or should you use a PowerShell script? If possible give an example with PowerShell

Viewing all 3154 articles
Browse latest View live


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