nuget restore failing in team services build - visual-studio-2017

I have 2 local assemblies referenced via nuget (packed the dll's up) using vs2017 on a asp.net core solution, builds fine locally.
Now trying to generate a build via VSTS i am getting the following error,
Detected NuGet version 4.0.0.2283 / 4.0.0
SYSTEMVSSCONNECTION exists true
Saving NuGet.config to a temporary config file.
d:\a\_tool\NuGet\4.0.0\x64\nuget.exe restore d:\a\1\s\TestFrameworkCoreAPI.sln -Verbosity Detailed -NonInteractive -ConfigFile d:\a\1\Nuget\tempNuGet_37.config
NuGet Version: 4.0.0.2283
MSBuild auto-detection: using msbuild version '15.3.409.57025' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
MSBuild P2P timeout [ms]: 120000
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin\msbuild.exe /t:GenerateRestoreGraphFile /nologo /nr:false /p:RestoreUseCustomAfterTargets=true /p:BuildProjectReferences=false /v:q /p:NuGetRestoreTargets="d:\a\_temp\NuGet-Scratch\w53qa5rr.4sd.targets" /p:RestoreTaskAssemblyFile="d:\a\_tool\NuGet\4.0.0\x64\nuget.exe" /p:RestoreGraphOutputPath="d:\a\_temp\NuGet-Scratch\4mlmlfgh.mmy.result" /p:ExcludeRestorePackageImports=true /p:RestoreRecursive=False /p:RestoreProjectFilterMode=exclusionlist /p:RestoreContinueOnError=WarnAndContinue /p:RestoreGraphProjectInput="d:\a\1\s\TestFrameworkCoreAPI\TestFrameworkCoreAPI.csproj;" "d:\a\_temp\NuGet-Scratch\w53qa5rr.4sd.targets"
Running restore with 2 concurrent jobs.
Reading project file d:\a\1\s\TestFrameworkCoreAPI\TestFrameworkCoreAPI.csproj.
Reading project file d:\a\1\s\TestFrameworkCoreAPI\TestFrameworkCoreAPI.csproj.
Restoring packages for d:\a\1\s\TestFrameworkCoreAPI\TestFrameworkCoreAPI.csproj...
Restoring packages for d:\a\1\s\TestFrameworkCoreAPI\TestFrameworkCoreAPI.csproj...
Restoring packages for .NETCoreApp,Version=v1.1...
Restoring packages for .NETCoreApp,Version=v2.0...
System.AggregateException: One or more errors occurred. ---> NuGet.Protocol.Core.Types.FatalProtocolException: Failed to retrieve information about 'Microsoft.VisualStudio.Web.CodeGeneration.Tools' from remote source 'D:\TestFrameworkAssemblies'.
at NuGet.Protocol.LocalV3FindPackageByIdResource.GetVersionsCore(String id, ILogger logger)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at NuGet.Protocol.LocalV3FindPackageByIdResource.GetAllVersionsAsync(String id, SourceCacheContext cacheContext, ILogger logger, CancellationToken token)
at NuGet.Commands.SourceRepositoryDependencyProvider.<FindLibraryAsync>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
Error: d:\a\_tool\NuGet\4.0.0\x64\nuget.exe failed with return code: 1
Packages failed to restore
I have a nuget.config file in a .nuget folder located in the root of solution,
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!-- remove any machine-wide sources with <clear/> -->
<clear />
<add key="Test Framework" value="D:\TestFrameworkAssemblies" />
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
</packageSources>
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
</configuration>
This is what is in the VSTS build def, NuGet restore step
It looks like it always references my local assembly and not the standard nuget.org, now in the config file, if i take out my local entry to framework assemblies, the nuget part works but i get a primary reference error as it cannot find the 2 assemblies i have packed locally.
Been going round in circles with this at the moment, how can you get VSTS to restore local packed assemblies as well as from nuget.org. I am using Hosted 2017 as well.
thanks in advance

It seems you were queue the build on Hosted agent. Since there has the packages located on your local machine, you should build with the private agent which located on your local machine.
Additional, if you need to queue the build on Hosted agent, you should add the local packages in repository, and then reference the packages with the new path and change the value in nuget.config.

Related

How to accept android licenses after installing Tools for Cordova using Visual Studio 2017

I installed Visual Studio 2017 with the "Mobile development with JavaScript" option and "Android SDK setup" selected.
When I check Tools->Options->Tools for Apache Cordova->Environment Variable Overrides I can see that ANDROID_HOME has been set to "C:\ProgramData\Microsoft\AndroidSDK\25"
When I try to build my project I get an error:
cordova-build error : > You have not accepted the license agreements
of the following SDK components: cordova-build error : [Android SDK
Platform 25].
I open a Windows command prompt and go to the directory containing the sdkmanager:
cd C:\ProgramData\Microsoft\AndroidSDK\25\tools\bin
I try sdkmanager --licenses but that results in
Error: Unknown argument --licenses
So I try sdkmanager --update and that results in
Warning: An error occurred during installation: Failed to move away or
delete existing target file:
C:\ProgramData\Microsoft\AndroidSDK\25\tools Move it away manually and
try again.
So I move up to the folder above the tools folder and rename it:
ren tools tools.old
then try the update again:
tools.old\bin\sdkmanager --update
this gave me a warning:
Warning: Observed package id 'tools' in inconsistent location
'C:\ProgramData\Microsoft\AndroidSDK\25\tools.old' (Expected
'C:\ProgramData\Microsoft\AndroidSDK\25\tools')
But after a lengthy wait the command reported that it was done and I could see that there was a new "tools" folder.
I tried to build my project again. Now my error is:
Could not find gradle wrapper within Android SDK. Might need to update
your Android SDK.
Looked here:
C:\ProgramData\Microsoft\AndroidSDK\25\tools\templates\gradle\wrapper
References:
https://stackoverflow.com/a/47305199/150342
https://developer.android.com/studio/command-line/sdkmanager.html
You have not accepted the license agreements of the following SDK components

Nuget Package Manager Error 'Illegal characters in path.'

I use Visual Studio 2017 and my NuGet Package Manager doesn't work consistently.
I open 2 projects for test this problem with sames properties and same names (Wpfappt, wpfapph) in wpfappt the manager works, but in wpfapph it doesn't.
This is the messages in the output field:
wpfappt (it works):
Restoring packages for C:\Users\Yogev\source\repos\WpfAppt\WpfAppt\WpfAppt.csproj...
GET https://api.nuget.org/v3-flatcontainer/microsoft.office.interop.excel/index.json
OK https://api.nuget.org/v3-flatcontainer/microsoft.office.interop.excel/index.json 822ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.office.interop.excel/15.0.4795.1000/microsoft.office.interop.excel.15.0.4795.1000.nupkg
OK https://api.nuget.org/v3-flatcontainer/microsoft.office.interop.excel/15.0.4795.1000/microsoft.office.interop.excel.15.0.4795.1000.nupkg 185ms
Installing Microsoft.Office.Interop.Excel 15.0.4795.1000.
Committing restore...
Writing lock file to disk. Path: C:\Users\Yogev\source\repos\WpfAppt\WpfAppt\obj\project.assets.json
Restore completed in 3.62 sec for C:\Users\Yogev\source\repos\WpfAppt\WpfAppt\WpfAppt.csproj.
Successfully installed 'Microsoft.Office.Interop.Excel 15.0.4795.1000' to WpfAppt
Executing nuget actions took 3.54 sec
Time Elapsed: 00:00:10.3848087
========== Finished ==========
And this is the message from the other project:
Attempting to gather dependency information for package 'Newtonsoft.Json.10.0.3' with respect to project 'WpfApph', targeting '.NETFramework,Version=v4.6.1'
Gathering dependency information took 754.28 ms
Attempting to resolve dependencies for package 'Newtonsoft.Json.10.0.3' with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'Newtonsoft.Json.10.0.3'
Resolved actions to install package 'Newtonsoft.Json.10.0.3'
Retrieving package 'Newtonsoft.Json 10.0.3' from 'nuget.org'.
Adding package 'Newtonsoft.Json.10.0.3' to folder 'C:\Users\Yogev\source\repos\WpfApph\packages'
Added package 'Newtonsoft.Json.10.0.3' to folder 'C:\Users\Yogev\source\repos\WpfApph\packages'
Install failed. Rolling back...
Package 'Newtonsoft.Json.10.0.3' does not exist in project 'WpfApph'
Removing package 'Newtonsoft.Json.10.0.3' from folder 'C:\Users\Yogev\source\repos\WpfApph\packages'
**Removed package 'Newtonsoft.Json.10.0.3' from folder** 'C:\Users\Yogev\source\repos\WpfApph\packages'
Executing nuget actions took 1.1 sec
**An error occurred while writing file** 'C:\Users\Yogev\source\repos\WpfApph\WpfApph\packages.config': Failed to write packages.config as XML file 'C:\Users\Yogev\source\repos\WpfApph\WpfApph\packages.config'. Error: 'Illegal characters in path.'.
Time Elapsed: 00:00:01.8665589
========== Finished ==========
Thank you.

The install of solidity extension was failed for Visual Studio 2017

I tried to install solidity extension for Visual Studio 2017, I downloaded VSIX Installer from the link bellow:
https://marketplace.visualstudio.com/items?itemName=ConsenSys.Solidity
when I tried to run the VSIX file, the installation failed immediately with the given message:
"Install Failed
The install of the extension was not successful for all the selected products. For more information, click the install log link at the bottom of the dialog.
This extension is not installable on any currently installed products."
I also tried to read the log file but it is very huge and many different things happened there. I appreciate if someone who had the same experience and fixed it could advice me how to fix it.
For anyone who is trying to install on VS 2017 just open the extract the package and then edit the extension.vsixmanifest to change the wrongly added brackets to square brackets. As below:
<InstallationTarget Version="[14.0,15.0]" Id="Microsoft.VisualStudio.Pro" />
<InstallationTarget Version="[14.0,15.0]" Id="Microsoft.VisualStudio.Community" />
<InstallationTarget Version="[14.0,15.0]" Id="Microsoft.VisualStudio.Enterprise" />
If still you face issue, With out converting to .zip file, do " Open Archive " - With in that edit the files as below
<Installation>
.... Version="[14.0,15.0]"
.... Version="[14.0,15.0]"
.... Version="[14.0,15.0]"
</Installation>
<Dependencies>
.... Version="[4.5,]"
</Dependencies>
save the file and run as it. ( Here there is no conversion from vsix to zip and back - edit is direct on the vsix ) - Installation is success for me.
The page says "Works with Visual Studio 2015".

Testing ASP.NET Core full .NET Framework with TestServer gives method not found in vs 2017

When trying to run test in Visual Studio 2017, all is compiling without issue,
However when I'm trying to create server and client to test:
this.Server = new TestServer(
new WebHostBuilder()
.UseStartup<Startup>()
.UseContentRoot(di.FullName));
this.Client = this.Server.CreateClient();
The TestServeris complaining about wrong dependencies (it tries to load version 1.0.0) even if TestHost package is:
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="1.1.1" />
Also test is failing with exception:
Cannot find method: 'System.Net.Http.HttpClient Microsoft.AspNetCore.TestHost.TestServer.CreateClient()'..
It is related to wrong test template in VS 2017
manually adding in the top <PropertyGroup>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
in csproj file fixes issue

Not able to build .net solution in Team city by using Nant.exe

I have using team city to build my project by using of Nant as build. So I have created one batch file in to build my project by where I using Nant.exe which is responsible for build my solution.
When I am ruing this batch file from command prompt I am successfully able to build my solution. But When I run the same file from TeamCity its giving me Build fail error.
So That I have verified path and that also correct. Below are the path I have stored in team city.
Path to a build file: Build.bat (bat file for build)
Working directly : D:\CMS (path where my bat file is located.
NAnt home: Path were Nant exe located.
Targeted framwork : Net 4.0
When I am ruing this build by team city every time build fails with below log generated.
[21:27:54]: Checking for changes
[21:27:55]: Clearing temporary directory: C:\TeamCity\buildAgent\temp\buildTmp
[21:27:55]: Checkout directory: D:\Projects\JoyaCMS\src
[21:27:56]: Repository sources transferred
[21:27:55]: Updating sources: server side checkout... (1s)
[21:27:57]: Publishing internal artifacts (2s)
[21:27:57]: Starting: D:\Projects\JoyaCMS\src\UppercuT\lib\NAnt\NAnt.exe - buildfile:D:\Projects\JoyaCMS\src\build.bat -targetframework:net-4.0 - extension:C:\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NAntLoggers .dll -listener:JetBrains.BuildServer.NAntLoggers.NAntListener
[21:27:57]: in directory: D:\Projects\JoyaCMS\src
[21:27:57]: Process exited with code 1
[21:27:57]: NAnt output:
[21:27:57]: NAnt 0.91 (Build 0.91.3881.0; alpha2; 8/17/2010)
[21:27:57]: Copyright (C) 2001-2010 Gerry Shaw
[21:27:57]: http://nant.sourceforge.net
[21:27:57]: BUILD FAILED
[21:27:57]: For more information regarding the cause of the build failure, run the build again in debug mode.
[21:27:57]: Try 'nant -help' for more information
[21:27:57]: D:\Projects\JoyaCMS\src\build.bat(1,1):
[21:27:57]: Error loading buildfile.
[21:27:57]: Data at the root level is invalid. Line 1, position 1.
[21:28:02]: Publishing internal artifacts (1s)
[21:28:05]: Build finished
So let me know how can I resolve this issue in team city. and what setting I need to perform more to resolve this issue.
Thanks,
Amit
First of all I noticed a few occurrences of additional whitespace characters in your NAnt call e.g.- extension:C:\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NAntLoggers .dll. Might be an SO formatting issue, but in case they're part of your batch, remove them first.
If this doesn't help, activate verbose build output via NAnt switch -v+. That should give more information.