Gruntfile won't load after Visual Studio update 15.8 - visual-studio-2017

I updated Visual Studio to 15.8, and now I have the following error when trying to compile my less files using Task Runner Explorer:
Failed to run "C:\Projects\TFS Git Repo\Main\src\Ljmu.Web.UI\Gruntfile.js"...
cmd.exe /c grunt -b "C:\Projects\TFS Git Repo\Main\src\Ljmu.Web.UI" --gruntfile "C:\Projects\TFS Git Repo\Main\src\Ljmu.Web.UI\Gruntfile.js" --tasks "c:\program files (x86)\microsoft visual studio\2017\enterprise\common7\ide\extensions\microsoft\web tools\taskrunnerexplorer\Scripts" vs-grunt-task-reader
grunt[10096]: src\node_contextify.cc:631: Assertion `args[1]->IsString()' failed.
1: 00007FF677EB82F5
2: 00007FF677E94156
3: 00007FF677E94221
4: 00007FF677E6A69A
5: 00007FF6784B5EB2
6: 00007FF6784B7008
7: 00007FF6784B636D
8: 00007FF6784B628B
9: 00000292D50841C1
Any ideas welcome...
Edit
It works fine when running from the command line so I think it's just an issue with Task Runner Explorer.

The problem happens because the Visual Studio gulp is outdated.
Solution:
Add the updated node to Visual Studio paths:
Tools > Options > Projects and Solutions > Web Package Management > External Web Tools
Then you need to add your node install directory to the top of the list, like so:
Node Path
This solved my problem.
Solution

Just ran into the same problem after updating to Visual Studio 15.8
Running the below command in the same directory as my package.json seemed to fix the issue for me
npm install gulp

This worked for my Task Runner Explorer issue:
In Visual Studio, navigate to: Tools -> Options -> Projects and Solutions -> Web Package Management -> External Web Tools
Move the $(PATH) entry above the $(VSInstalledExternalTools).
Hit Refresh on your Task Runner Explorer

Related

Data collector 'Code Coverage' failed to provide initialization information

I'm trying to create a code coverage report using the Build pipeline.
I have added the task of typeVisual Studio code in the build pipeline and have enabled the Code Coverage.
When the build is triggered. I'm getting :
Data collector 'Code Coverage' message: Data collector 'Code Coverage' failed to provide initialization information. Error: System.TypeInitializationException: The type initializer for 'Microsoft.VisualStudio.Diagnostics.Logging.ProfilerInterop' threw an exception. ---> Microsoft.VisualStudio.Diagnostics.Common.InvariantException: Failed to load IntelliTrace Profiler binary or failed to locate functions.
and
---> System.ComponentModel.Win32Exception: The system cannot find the path specified
This is running the tests and all the tests are passed. However I'm not able to view the code coverage report. The report which it has created contains only information about the tests
Any input on where we specify the path will be useful.
You basically need Visual Studio Test Agent for Code Coverage.
There are 2 possible ways to install for this:
Option 1
Install Agents for Visual Studio 2019 on the Build server (download from here, see under Tools for Visual Studio 2019).
In the build pipeline edit the Visual Studio Test Assemblies task. Set Select test platform using to Specific location and set Path to vstest.console.exe to for example C:\Program Files (x86)\Microsoft Visual Studio\2019\TestAgent\Common7\IDE\Extensions\TestPlatform\vstest.console.exe.
Option 2
Add the Visual Studio test platform installer build task to your pipeline. (Add this task before the testing task).
In the Visual Studio Test Assemblies task you have to select Installed by Tools Installer as the Test platform version
Note: in my experience I had some tests who succeeded with option 1, but failed in option2. Sadly I don't have the time to figure out why...
I faced this issue when configuring a build container.
1 To install the Visual Studio 2019 Test Agent, I used Chocolatey
1.2 Install Chocolatey
ENV chocolateyUseWindowsCompression = false
SHELL ["powershell.exe", "-ExecutionPolicy", "Bypass", "-Command"]
RUN Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')); `
[System.Environment]::SetEnvironmentVariable('PATH', "\"${env:PATH};%ALLUSERSPROFILE%\chocolatey\bin\"", 'Machine'); `
choco feature enable -n allowGlobalConfirmation;
1.2 Install the TestAgent with chocolatey
RUN choco install visualstudio2019testagent -y
2. Edit the VSTest task on your pipeline to use a specific location.
In my case, I've installed into the container the VSBuildTools. The VSTest task used the VSBuildTools vstest.console.exe but the execution needs some libraries that are located at the TestAgent folders.
vstestLocationMethod: location
vstestLocation: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\TestAgent\Common7\IDE\Extensions\TestPlatform\vstest.console.exe'
Had a similar problem after updating build agent and adding VS2017 capabilities.
Downloaded (from https://www.opendll.com): microsoft.intellitrace.profiler.dll
Add to folder C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\Extensions\TestPlatform\x64​
Good luck

cppunittest.h no such file or directory

I try build an unit test C++ project on a CI server. On my PC no problem, but on the CI server, I have the message: "'CppUnitTest.h' : No such file or directory".
On both computer (mine and server), there is VS enterprise 2017, the only thing different it's on my PC, I build on VS, and on the CI server, I use MSBuild by command line.
I tried to include additional directories in the project as:
AdditionalIncludeDirectories: $(VCInstallDir)Auxiliary\VS\UnitTest\include;$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories)
AdditionalLibraryDirectories - $(VCInstallDir)UnitTest\lib;$(VCInstallDir)Auxiliary\VS\UnitTest\lib;%(AdditionalLibraryDirectories)
But it doesn't work.
Is there another directory to include ?
cppunittest.h no such file or directory
Since you have installed the Visual Studio 2017 on your build server and build the project successfully, you should use the MSBuild from the Visual Studio instead of the build tool.
You can try to call the MSBuild from following path:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe
I have create a unit test C++ project sample to test, and it works fine, if I call the MSBuild from above folder.
Hope this helps.

In Visual Studio Code 2017: msbuild : The term 'msbuild' is not recognized as the name of a cmdlet

msbuild : The term 'msbuild' is not recognized as the name of a cmdlet,
function, script file, or operable program.
As far as my googling goes, Visual Code should come with MSbuild. I have installed the C/C++ and msbuild Tools extensions to no avail. What can I do?
Edit: I am using Visual Studio Code 1.19.2
Likely it's a path issue. If you have VS2017 installed, it's probably in the directory C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin
Try adding that to your path, then restart VS Code and try again.
I suggest you rethink you command-line approach.
Short plan
Install Visual Studio Build Tools 2017
Find proper MSBuild
Use it
Details
Using Build Tools will give you independence from Visual Studio installation.
Download Build Tools for Visual Studio 2017 from Visual Studio Downloads page (direct link)
Command-line arguments documented here: Use command-line parameters to install Visual Studio 2017
All workloads and components are listed here: Visual Studio Build Tools 2017 component directory
You can use PowerShell module VSSetup. Download it or install from here: Github: Microsoft/Visual Studio Setup PowerShell Module
Run MSBuild with build target (you can add additional required parameters)
# 1. Find MS Build
Import-Module $PSScriptRoot\VSSetup\VSSetup.psd1
$msBuildPath = (Get-VSSetupInstance | Select-VSSetupInstance -Version 15.0 -Product Microsoft.VisualStudio.Product.BuildTools).InstallationPath
if ([System.IntPtr]::Size -eq 8)
{
$global:msbuildPath = Join-Path $msBuildPath 'MSBuild\15.0\Bin\amd64'
}
else
{
$global:msbuildPath = Join-Path $msBuildPath 'MSBuild\15.0\Bin'
}
Write-Output "Using MSBuild from $global:msbuildPath"
Write-Output "MSBuild /version"
$msbuild = Join-Path $global:msbuildPath msbuild
& $msbuild /version
# 2. Build
& $msbuild "$sln_file" /t:Build /v:q /nologo
I don't believe that this is a good solution, but it's what I hacked together since the other suggestions didn't work. I installed Visual Studio Installer and installed MSBuild through that. I am having other issues now but at least msbuild is running.
I faced the same issue, what worked with me was to use dotnet instead of msbuild :
dotnet build

The directory containing the assemblies for the Visual Studio Test Runner is not valid

Our CI environment setup with [TFS Server 2015 + Visual studio build tools 2017]. When I try to run C# based unit test on environment it shows this error
TF900547: The directory containing the assemblies for the Visual Studio Test Runner is not valid ''.
Then I tried to fix the error by fallowing ways
Installed VS test agent 2015 in the machine https://learn.microsoft.com/en-us/visualstudio/test/lab-management/install-configure-test-agents
Copied C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow from my computer to exact location to CI machine.
Changed test runner from Visual Studio Test Runner to MS Test Runner
But still same error. Looks like tfs server not able to find the test agent folder. Anyone has idea how to fix this
Seems you have VS 2017 Build Tools installed only, no VS IDE on the CI environment.
You need to install VS IDE. VS build tools doesn't contain the "test
platform". In order to run the tests, you require to install full
IDE.
Currently to run the VsTest task, the task has dependency on Visual Studio IDE. But some changes will have in the near future.
We have decided to go with a 'tools installer' which can be used to
get the test platform instead of needing the IDE. If you have the IDE,
great. If you don't, the tools installer will get the test platform on
the agent for you. It is already on backlog and expected to be available on VSTS in a few sprints.
More details please take a look at the discussion in this issue: vstest capability not detected when installed without Visual Studio

VS 2015: TF900547: The directory containing the assemblies for the Visual Studio Test Runner is not valid ''

I Have VS 2015 only installed on my TFS 2013 build server, and get the following error:
TF900547: The directory containing the assemblies for the Visual Studio Test Runner is not valid ''.
Other sites say to install VS 2013, but why would I have to install VS 2013 on the build server to run unit tests when I have VS 2015 installed?
I have the following switches on my build:
/p:VisualStudioVersion=14.0 /tv:14.0
(This is not a duplicate question as I am using TFS 2013 and am trying to use the Agile Test Runner not MS Test)
Check the solution in this case:
Install VS 2015 or Microsoft Build Tools 2015.
Edit build to use a build process template called TfvcTemplate.12.xaml.
Set MSBuild arguments to /tv:14.0.
But this setting only works for build, not test. As there is no way to set the tool version or tool path for "Run VS Test Runner" activity, installing VS 2013 should be the only way to get rid of this error.
I had a similar problem - was getting the error
TF900547: The directory containing the assemblies for the Visual Studio Test Runner is not valid 'D:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow'.
It ended up being that even though Visual Studio 2015 was installed on the build agent, the user that the Build Agent was running as didn't have read/execute permissions to that folder.