NuGet package problems while building DirectX Graphics Samples - nuget
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 packages
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.
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?
The project use package.config file to manage nuget packages.
So try to modify the Package Reference to Package.config
All I had to do was to add https://api.nuget.org/v3/index.json as the source of nuget.org in Visual Studio Tools->Options->NuGet Package manager
Related
nuget package is not compatible with netcoreapp2.0
I created nuget package yet while PS C:\Users\vicky\Documents\ThreadBasedJobQueue\Testnuget> dotnet add package abhi.TaskQueueLib --version 1.0.0 Writing C:\Users\vicky\AppData\Local\Temp\tmp44DF.tmp info : Adding PackageReference for package 'abhi.TaskQueueLib' into project 'C:\Users\vicky\Documents\ThreadBasedJobQueue\Testnuget\Tes tnuget.csproj'. log : Restoring packages for C:\Users\vicky\Documents\ThreadBasedJobQueue\Testnuget\Testnuget.csproj... info : GET https://api.nuget.org/v3-flatcontainer/abhi.taskqueuelib/index.json info : OK https://api.nuget.org/v3-flatcontainer/abhi.taskqueuelib/index.json 1139ms info : GET https://api.nuget.org/v3-flatcontainer/abhi.taskqueuelib/1.0.0/abhi.taskqueuelib.1.0.0.nupkg info : OK https://api.nuget.org/v3-flatcontainer/abhi.taskqueuelib/1.0.0/abhi.taskqueuelib.1.0.0.nupkg 1424ms log : Installing abhi.TaskQueueLib 1.0.0. error: Package abhi.TaskQueueLib 1.0.0 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package abhi.TaskQueueLib 1.0.0 supports: root (Root,Version=v0.0) error: Package 'abhi.TaskQueueLib' is incompatible with 'all' frameworks in project 'C:\Users\vicky\Documents\ThreadBasedJobQueue\Testn uget\Testnuget.csproj'.
The following documentation has the answers you are seeking: https://learn.microsoft.com/en-us/nuget/create-packages/supporting-multiple-target-frameworks Irrespective of whether you target one framework or multiple frameworks, you should create the ‘framework’ folder under the lib directory and then put the dll into that framework folder. This folder for the target framework is called Target Framework Moniker or TFM in short. List of all the allowed TFMs for NuGet is captured here: https://learn.microsoft.com/en-us/nuget/schema/target-frameworks#supported-frameworks
Found the issue in lib folder i had to make folder by framework Name and then had to pack. Un knowing i was keeping my Dll in Lib Folder please refer https://learn.microsoft.com/en-us/nuget/create-packages/creating-a-package
nuget tfs build 2015
I am trying to use NuGet to package and publish the package with TFS Build 2015 to local NuGet Server. I am getting error , I am not sure what am i missing. Thanks for Help. Here is Error Starting task: NuGet Packager Set workingFolder to default: C:\Lucky\agent\tasks\NuGetPackager\0.1.58 Executing the powershell script: C:\Lucky\agent\tasks\NuGetPackager\0.1.58\NuGetPackager.ps1 Checking pattern is specified No Pattern found in solution parameter. Found files: 1 --File: "C:\Lucky\agent_work\1\s\Dev\FabrikamFiber.CallCenter" The property DirectoryName does not exist or was not found. Creating Nuget Arguments: --ARGS: pack "C:\Lucky\agent_work\1\s\Dev\FabrikamFiber.CallCenter" -OutputDirectory "C:\Lucky\agent_work\1\s" -Properties Configuration=Release Invoking nuget with pack "C:\Lucky\agent_work\1\s\Dev\FabrikamFiber.CallCenter" -OutputDirectory "C:\Lucky\agent_work\1\s" -Properties Configuration=Release on C:\Lucky\agent\agent\worker\tools\NuGet.exe pack "C:\Lucky\agent_work\1\s\Dev\FabrikamFiber.CallCenter" -OutputDirectory "C:\Lucky\agent_work\1\s" -Properties Configuration=Release MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin'. Please specify a nuspec or project file to use. Unexpected exit code 1 returned from tool NuGet.exe Finishing task: NuGetPackager Task NuGetPackager failed. This caused the job to fail. Look at the logs for the task for more details.
According to the error info: Please specify a nuspec or project file to use. Unexpected exit code 1 returned from tool NuGet.exe You may specified a wrong argument in nuget package task ,please double check you have followed below requirements: Specify .csproj files (for example, **\*.csproj) for simple projects. In this case: The packager compiles the .csproj files for packaging. You must specify Configuration to Package (see below). You do not have to check in a .nuspec file. If you do check one in, the packager honors its settings and replaces tokens such as $id$ and $description$. Specify .nuspec files (for example, **\*.nuspec) for more complex projects, such as multi-platform scenarios in which you need to compile and package in separate steps. In this case: The packager does not compile the .csproj files for packaging. Each project is packaged only if it has a .nuspec file checked in. The packager does not replace tokens in the .nuspec file (except the element, see Use build number to version package, below). You must supply values for elements such as and . The most common way to do this is to hardcode the values in the .nuspec file. Please double check your arguments , more details please refer this tutorial-- Pack NuGet packages. Besides you could also enable verbose debug mode by adding system.debug=true to get a more detail build log info for troubleshooting.
Restore nuget packages in msbuild 15 project
I'd like to restore the nuget packages from a private feed (vsts internal feed) in a solution consisting of msbuild 15 projects, and subsequently build (and pack) the projects. I'm using the VS 2017 hosted agent which I need to build. I've tried restoring with msbuild with (the deprecated) package restore enabled. This results in no packages being restored. The relevant part of the logs: 2017-04-03T12:21:23.5543508Z ##[warning]The 'Restore NuGet Packages' option is deprecated. To restore NuGet packages in your build, add a NuGet Installer task to your build definition. 2017-04-03T12:21:23.5803410Z ##[command]"C:\LR\MMS\Services\mms\TaskAgentProvisioner\Tools\agents\2.115.0\externals\nuget\NuGet.exe" restore "C:\a\1\s\mysolution.sln" -NonInteractive 2017-04-03T12:21:24.5231560Z MSBuild auto-detection: using msbuild version '4.0' from 'C:\Windows\Microsoft.NET\Framework\v4.0.30319'. I've tried restoring with the nuget installer task. This fails with 2017-04-03T12:21:05.3231625Z [command]C:\a_tasks\NuGetInstaller_333b11bd-d341-40d9-afcf-b32d5ce6f23b\0.2.29\node_modules\nuget-task-common\NuGet\3.5.0\NuGet.exe restore -NonInteractive C:\a\1\s\mysolution.sln -Verbosity Detailed -msbuildversion 15 2017-04-03T12:21:07.5100892Z NuGet Version: 3.5.0.1938 2017-04-03T12:21:07.8293660Z System.AggregateException: One or more errors occurred. ---> NuGet.CommandLine.CommandLineException: Failed to load msbuild Toolset ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Build, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. note that I pass in msbuildversion -15 as additional argument, but it seems nuget tries to load msbuild 14. I've tried restoring with the dontnet cli dotnet restore. This fails with 2017-04-03T12:21:08.3424716Z [command]C:\Program Files\dotnet\dotnet.exe restore C:\a\1\s\path\to\my\csproj 2017-04-03T12:21:12.8146350Z Restoring packages for C:\a\1\s\path\to\my\csproj... 2017-04-03T12:21:12.8146350Z C:\Program Files\dotnet\sdk\1.0.0\NuGet.targets(97,5): error : Unable to load the service index for source https://myvstsaccount.pkgs.visualstudio.com/_packaging/Toolsfeed/nuget/v3/index.json. [C:\a\1\s\path\to\my\csproj] 2017-04-03T12:21:12.8146350Z C:\Program Files\dotnet\sdk\1.0.0\NuGet.targets(97,5): error : Response status code does not indicate success: 401 (Unauthorized). [C:\a\1\s\path\to\my\csproj] 2017-04-03T12:21:12.8176375Z ##[error]Dotnet command failed with non-zero exit code: 1. The nuget.config in my solution directory is <?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <add key="VSTS Tools Feed" value="https://myvstsaccount.pkgs.visualstudio.com/_packaging/Toolsfeed/nuget/v3/index.json" /> </packageSources> <apikeys> <add key="https://myvstsaccount.pkgs.visualstudio.com/_packaging/Toolsfeed/nuget/v3/index.json" value="<A PAT generated from an account with access to the feed>" /> </apikeys> </configuration> and the logs of the tasks show that the config is used. Locally package restore works fine from VS, or with the nuget cli of nuget 4.0. What task should I use to restore packages for msbuild 15 projects, and how can I configure authentication?
Restoring nuget packages defined as PackageReference elements in csproj project definitions requires nuget 4.0, which isn't included on the hosted build agents. You can work around this restriction by including the nuget 4.0 binary in your source control tree, and referring to that binary within the package restore task as a custom NuGet version. For example, when you include the nuget 4.0 binary in a file called nuget4.0.exe in the root directory of your source tree, you can specify the path as $(Build.SourcesDirectory)/nuget4.0.exe. And there is a relate question here for you to refer.
Publishing to Symbol Source from Team City
For awhile in my Team City build, I am unable to publish my source NuGet packages to symbolsource.org as it responds with 500 Internal Server Error. [16:02:36][push] Pushing NCode.Composition.DisposableParts 1.0.1 to the symbol server (http://nuget.gw.symbolsource.org/Public/NuGet)... [16:04:18][push] Failed to process request. 'Internal Server Error'. [16:04:18][push] The remote server returned an error: (500) Internal Server Error.. [16:04:18][push] Process exited with code 1 I am able to publish my normal packages to NuGet.org just fine. I believe that I have properly configured everything as documented by symbol source. https://www.symbolsource.org/MyGet/Wiki/Publishing http://www.symbolsource.org/Public/Metadata/NuGet https://www.symbolsource.org/Public/Account/Register Here is my Build Step configuration for NuGet Publish: Runner Type: NuGet Publish NuGet.exe: Default 2.8.6 Packages: *.nupkg API Key: (my personal API key from NuGet.org) Package Source: (blank) In my build output directory and artifacts recognized by TeamCity, I do have both of my packages in there: NCode.Composition.DisposableParts.1.0.1.nupkg NCode.Composition.DisposableParts.1.0.1.symbols.nupkg Any assistance would be appreciated!
I think that the problem is with two packages with the same name. Did you try a workaround with another build configuration and snapshot dependency? I'm using another build configuration with snapshot dependency to build which produces *.nupkg and *.symbol.nupkg. Artifact dependency is set to: -:*.nupkg => <replace with location> +:*.symbol.nupkg The build configuration only publishes *.symbol.nupkg to symbolsource.org.
Type or Namespace "Dapper" could not be found: in Hangfire Source code in Visual Studios?
I've imported the Hangfire Source code from Github into my existing VS 2013 solution. When I attempted to build all projects within my solution, I get several errors: Error 6 The type or namespace name 'Dapper' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Jerry_Dev\Documents\GitHub\Hangfire\src\Hangfire.SqlServer\SqlServerDistributedLock.cs 20 7 Hangfire.SqlServer In Package Manager, when I do: "Install-Package Dapper", it says 'Dapper 1.38' already installed. Hangfire.SqlServer already has a reference to 'Dapper 1.38'. I see Dapper dot net installed in my Manage Nuget Packages Window in my Hangfire.SqlServer project
We don't store the packages folder under source control to reduce the source code size. Hangfire uses Automatic Package Restore in Visual Studio instead of obsolete MSBuild-integrated package restore. The Automatic Restore downloads missing packages automatically on each build, but it works only with NuGet ≥ 2.7, so you have the following options: Update NuGet to the latest version Please see the official docs. Run the build script Go to the root Hangfire directory and run the build.bat file. It will automatically restore all the missing packages.