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

How to prevent the release pipeline in VSTS from creating nuget.org packages

$
0
0

I created a build and release pipeline for my NuGet package using VSTS.

But after running the build and release pipeline successfully, the feed includes the nuget.org reference which was added. How can I prevent this?


publish a nuget package from a copy

$
0
0

It seems my team mates have turned off their nuget server and gone on holidays. I need a temporary work around so that my Azure Dev Ops build does not fail when restoring the nuget packages.

I have a local copy of the package at

C:\Users\kirst.nuget\packages\mypackagetemp

Which I want to publish to a temporary feed.

I read the instructions on publishing a package from the command line but am confused about step 6 Surely I dont need to set up the Project and restore packages as I already have the .nupkg

I tried the command

c:\nuget\nuget.exe push -Source "TempFeed" -ApiKey az mypackagetemp.nupkg

but got an error

unable to load the service index for source https://pkgs.dev.azure.com/mycompany/myproject/_packageing/TempFeed/nuget/v3/index.json

When I repeat the command I get a request for credentials When I put in the credentials I connect to Azure Dev Ops with they do not work.

[Update]

I was prompted for credentials.. reading up on it... so confusing.

[Update]

I upgraded nuget.exe from 5.1.0.6013 to the latest version 5.4.0.6315 This time I got a UI to log in and the message

Your package was pushed

However when the devops pipeline build runs I het a message

unable to load the service index for source
https://pkgs.dev.azure.com/mycompany/myproject/_packageing/TempFeed/nuget/v3/index.json

I guess I need to create an index.json file somehow.

My project is using a mynuget.config that has the following in the packagesources

<add key="TempPackage" value="https://pkgs.dev.azure.com/mycompany/_packaging/myfeed/nuget" />

[Update]

I changed mynuget.config to have

<add key="TempPackage" value="https://pkgs.dev.azure.com/mycompany/_packaging/myfeed/nuget/v3/index.json" />

Now the dev ops build shows the message

Failed to retrieve information about 'Serilog.Enrichers.Thread' from remote source 'https://pkgs.dev.azure.com/mycompany/_packaging/myfeed/nuget/FindPackagesById()?id="Serilog.Enrichers.Thread'', response status code does not indicate success: 404 (Not Found).)

My solution does use Serilog. I don't think the 3rd party package uses it.

[Update]

The next time I built I got a different error looking for WindowsAzure.Storage

I seem to get a different file causing the error each time I build the pipeline.

My project artifacts does have 2 feeds. The needed files are in the unselected feed.

[Update]

I tried editing mynuget.config to use index.json however I get a build error

The nuget command failed with exit code(1) and error(Unable to load the service index for source https://pkgs.dev.azure.com/mycompany/_packaging/myfeed/nuget/v3/index.json. Response status code does not indicate success: 404 (Not Found - The feed with ID 'MyFeed' doesn't exist

[Update]

Because the new feed was project based I edited mynuget.config to have

<add key="TempPackage" value="https://pkgs.dev.azure.com/mycompany/myproject/_packaging/myfeed/nuget/v3/index.json" />

Now it works!

Can't use my installed NuGet package in code

$
0
0

I have installed NuGet package Miracle.FileZilla.Api in my VS project, but when I try to include it in my code via directive "using" VS says there's no namespace "Miracle". How do I fix it? Thanks.

nuget dll is used by another process

$
0
0

I have the error from below and I'm quite out of ideas how to solve it. Tried the following until now:

  1. Clean bin/obj/packages/packages cache
  2. Remove manually from csproj and packages files the package and add it afterwards..still error
  3. Update Visual Studio 2017
  4. Reinstall Visual Studio 2017
  5. Trace which processes are using a file with name that contains Newtonsoft
  6. Copy the solution from another laptop where the builds works just fine

Yet, after all from above, I still get:

Error       NuGet Package restore failed for project DriversApp.Android: Unable to find version '10.0.3' of package 'Newtonsoft.Json'.
  C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Newtonsoft.Json.10.0.3' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
  https://api.nuget.org/v3/index.json: Error downloading 'Newtonsoft.Json.10.0.3' from 'https://api.nuget.org/v3-flatcontainer/newtonsoft.json/10.0.3/newtonsoft.json.10.0.3.nupkg'.
  The process cannot access the file 'C:\Users\user\.nuget\packages\newtonsoft.json\10.0.3\lib\netstandard1.0\Newtonsoft.Json.dll' because it is being used by another process.
. Please see Error List window for detailed warnings and errors.                

How to get this solved? I got really stuck on this one...

Adding EF Core to a NET Standard project introduces transitive dependency versions incompatible with NuGet packages in other projects

$
0
0

I have a solution with multiple .NET Standard 2.0 projects.

One Project A uses the Google.Protobuf (3.11.2) NuGet package, that depends on

System.Memory (4.5.3)
    System.Buffers (4.4.0)
    System.Numerics.Vectors (4.4.0)
    System.Runtime.CompilerServices.Unsafe (4.5.2)

A few other projects also depend on System.Memory and all use the same dependency versions.

Another Project B uses Microsoft.EntityFrameworkCore (3.1.0) NuGet package that depends on

System.Memory (4.5.3)
    System.Buffers (4.5.0)
    System.Numerics.Vectors (4.5.0)
    System.Runtime.CompilerServices.Unsafe (4.7.0)

Even though the System.Memory version is (4.5.3) in both cases, it depends on System.Buffers, System.Numerics.Vectors and System.Runtime.CompilerServices.Unsafe and their versions differ.

When I run the application that uses these projects I get:

System.IO.FileLoadException: 'Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.

After searching for a solution I added this to my NuGet.Config:

<config>
    <add key="DependencyVersion" value="Highest" />
  </config>

In both, %appdata%\Nuget and in the root folder of the .sln file.

I also deleted the %userprofile%\.nuget\packages folder.

Then I removed the NuGet packages from the projects and added them back again, but their dependacies come with the same versions as before.

If I navigate to "Manage NuGet Packages for Solution..." in Visual Studio and choose "Consolidate" it just says "No packages found"

Nuget Hell: Cannot reference NuGet package in UWP application due to public key difference

$
0
0

I have a UWP app and a bunch of NETStandard 2.0 libraries. The libraries contains a lot of logic and communication interfaces that I am using in ASP.NetCore and Desktop WPF applications, so I am not going to change them.

I use NuGet packages in the libraries so I could reference those in NetCore and NetFramework projects as well. I would like to reference these packages in the UWP project - cause this is the whole point of this standardization concept isn't it?

For the UWP project this does not work. I have the latest Nuget package of System.ServiceModel.Primitives which is 4.5.3 (DLL version 4.5.0.3 - don't ask why) and PublicKeyToken is b03f5f7f11d50a3a - this can be referenced in every project except UWP.

Regardless of every attempt: - I have installed the Nuget package for the project - I have referenced the version explicitly in the CSPROJ file - I have removed every other reference to SDK file version

But still, the UWP project looks for the dll in

C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.netcore.universalwindowsplatform\6.2.8\ref\uap10.0.15138\System.ServiceModel.Primitives.dll

That DLL has version of 4.2.1.1 and the PublicKeyToken is cc7b13ffcd2ddd51

Because the two tokens are different - binding redirects does not work - or maybe I am missing something. Does anyone have a workaround for this?

The whole solution is in VS2019 and I have the latest Win10 SDK installed 10.0.18362.1.

Thank you in advance.

EDIT: I forgot to mention, I have a repro on GitHub

Font Awesome Icon not working in .NET/MVC Application

$
0
0

Kind of simple as the title says but I'm struggling with the steps. I downloaded font-awesome from Nuget Package Manager and added it to my project.

enter image description here

I also added the the font-awesome css in my bundle config file:

bundles.Add(new StyleBundle("~/Content/css").Include(
                      "~/Content/bootstrap.css",
                      "~/Content/site.css",
                      "~/Content/font-awesome.min.css"));

Content/CSS is loaded on my main layout page, which all subsequent pages inherit from.

<meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@ViewBag.Title - My ASP.NET Application</title>
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")

But trying to use the icons in a button form:

<a href="@Url.Action("Edit", "Story", new { id = Model.Id })" class="btn btn-primary">
                    <i class="fas fa-adjust"></i>
                    Edit Story
</a>

enter image description here

Results in nothing showing up. What am I missing in the steps?

How to package Universal Windows Class Library to a private NuGet feed using AzureDevOps?

$
0
0

I have a Universal Windows Class Library containing xaml styles I want to reuse in multiple projects.

So I want to package it into a NuGet package and I can't find any doc that explain how to do it using AzureDevOps pipelines.

I've already found a way to package .NET Standard library to my private NuGet feed so this part is already working.

I just can't figure out how to write a Yaml file that can describe it to an AzureDevOps Pipeline

I found this link : https://docs.microsoft.com/en-us/nuget/guides/create-uwp-packages But it's for UWP Windows Runtime component not Universal Windows Class Library :/


Visual Studio C++ 2009 nuget package manager licurl "unresolved external"

$
0
0

Visual Studio C++ 2009 comes with NuGet package manager that allows the download of libcurl (as an example). After downloading, availability of libcurl is observed through Project >> Properties >> Referenced Packages.

enter image description here

The user-defined C++ project then compiles fine using in particular <curl/curl.h> as header. However, "unresolved external" persist at link time (libcurl primitives are not found). At this point, this seems "logical" and understandable. From this post, pointing the right libcurl.lib file from the project is required. Here are the two derived actions: Project >> Properties >> Linker >> General >> Additional Library Directories -> tell the project where to find the appropriate libcurl.lib file (for instance, x64/debug version choosing between all the stuff downloaded by NuGet).

enter image description here

Next, Project >> Properties >> Linker >> Input >> Additional Dependencies -> tell the project the file name, say libcurl.lib, where the missing primitives are located.

enter image description here

Note that I don't manage the dependencies (libssh2, openssl and zlib) of libcurl.lib itself (I hope that NuGet did something for me?).

The problem is: "unresolved external" still persist at compilation time? I showed on StackOverflow posts that explain how to integrate libcurl in VS but most methods are raw procedures. Taking advantage of NuGet, the procedure (above descried) is intended to be as seamless as possible? However, it fails...

MANY THANKS IN ADVANCE FOR ANY HIGHLIGHT/HELP!!

TFS 2015 Build: NuGet restore from an internal repository [duplicate]

$
0
0

We have set up an internal NuGet server and added that server into the package manager settings to publish our dependencies to our local dev machines. Now we want to use the new TFS 2015 Build system to build our solution.

at the start of the build NuGet.exe restore is called passing in the solution file as seen in the log file:

C:\Program Files\Microsoft Team Foundation Server 14.0\Build\agent\worker\tools\NuGet.exe` restore "D:\TfsData\Build\_work\a8a26a03\Source Code...etc\mySolution.sln" -NonInteractive

next line in the log is the error

##[error]Unable to find version '1.0.0.5' of package 'com.bmico.models.lookup'

Which is a package on my internal server?

How do I tell TFS Build 2015 to use my internal package repository as well as the publicly available one?

Only create Nuget package if project has changed

$
0
0

Given a solution containing both a Web Api project, an Api Client Project, and an assembly project containing shared Dto objects as follows:

  • Solution
    • Web Api Project
    • Shared Dto Project
    • Api Client Project
    • Unit Tests

I have an Azure Devops build pipeline to build and test all of the projects. Within that build pipeline, I have a step that creates 2 Nuget packages for the Api Client and the Shared Dto projects.

However, I don't need to create new packages all of the time, say I only added a unit test or fixed a bug in the Web Api project, I don't want to create new Nuget packages (or worry about bumping the Package version) if nothing in the Api Client Project (or its dependencies) has changed, but I do still want to regression test it.

I thought that perhaps I could do this by having multiple build pipelines, one for the Web Api project, and others for the Api Client & Shared projects, then use path filters to trigger the appropriate builds.

Are there any other ways to achieve this? Whats the best practice? I don't want to have to maintain more build definitions than I need.

Xamarin.Forms and iBeacons

$
0
0

Could anyone suggest me a Xamarin NuGet package to monitor iBeacons?

I have tried Plugin.BLE to scan for beacons. Is there a way to monitor the proximity of beacon?

CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file

$
0
0

net migrating from java in selfstudy mode.(visual studio 2019 community & SqlServer 2017 64bit community edition installed). I was following the instructions on this tutorial link

When I executed the step of initial migration step I encountered this error when i run update-database I'm encountering this error. I know its related to database access/ configuration problem I'd really appreciate the correct way to provide it to Package Manager Console.

I've added the allow service to interact with desktop permission in the service of SQL server. As well as went through the settings of nuget Package manager settings including SQL server tools where I didnt find any setting to add of test connection.

CREATE FILE encountered operating system error 5(Access is denied.) while >attempting to open or create the physical file >'C:\Users\userRazorPagesMovieContext-f0053713-d1d4-4b1b-b07a->c77d6dfaf131.mdf'. CREATE DATABASE failed. Some file names listed could not be created. Check >related errors.

Build error, NuGet refrence package error

$
0
0

Severity Code Description Project File Line Suppression State Error 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 ..\packages\Xamarin.Android.Support.Annotations.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.Annotations.targets. WoWonder D:\Compressed\wowonderandroid-162\codecanyon-19034167-wowonder-android-messenger-mobile-application-for-wowonder\Messnger_v1.6.2\WoWonder_Messenger\WoWonder.csproj 1064

How to PS Move-Item with inheritance enabled?

$
0
0

I'm moving NuGet packages to may local network folder with this command

move-Item xyz.nupkg -Dest $env:nugetsDir

I have a problem in that the file is not inheriting permission from destination folder and my friend is getting "access denied" error when trying to use my package. The problem is NOT occurring when and move the file manually, with mouse.


Package Newtonsoft.Json, version 12.0.2 was not found. It might have been deleted since NuGet restore- in dotnet core 3.1.100

$
0
0

i have working on asp.net core application.suddenly it throws below error . i have try to restore nuget packages and restarted the machines .All of them failed and getting with below error.

enter image description here

version: enter image description hereenter image description here

Be able to find the NuGget package to install from https://docs.microsoft.com/en-us/dotnet/api

$
0
0

I'm trying to build a console project (.NetCore 3.1) to run the matrix multiplication example.

The issue is the following with VS2109

  • using System.Windows.Media; (VS2019 suggest me to remove the ".Media")

Just by looking at the Microsoft documentation on the web, can you explain how can I find the package to use.

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?

Deploy WPF Application with squirrel.windows and no windows 10 entry in Program & Features

$
0
0

The goal is to deploy with squirrel.windows, to can install, update, uninstall and to see it in Program & Features in Windows 10. To have add the end also a MyApp.msi file would be a plus.

Case 1: I created a NugetPackage with the Nuget Package Explorer. Than releasify it over the Package Manager Console "squirrel --releasify myNuget.1.0.0.nupkg", get the release files, click setup.exe to install and the icon of the app appears in the windows menu.

In the Windows Program & Features it doesn't appear in the list of installed Applications.

The update is working when I deploy a next nugetPackage of my app. It creates a myApp.msi file which is nice.

Case 2: When I use the Squirrel App on GitHub "https://github.com/Squirrel/Squirrel.Windows" it shows it. - Super.

The update is not working when I deploy a next nugetPackage of my app. It creates not a myApp.msi file.

With the small testApp it is working with absolutely the same code, but also no myApp.msi file. The difference is that it uses DevExpress Dll's and it has 54 Dll's in the production app. There are 13 Dll's in myTestApp.

Install & Update Code

public static async Task CheckForUpdates()
{
    using (var mgr = new UpdateManager(DEPLOYMENT_PATH))
    {
        // Note, in most of these scenarios, the app exits after this method
        // completes!
        SquirrelAwareApp.HandleEvents(
            onInitialInstall: v => mgr.CreateShortcutForThisExe(),
            onAppUpdate: v => mgr.CreateShortcutForThisExe(),
            onAppUninstall: v => mgr.RemoveShortcutForThisExe(),
            onFirstRun: () => ShowTheWelcomeWizard = true);
    }
}

public static bool ShowTheWelcomeWizard { get; set; }

Please help me to reach my goal.

Greetings Fredy

Is there a nuget.exe command-line equivalent of Uninstall-Package?

$
0
0

I'm working on a NuGet package that installs a bunch of content - views, scripts, CSS files - into a web application, and trying to improve the change-compile-test cycle. I have two projects - the framework itself ("Package") and the demo web app that consumes it ("Website")

What I need to do as part of the Visual Studio build process is:

  1. (as part of Package post-build) Nuget pack Package.nuspec -OutputDirectory ..\pkg\
  2. (as part of Website pre-build) Nuget uninstall Package
  3. (as part of Website pre-build) Nuget install package -source ..\pkg\

The problem is - there doesn't seem to be any command-line equivalent of doing Uninstall-Package from the NuGet Package Manager console. Am I missing something?

Viewing all 3186 articles
Browse latest View live


Latest Images

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