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

Manually setup a NuGet package

$
0
0

I wanted to use Window.Forms, in particular charts within .Net 5.Therefore, I manually downloaded "system.windows.forms.datavisualization.1.0.0-prerelease.20110.1.nupkg" from the NuGet website, which is still a prerelease.I applied Tools > NuGet Package Manager > Package Manager Settings > Package Sources to setup the new path, where I saved the nupkg file.Unfortunately, trying to finally install the package via the Solution explorer > Managing NuGet Packages > Browse, the nupkg file will not be found.


Fody - System.Security.SecurityException: Invalid assembly public key

$
0
0

I just tried adding a Fody NuGet package to my C# project and now anytime I try to build I get the following error.

error MSB4018: The "ResolveAssemblyReference" task failed unexpectedly.error MSB4018: System.Security.SecurityException: Invalid assembly public key. (Exception from HRESULT: 0x8013141E)error MSB4018:    at System.Reflection.AssemblyName.nToString()error MSB4018:    at System.Reflection.AssemblyName.get_FullName()error MSB4018:    at Microsoft.Build.Tasks.ReferenceTable.MarkReferencesForExclusion(Dictionary`2 exclusionList)error MSB4018:    at Microsoft.Build.Tasks.ResolveAssemblyReference.Execute(FileExists fileExists, DirectoryExists directoryExists, GetDirectories getDirectories, GetAssemblyName getAssemblyName, GetAssemblyMetadata getAssemblyMetadata, GetRegistrySubKeyNames getRegistrySubKeyNames, GetRegistrySubKeyDefaultValue getRegistrySubKeyDefaultValue, GetLastWriteTime getLastWriteTime, GetAssemblyRuntimeVersion getRuntimeVersion, OpenBaseKey openBaseKey, GetAssemblyPathInGac getAssemblyPathInGac, IsWinMDFile isWinMDFile, ReadMachineTypeFromPEHeader readMachineTypeFromPEHeader)error MSB4018:    at Microsoft.Build.Tasks.ResolveAssemblyReference.Execute()error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()error MSB4018: The Zone of the assembly that failed was:error MSB4018: MyComputer

I've tried uninstalling and re-installing, different add-ins/weavers. It always ends up with the same result. My solution has two projects, a .NET Standard 2.0 library and a .NET Framework 4.6.1 class library containing unit tests. The Standard library builds but the unit test project is the one failing.

Install nuget windows forms package for using chart in .Net 5

$
0
0

Using vs 2019, I locally installed the NuGet package "system.windows.forms.datavisualization.1.0.0-prerelease.20110.1.nupkg" from Microsoft to use the Windows Forms chart function under .NET 5.The Solution explorer > Manage NutGet packages shows that it's successfully installed. Also dependencies indicates that the package is installed.When trying to use now the a chart, the toolbox doesn't show any chart options under "Data". Why couldn't I find the "chart function" although the package is successfully installed and shows no errors or warnings .. ?enter image description here

CrossFirebasePushNotification.Current.RegisterForPushNotifications(); throwing NullReference iOS

$
0
0

to do push notifications in my Xamarin Forms App, I am using the CrossGeeks FirebasePushNotification Plugin. My android setup is working alright, but for the iOS app, when I try to run the app, the line

CrossFirebasePushNotification.Current.RegisterForPushNotifications();

is causing a NullReference Exception. What I have done to set up:

  • Set "FirebaseAppDelegateProxyEnabled" to "No"
  • Changed the GoogleService plist to Bundle Resource
  • Added the FirebasePushNotificationManager.Initialize(options, true); in the App Delegate (and it is saying it is unreachable?"

How would I solve this problem? In the documentation, it states that these are the steps needed for iOS setup.

System.Data.SqlClient Package is installed but isnt recognized as a Using statement in Xamarin Forms app

$
0
0

Like the title says, I've installed both the System and Microsoft .Data.SqlClient SQL packages, and my code only recognizes the Microsoft one, but it doesn't recognize the using System.Data.SqlClient; statement. I've done this process before successfully in a console app, but in the XamForms app it doesn't work. As a result, I cannot use the SqlConnection or SqlCommand or SqlDataReader objects which make it a tad bit difficult to make a SQL database app if ya know what I mean.

I want to put my "login" to my SQL server in a separate file so that I can change them easily should I decide to launch this app publicly. My best guess is that I have to do this in a specific part of the XamForms app, but I don't know where if there is a specific spot. For the time being however, I would just like to get the .Data.SqlClient working regardless of where I put it.

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

dotnet restore with private nuget server fails in docker-compose

$
0
0

The dotnet restore step is failing only from docker-compose, and only when I use a private nuget server in addition to the public server. It seems to be looking on my private server for public packages, and then it times out. I get this error:

#15 101.5   The HTTP request to 'GET http://my-nuget/Shared/nuget/FindPackagesById()?id='Microsoft.EntityFrameworkCore.Design'&semVerLevel=2.0.0' has timed out after 100000ms.

I don't have the problem when I run dotnet restore manually, without it being in docker. I have the problem on two projects that both use the private and public nuget servers. Another project only uses the public server, and it works with no problem (and it does not have a nuget.config).

My nuget.config is:

<configuration><packageSources><add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /><add key="USAS" value="http://my-nuget/Shared/nuget" /></packageSources></configuration>

If I remove my private server I get errors for the three package that use the private server, but I don't get the errors for the public packages.

Include my Nuget README in my Nuget Package

$
0
0

I maintain a few tiny Nuget Packages.

I have a Nuget README file in the git repository, and the .nupkg file is auto-built by VS, based on the "Package" config, stored in the .csproj file.

Whenever I need to release a new versio of the package, I upload the .nupkg file to nuget, in the web UI, and then it asks me for any documentation, at which point I have to manually upload the README file.

Is there any way to put that README file in the .nupkg so that I don't have to manually upload it every time?


How to include tags in NuGet package using CLI only

$
0
0

I want to add Tags for a nuget package.I do NOT want to use a separate .nuspec file (maintenance), I'm only using the csproj for packing.

I've tried setting it using nuget pack -Properties Tags=demo but that doesn't seem to work..?

I'm trying to solve a bigger problem to create some traceabilityusing the commit id from the build in the tags? (on VSTS using Build.SourceVersion)

References:

Is it safe and fine if we add .Net Core packages inside asp.net projects

$
0
0

I am working on developing a remote event receiver for a SharePoint online site, and the remote event receiver is mainly an Asp.NET Web service project.. but to be able to integrate it with Azure Key vault, I need to add those packages inside my visual studio project:-

Install-Package Azure.CoreInstall-Package Azure.Security.KeyVault.SecretsInstall-Package Azure.Identity

so is it fine if we reference the Azure.Core inside asp.net web application project? i tired this and the project worked well.. but might i get into troubles? or this is supported operation?

Why can't I add my NuGet package to my app in Visual Studio?

$
0
0

I'm using Visual Studio for Mac on macOS Big Sur (11.2.3) to try to create a cross-platform NuGet package encapsulating common logic to be added to some Xamarin.Forms mobile apps.

I begin by creating a new solution and choosing Multiplatform -> Library -> Multiplatform Library. Under Target Platforms: I check the boxes for both iOS and Android. Under Implementation: I check Platform specific.

I add the platform-specific code to the iOS and Android projects, and shared code to the Shared directory, with no problem. The NuGet package builds without error.

But when I try to add the package to one of the Xamarin.Forms apps, VS raises the error Could not add packages and writes this to the package console:

Package <my package name> 1.0.0 is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Package <my package name> 1.0.0 supports:  - monoandroid11.0 (MonoAndroid,Version=v11.0)  - xamarinios10 (Xamarin.iOS,Version=v1.0)

I did try adding <TargetFramework>netstandard2.0</TargetFramework> to the .csproj files in the library projects, but that caused an explosion of errors that made it clear that was the wrong approach.

This is outside my existing expertise, and I'm at the end of my limited understanding. How do I build/modify this package so that it can be added to a mobile app solution?

EntityFramework.Core.Tools nuget package installation error: "The process cannot access the file ef.exe because it is being used by another process"

$
0
0

While installing the package Microsoft.EntityFrameworkCore.Tools for using EF in my project using Nuget, I'm persistently running into the below error. Notice I didn't get any error while installing other related packages used for EF core

  • Microsoft.EntityFrameworkCore
  • Microsoft.EntityFrameworkCore.Relational
  • Microsoft.EntityFrameworkCore.SqlServer

Microsoft.EntityFrameworkCore.Tools.Error

Here is the location of the file ef.exe

EF.Core.exe

Basically the intention behind installing this package is to use EF command-line tools. I'm currently on Windows 10 and the .NET SDK installed on my machine is 3.1. I had previously 2 SDK's installed on my system(3.1 & 5.0). As per microsoft's documentaion, "The .NET CLI must choose an SDK version for every dotnet command. It uses the latest SDK installed on the machine by default." Therefore I went ahead and uninstalled .NET 5.0 SDK

Dot.Net.Core.SDK.version

Here are some of the solutions that I tried:

  1. Deleting the package folder from '.nuget/packages/microsoft.entityframeworkcore.tools'& thereby the executable i.e. 'ef.exe' and reinstalling the same.
  2. Installing the same package using dotnet cli.
  3. Running Visual Studio 2019 as admin.
  4. Deleted the folder "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions"

I have also tried some of the steps mentioned here on github: https://github.com/NuGet/Home/issues/1138. Any kind of help would be really appreciated.

Github Actions: Push nuget xamarin.forms package

$
0
0

I'm trying to configure a GitHub action that builds my multi-target Xamarin.Forms plugin and pushes the package to GitHub and NuGet. Pushing the package to GitHub and NuGet shouldn't be much of a problem anymore. I'm having trouble with building my multi-targeted nuget package on the GitHub CI.

First I had the following GitHub action:

name: .NET Coreon:  push:    branches: [ master ]  pull_request:    branches: [ master ]jobs:  build:    runs-on: ubuntu-latest    steps:    - name: Checkout      uses: actions/checkout@v2    - name: Setup .NET Core      uses: actions/setup-dotnet@v1.5.0      with:        dotnet-version: 3.1.301        # Authenticates packages to push to GPR        source-url: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json      env:        NUGET_AUTH_TOKEN: '%NUGET_AUTH_TOKEN%'    - name: Install dependencies      run: dotnet restore    - name: Build      run: dotnet build --configuration Release --no-restore    - name: Test      run: dotnet test --no-restore --verbosity normal    - name: Pack      run: dotnet pack --no-build --configuration Release MintPlayer.MVVM/MintPlayer.MVVM.csproj --output .    - name: PushNuget      run: dotnet nuget push *.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.PUBLISH_TO_NUGET_ORG }} --skip-duplicate    - name: PushGithub      #run: dotnet nuget push *.nupkg --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --api-key ${{ github.token }} --no-symbols --skip-duplicate      run: dotnet nuget push *.nupkg --no-symbols --skip-duplicate      env:        NUGET_AUTH_TOKEN: ${{ github.token }}

and also the following nuget.config in my solution root, to let the action know about the nuget source to download the required NuGet packages:

<?xml version="1.0" encoding="utf-8"?><configuration><packageSources><add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /></packageSources></configuration>

When pushing this configuration to my GitHub repository, I'm getting the following errors at the Build stage:

/Users/runner/work/MintPlayer.MVVM/MintPlayer.MVVM/Demo/MintPlayer.MVVM.Demo/MintPlayer.MVVM.Demo.UWP/MintPlayer.MVVM.Demo.UWP.csproj(175,3): error MSB4019: The imported project "/Users/runner/hostedtoolcache/dncs/3.1.301/x64/sdk/3.1.301/Microsoft/WindowsXaml/v16.0/Microsoft.Windows.UI.Xaml.CSharp.targets" was not found. Confirm that the expression in the Import declaration "/Users/runner/hostedtoolcache/dncs/3.1.301/x64/sdk/3.1.301//Microsoft/WindowsXaml/v16.0/Microsoft.Windows.UI.Xaml.CSharp.targets" is correct, and that the file exists on disk./Users/runner/work/MintPlayer.MVVM/MintPlayer.MVVM/Demo/MintPlayer.MVVM.Demo/MintPlayer.MVVM.Demo.iOS/MintPlayer.MVVM.Demo.iOS.csproj(140,3): error MSB4019: The imported project "/Users/runner/hostedtoolcache/dncs/3.1.301/x64/sdk/3.1.301/Xamarin/iOS/Xamarin.iOS.CSharp.targets" was not found. Confirm that the expression in the Import declaration "/Users/runner/hostedtoolcache/dncs/3.1.301/x64/sdk/3.1.301//Xamarin/iOS/Xamarin.iOS.CSharp.targets" is correct, and that the file exists on disk./Users/runner/work/MintPlayer.MVVM/MintPlayer.MVVM/Demo/MintPlayer.MVVM.Demo/MintPlayer.MVVM.Demo.Android/MintPlayer.MVVM.Demo.Android.csproj(101,3): error MSB4019: The imported project "/Users/runner/hostedtoolcache/dncs/3.1.301/x64/sdk/3.1.301/Xamarin/Android/Xamarin.Android.CSharp.targets" was not found. Confirm that the expression in the Import declaration "/Users/runner/hostedtoolcache/dncs/3.1.301/x64/sdk/3.1.301//Xamarin/Android/Xamarin.Android.CSharp.targets" is correct, and that the file exists on disk.

I then modified my workflow to use msbuild instead (at least until the build stage:

name: .NET Coreon:  push:    branches: [ master ]  pull_request:    branches: [ master ]jobs:  build:    runs-on: macos-latest    steps:    - name: Checkout      uses: actions/checkout@v2    - name: Setup .NET Core      uses: actions/setup-dotnet@v1.5.0      with:        dotnet-version: 3.1.301        # Authenticates packages to push to GPR        source-url: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json      env:        NUGET_AUTH_TOKEN: '%NUGET_AUTH_TOKEN%'    - name: Install dependencies      #run: dotnet restore      #env:      #  NUGET_AUTH_TOKEN: ${{ github.token }}      run: msbuild /t:restore    - name: Build      #run: dotnet build --configuration Release --no-restore      run: msbuild Library/MintPlayer.MVVM/MintPlayer.MVVM.csproj /p:Configuration=Release /p:RestorePackages=false    - name: Test      run: dotnet test --no-restore --verbosity normal    - name: Pack      run: dotnet pack --no-build --configuration Release MintPlayer.MVVM/MintPlayer.MVVM.csproj --output .    - name: PushNuget      run: dotnet nuget push *.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.PUBLISH_TO_NUGET_ORG }} --skip-duplicate    - name: PushGithub      #run: dotnet nuget push *.nupkg --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --api-key ${{ github.token }} --no-symbols --skip-duplicate      run: dotnet nuget push *.nupkg --no-symbols --skip-duplicate      env:        NUGET_AUTH_TOKEN: ${{ github.token }}

But it's still not working.

The console in Github actions prints the following error between the tons of text:

/Users/runner/.nuget/packages/msbuild.sdk.extras/2.1.2/Build/LanguageTargets/CheckMissing.targets(44,5): error : The specified language targets for uap10.0.16299 is missing. Ensure correct tooling is installed for 'uap'. Missing: '/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/xbuild/Microsoft/WindowsXaml/v16.0/Microsoft.Windows.UI.Xaml.CSharp.targets' [/Users/runner/work/MintPlayer.MVVM/MintPlayer.MVVM/Library/MintPlayer.MVVM/MintPlayer.MVVM.csproj]

So this probably means that the UWP tools aren't available on macos. From the output I can see that the android build succeeds, the iOS build succeeds, but the UWP build fails with the former message.

How can I build a Xamarin.Forms package in GitHub CI and push it to my nuget sources?

Edit:

Alright, I modified my workflow to use Windows and MSBuild instead of macos and dotnet, and this brings me a lot closer.

name: .NET Coreon:  push:    branches: [ master ]  pull_request:    branches: [ master ]jobs:  build:    runs-on: windows-latest    steps:    - name: Checkout      uses: actions/checkout@v2    - name: Setup .NET Core      uses: actions/setup-dotnet@v1.5.0      with:        dotnet-version: 3.1.301        # Authenticates packages to push to GPR        source-url: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json      env:        NUGET_AUTH_TOKEN: '%NUGET_AUTH_TOKEN%'    # Add  MsBuild to the PATH: https://github.com/microsoft/setup-msbuild    - name: Setup MSBuild.exe      uses: microsoft/setup-msbuild@v1.0.1    - name: Install dependencies      run: msbuild /t:restore      env:        NUGET_AUTH_TOKEN: ${{ github.token }}    - name: Build      run: msbuild Library/MintPlayer.MVVM/MintPlayer.MVVM.csproj /p:Configuration=Release /p:RestorePackages=false /p:OutputPath=../..    - name: PushNuget      run: dotnet nuget push *.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.PUBLISH_TO_NUGET_ORG }} --skip-duplicate    - name: PushGithub      run: dotnet nuget push *.nupkg --no-symbols --skip-duplicate      env:        NUGET_AUTH_TOKEN: ${{ github.token }}

This action successfully pushes my nuget package to both Nuget and Github, but when I install this package in a Xamarin.Forms project, I'm only getting the UWP classes available in all of the projects, whilst these should only be available in the UWP-targetting project.

Unlike when I right-click my multi-targetting project and click the Pack command, the package does in fact work fine. Does anyone know how I can fix this?

Problem with scaffolding in VisualStudio 2019 ASP.Net Core 5.0

$
0
0

When I try to scaffold the files for Identity in ASP.Net I get an error message.

I have seen the answers to previous questions like this. And all my packages are up to date. I don't know what I'm doing wrong.

I have tried putting all other packages to 5.0.2, that did nothing.

This is the error message I get.

ErrorMessage

My Installed packages.

InstalledPackages

The update tab.

UpdateTab

Microsoft.SqlServer.Types exception on my dev machine

$
0
0

In my team, a dev recently updated our project to use EF6.All my colleagues can run the projet whitout problems, but in my machine, I'm getting the error:

"Spatial types and functions are not available for this provider because the assembly 'Microsoft.SqlServer.Types' version 10 or higher could not be found."

This package is not even being used in the project, no one of my team even has the dll in the project.

I cant seem to find out what is wrong with this.

Can anyone help me?

Using Visual Studio 19.6.3 and SQL Server Microsoft SQL Server 2016 (RTM) - 13.0.1601.5 (X64) Apr 29 2016 23:23:58 Copyright (c) Microsoft Corporation Enterprise Edition: Core-based Licensing (64-bit) on Windows Server 2012 Standard 6.2 (Build 9200: ) (Hypervisor)


NuGet PackageManager.InstallPackageAsync() throws NullReferenceException

$
0
0

I'm working on a plug-in management system built on top of Nuget similar to Chocolatey, PowerShell Gallery etc.

I want to use the newer V3 libraries rather then the deprecated V2 Nuget.Core library used by Chocolatey. However, the amount of abstraction and the lack of documentation in the V3 libraries is becoming a serious challenge for me. I'm still failing to get simple prototype working that will download and extract a package.

Here's my test code:https://github.com/ericanastas/nuget-packagemanagment-test

       private static void Main(string[] args)        {            try            {                var curDir = System.IO.Directory.GetCurrentDirectory();                ISettings settings = Settings.LoadSpecificSettings(curDir, Settings.DefaultSettingsFileName);                List<Lazy<INuGetResourceProvider>> resourceProviders = new List<Lazy<INuGetResourceProvider>>();                resourceProviders.AddRange(NuGet.Protocol.Core.Types.Repository.Provider.GetCoreV3());  // Add v3 API support                IPackageSourceProvider packageSourceProvider = new PackageSourceProvider(settings);                SourceRepositoryProvider sourceRepositoryProvider = new SourceRepositoryProvider(packageSourceProvider, resourceProviders);                string projectRoot = System.IO.Path.GetFullPath("ProjectRoot");                if (!System.IO.Directory.Exists(projectRoot)) System.IO.Directory.CreateDirectory(projectRoot);                FolderNuGetProject nuGetProject = new FolderNuGetProject(projectRoot);                string packagesFolderPath = System.IO.Path.GetFullPath("Packages");                if (!System.IO.Directory.Exists(packagesFolderPath)) System.IO.Directory.CreateDirectory(packagesFolderPath);                NuGetPackageManager packageManager = new NuGetPackageManager(sourceRepositoryProvider, settings, packagesFolderPath)                {                    PackagesFolderNuGetProject = nuGetProject                };                bool allowPrereleaseVersions = true;                bool allowUnlisted = true;                DependencyBehavior dependencyBehavior = DependencyBehavior.Lowest;                ResolutionContext resolutionContext = new ResolutionContext(                         dependencyBehavior, allowPrereleaseVersions, allowUnlisted, VersionConstraints.None);                INuGetProjectContext projectContext = new ConsoleProjectContext(NullLogger.Instance);                IEnumerable<SourceRepository> primarySourceRepositories = sourceRepositoryProvider.GetRepositories();                //packageIdentity                string packageId = "Newtonsoft.Json";                string packageVersion = "12.0.3";                PackageIdentity packageIdentity = new PackageIdentity(packageId, new NuGet.Versioning.NuGetVersion(packageVersion));                var installPackageAsyncTask = packageManager.InstallPackageAsync(packageManager.PackagesFolderNuGetProject,                    packageIdentity, resolutionContext, projectContext,                    primarySourceRepositories, Array.Empty<SourceRepository>(), CancellationToken.None);                installPackageAsyncTask.GetAwaiter().GetResult();            }            catch (Exception exp)            {                using (var sw = new System.IO.StreamWriter("error.txt"))                {                    sw.Write(exp.ToString());                }                Console.WriteLine(exp.ToString());                throw;            }        }

And here's the NullReferenceException that is thrown at the end when I try to call InstallPackageAsync()

System.NullReferenceException: Object reference not set to an instance of an object.   at NuGet.ProjectManagement.FolderNuGetProject.<>c__DisplayClass13_0.<<InstallPackageAsync>b__0>d.MoveNext()--- End of stack trace from previous location where exception was thrown ---   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)   at NuGet.Common.ConcurrencyUtilities.<ExecuteWithFileLockedAsync>d__3`1.MoveNext()--- End of stack trace from previous location where exception was thrown ---   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()   at NuGet.Common.ConcurrencyUtilities.<ExecuteWithFileLockedAsync>d__3`1.MoveNext()--- End of stack trace from previous location where exception was thrown ---   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)   at NuGet.PackageManagement.NuGetPackageManager.<ExecuteInstallAsync>d__85.MoveNext()--- End of stack trace from previous location where exception was thrown ---   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)   at NuGet.PackageManagement.NuGetPackageManager.<ExecuteNuGetProjectActionsAsync>d__76.MoveNext()--- End of stack trace from previous location where exception was thrown ---   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()   at NuGet.PackageManagement.NuGetPackageManager.<ExecuteNuGetProjectActionsAsync>d__76.MoveNext()--- End of stack trace from previous location where exception was thrown ---   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()   at NuGet.PackageManagement.NuGetPackageManager.<ExecuteNuGetProjectActionsAsync>d__76.MoveNext()--- End of stack trace from previous location where exception was thrown ---   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)   at NuGet.PackageManagement.NuGetPackageManager.<InstallPackageAsync>d__48.MoveNext()--- End of stack trace from previous location where exception was thrown ---   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)   at NuGet.PackageManagement.NuGetPackageManager.<InstallPackageAsync>d__47.MoveNext()--- End of stack trace from previous location where exception was thrown ---   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()   at NugetTest.Program.Main(String[] args) in C:\Git\5ec64809061464dc19a1d4e39961c565\NugetTest\Program.cs:line 66

What am I missing here?

Need to copy the content files in nuspec to the output directory

$
0
0

I have a nuget package published that contains exe, other libraries and content files. The content files are templates that help in create the final output based on the template(s). Unfortunately, when the nuget is referenced from another another project, only the lib files can be found in the output directory.

Is there a way to have the content to get copied to the output path as well? Here's a link to the nuspec.

Thanks for the response.

Regards

NuGet package problems while building DirectX Graphics Samples

$
0
0

I've encountered NuGet problems while building DirectX-Graphics-Samples

The error occurs with many projects, here is an example:

NuGet Package restore failed for project D3D12Multithreading: Unable to find version '1.0.161208001' of package 'WinPixEventRuntime'.   C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'WinPixEventRuntime.1.0.161208001' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'. . Please see Error List window for detailed warnings and errors. 1>------ Build started: Project: D3D12Multithreading, Configuration: Debug x64 ------ 1>D:\Personal\Projects\MyProjects\ProjDirectXGraphicsSamples\Samples\Desktop\D3D12Multithreading\src\D3D12Multithreading.vcxproj(157,5): 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 D:\Personal\Projects\MyProjects\ProjDirectXGraphicsSamples\Samples\Desktop\D3D12Multithreading\src\packages\WinPixEventRuntime.1.0.161208001\build\WinPixEventRuntime.targets. 1>Done building project "D3D12Multithreading.vcxproj" -- FAILED.========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Microsoft's suggestions for restoring packagesenter image description here

did not help either:

NuGet Package restore failed for project D3D12Multithreading: Unable to find version '1.0.161208001' of package 'WinPixEventRuntime'.  C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'WinPixEventRuntime.1.0.161208001' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.. Please see Error List window for detailed warnings and errors.NuGet package restore finished.Time Elapsed: 00:00:00.0389909========== Finished ==========

I am using VS Enterprise 2019(16.5.1), .NET 4.8.03752, SDK 10.0.19041.0.

I have NuGet package manager in my VS configuration but not NuGet targets and build tasks.

enter image description here

Here is my .vsconfig

{"version": "1.0","components": ["Microsoft.VisualStudio.Component.CoreEditor","Microsoft.VisualStudio.Workload.CoreEditor","Microsoft.NetCore.Component.Runtime.3.1","Microsoft.NetCore.Component.SDK","Microsoft.VisualStudio.Component.NuGet","Microsoft.VisualStudio.Component.Roslyn.Compiler","Microsoft.VisualStudio.Component.Roslyn.LanguageServices","Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions","Microsoft.VisualStudio.Component.TypeScript.3.8","Microsoft.VisualStudio.Component.JavaScript.TypeScript","Microsoft.Component.MSBuild","Microsoft.VisualStudio.Component.TextTemplating","Microsoft.VisualStudio.Component.SQL.LocalDB.Runtime","Microsoft.VisualStudio.Component.Common.Azure.Tools","Microsoft.VisualStudio.Component.SQL.CLR","Microsoft.Net.Component.4.5.TargetingPack","Microsoft.VisualStudio.Component.IntelliCode","Microsoft.VisualStudio.Component.IntelliTrace.FrontEnd","Microsoft.VisualStudio.Component.DiagnosticTools","Microsoft.VisualStudio.Component.AppInsights.Tools","Microsoft.VisualStudio.Component.WebDeploy","Microsoft.Net.Component.4.7.1.TargetingPack","Microsoft.VisualStudio.Component.ClassDesigner","Microsoft.VisualStudio.Component.GraphDocument","Microsoft.VisualStudio.Component.CodeMap","Microsoft.Component.PythonTools","Microsoft.Component.PythonTools.Miniconda","Microsoft.Component.PythonTools.Web","Microsoft.VisualStudio.Component.VC.CoreIde","Microsoft.VisualStudio.Component.Windows10SDK","Microsoft.VisualStudio.Component.VC.Tools.x86.x64","Microsoft.VisualStudio.Component.Graphics.Tools","Microsoft.VisualStudio.Component.VC.DiagnosticTools","Microsoft.VisualStudio.Component.Windows10SDK.18362","Component.CPython3.x64","Microsoft.VisualStudio.Workload.Python","Microsoft.ComponentGroup.Blend","Microsoft.VisualStudio.Component.Debugger.JustInTime","Microsoft.VisualStudio.ComponentGroup.MSIX.Packaging","Microsoft.VisualStudio.Component.VC.Redist.14.Latest","Microsoft.VisualStudio.ComponentGroup.ArchitectureTools.Native","Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core","Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions.CMake","Microsoft.VisualStudio.Component.VC.CMake.Project","Microsoft.VisualStudio.Component.VC.ATL","Microsoft.VisualStudio.Component.VC.TestAdapterForBoostTest","Microsoft.VisualStudio.Component.VC.TestAdapterForGoogleTest","Microsoft.VisualStudio.Component.VC.ASAN","Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset","Microsoft.VisualStudio.Component.VC.Llvm.Clang","Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Llvm.Clang","Microsoft.VisualStudio.Workload.NativeDesktop","Microsoft.Component.NetFX.Native","Microsoft.VisualStudio.ComponentGroup.UWP.NetCoreAndStandard","Microsoft.VisualStudio.Component.Graphics","Microsoft.VisualStudio.ComponentGroup.UWP.Xamarin","Microsoft.VisualStudio.ComponentGroup.UWP.Support","Microsoft.VisualStudio.Workload.Universal","Microsoft.Net.Component.3.5.DeveloperTools","Microsoft.VisualStudio.Component.Unity","Component.UnityEngine.x64","Component.UnityEngine.x86","Microsoft.VisualStudio.Workload.ManagedGame","Microsoft.VisualStudio.Workload.NativeGame","Component.MDD.Linux","Component.Linux.CMake","Microsoft.VisualStudio.Workload.NativeCrossPlat"  ]}

What components should be in my VS installation for NuGet to work properly?

Docker-compose build issue because off local package

$
0
0

I have a micro service project developed in .NET5.I'm trying to build a docker compose file. Each time, the compiler give me the issue back that the Play.Common package can not be found.The package is an own package and save locally on laptop. I had a a file nugget.config on the projet root with nugget.org and my local folder.What should I do to reference my own packag into the docker file. Tell me if you need more information.

enter image description here

MSBuild props file does not get evaluated when imported by a nuget package, but works when manually imported

$
0
0

I have created a number of nuget packages with msbuild targets that help me take care of common boilerplate in my .NET projects. Here I am working on a simple .props file which is aimed to make the copyright information in the compiled assembly and the nuget package consistent.

Currently I am struggling with the fact that this props file does not get respected in all build phases of a target project.

The props file looks roughly like the following (full source code available in github):

<PropertyGroup><CopyrightYearCurrent Condition=" '$(CopyrightYearCurrent)' == ''">$([System.DateTime]::get_UtcNow().get_Year())</CopyrightYearCurrent><CopyrightYear>$(CopyrightYearCurrent)</CopyrightYear><!-- CopyrightYearSince may be defined externally in the consuming project and is non-mandatory --><CopyrightYear Condition=" '$(Authors)' != '' AND '$(CopyrightYearSince)' != ''">$(CopyrightYearSince)-$(CopyrightYearCurrent)</CopyrightYear></PropertyGroup><PropertyGroup><Copyright Condition=" '$(Authors)' != '' AND '$(Copyright)' == ''">Copyright © $(Authors) $(CopyrightYear)</Copyright></PropertyGroup><PropertyGroup><AssemblyCompany Condition=" '$(AssemblyCompany)' == '' AND '$(Authors)' != ''">$(Authors)</AssemblyCompany><AssemblyCopyright Condition=" '$(AssemblyCopyright)' == '' AND '$(Copyright)' != ''">$(Copyright)</AssemblyCopyright></PropertyGroup>

In a target project, I have a DirectoryBuild.props placed in my root directory, where I need to activate the props file.

My goal is, when I run dotnet build, or dotnet pack from the command line, the Copyright-related information from msbuild to propagate both to the assembly attributes, and to the nuget package.

Initially, during the development of the props, I just imported the props file using the MSBuild Import directive into my DirectoryBuild.props, and all was working as expected.

Because the props looked quite generic I decided to create a nuget package out of it so I can reuse it in more than a single project, and maintain it from a central place. Then I replaced the Import of the props file inside of DirectoryBuild with a PackageReference directive.

Now, when I execute dotnet pack, the produced nuget package (and the respective nuspec file which is auto-generated in the obj folder) no longer contain the copyright field. At the same time, the compiled dll files have their copyright information correctly applied.

I have examined the complete msbuild output for both scenarios (using the command dotnet build -pp:msbuild.xml) and there are no significant difference in the import order of the props file from the package vs the manually imported file from Directory.Build.props, and so I am stuck with understanding the observed behaviour.

Here is the output of dotnet --info if it is of any use to someone:

.NET SDK (reflecting any global.json):Version: 5.0.202Commit: db7cc87d51

Runtime Environment:OS Name: WindowsOS Version: 10.0.19042OS Platform: WindowsRID: win10-x64Base Path: C:\Program Files\dotnet\sdk\5.0.202\

Host (useful for support):Version: 5.0.5Commit: 2f740adc14

Update

Just to weed out any suspicions, the nuget package is properly built (the name of the package and the targets it imports are the same) and my IDE (JetBrains Rider) correctly detects that the .props file from the nuget package is loaded.

Also, CopyrightYearSince and Authors are defined in my Directory.Build.props before the PackageReference directive.

Viewing all 3198 articles
Browse latest View live


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