How to use Visual Studio 2017 with TFS Visual Studio Build Step - tfs-2015

I am running TFS 2015 and are using the Visual Studio Build Step. On the developemnt machines I moved to use Visual Studio 2017 so I also want to use Visual Studio 2017 for the TFS builds.
I installed Visual Studio 2017 on the build server and restarted the build agent. However Visual Studio 2017 does not show up in the capabilities of the agent and it also does not show in the list of Visual Studio versions in the build step.
I know I can choose "latest" from the list of Visual Studio version in the build step, but this will still use VS 2015 as the agent does not know that it has VS 2017.
How can I make sure that the Visual Studio Build Step in TFS2015 uses Visual Studio 2017?

You can use MSBuild task instead of Visual Studio Build Step, then specify the location of MSBuild 15.0:

In TFS 2015 the build steps and forward compatibility is only updated when TFS is updated. If you are using TFS 2015.3 already then you will need to move to TFS 2017 to use this out of the box.
The build step ultimately calls out to devenv.exe and the drop down changes the path. You can call out manually to VS 2017...

Related

Missing analysis service when creating new project

I have installed SSAS and created a project. After two months working with seas, now when creating a new project, the analysis service is not available. but I can open old SSAS projects. How I can create another new SSAS project.
In Visual Studio (Open as Admin):
- Go to "Tools" >> "Extensions and Updates..."
- In the left pane, click on "Online"
- In the Search box on the top right enter "SSDT"
- check if the Extension "Microsoft Analysis Services Projects" is installed
In case it is installed and you still cannot choose Analysis Services as New Projects, you need to un-install the Extension and follow the instructions on the following website and install SSDT (SQL Server Data Tools):
https://learn.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt?view=sql-server-ver15
Visual Studio 2019: Install Extension "Microsoft Analysis Services Projects"
Visual Studio 2017: Either install Extension, if that doesn't work for you, intall SSDT with the standalone installer: Download SSDT for Visual Studio 2017 (15.9.4)
Visual Studio 2015 and earlier: Install via SSDT standalone installer required
It depends on which version of Visual Studio you are using. In 2015 everything needed to be installed via the standalone installer SSDT. In 2017 both the standalone installer and extensions exist, whereas in 2019 the standalone installer got replaced by the extensions. The super confusing part is, that there is the option to install "SSDT" during the installation of Visual Studio. Unfortunately installing SSDT during installing Visual Studio does not include Analysis/Reporting/ Integration Services.

Invalid Expression Term '.' Running Visual Studio 2017 and TFS Build 2015

I'm setting up a new CI build server using TFS Build 2015 (XAML - I know I have to move to vNEXT.) and Visual Studio 2017.
My build is breaking with Invalid expression term '.'. The code that is problematic syntax is...
addVaultAction?.Invoke(this, vault)
If replaced with...
if (addVaultAction != null)
addVaultAction.Invoke(this, valut)
... the CI build doesn't trip up.
The problematic code also compiles fine within Visual Studio 2017, but during the CI build (MSBuild) it fails.
Also, this code did exist on our previous build server which ran TFS Build 2015 and Visual Studio 2015 and the CI/MSBuild compiles completed successfully.
It would appear something is missing on my new build server. Does anyone know what that might be? Or is it that TFS 2015 and VS 2017 do not play nice together.
I've seen reference to making sure Microsoft.Net.Compilers is up to date but, if related to this problem at all, I don't know how or where to check on that.
Any help GREATLY appreciated!
Thanks!
Invalid Expression Term '.' Running Visual Studio 2017 and TFS Build 2015
You can try to use MSBuild task to build your project and specify the MSBuild version to 15.0 or the latest, or specify the MSBuild 15.0 location with radio button Specify Location, like:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe

Not able to restore nuget packages/Manage nuget packages not working in visual studio 2017

I tried to open a .Net Core solution which was working fine in 2015. Recently they added some .Net Core projects to the solution and asked us to upgrade to Visual Studio 2017 to be able to run them. We installed Visual Studio 2017 and tried to open the solution, but I am not able to build it. I get the following errors when I right-click and try to select "Manage Nuget packages".
I tried to open the PackageManager console from Tools: even this is not working
I also performed the "repair Visual Studio" process too.
Finally i resolved it by deleting my nuget.config both at project level and also in %appdata%/roaming/nuget .I think the issue is because of broken config file due to change from visual 2015 to visual studio 2017 .Not sure about the exact issue though

TFS 2015 visual studio build task does not support VS 2017

We have a build definition in TFS 2015 that have worked fine with Visual Studio 2015 projects and solutions. We have now decided to upgrade to Visual Studio 2017 and thus we would like to target Visual Studio 2017 in the Visual Studio build task. We have installed Visual Studio 2017 on the build agent. Unfortunately the only options available int the Visual Studio build task are 2012, 2013, 2015 and Latest. We have tried latest but it does not find Visual Studio 2017 on the build agent. It won't work with the msbuild task either.
I have a similiar issue and resolved by installing VS2017 in my build agent server and configuring MSBuild to point to my MSBuild 15.0 folder:
Add MSBuild to your build steps
On the Advanced options, expand and fill the 'Path to MSBuild' like the image below:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin
VS2017 RTM is released recently while TFS2015 was released before. That's why there is no VS2017 option in VS Build Task in TFS2015 Server. If you upgrade your server to the latest TFS2017, you would see "Visual Studio "15" (preview)" option listed in VS Build Task which is the version for VS2017 preview. And in the feature, the option will be updated to VS2017 which is the same as VSTS.
we are facing a similar issue and it is not possible for us to update ourselves as it is maintained on a company level where we cannot take that much influence.
However our team wanted to switch to VS2017 and make use of the C# 7 features. That's why we tried it as well with replacing the build steps from Visual Studio Build to MSBuild. Sadly this did not work as expected (we got some errors during the build).
As our main objective is to use the C# 7 features we looked for a way how to still achieve that at the time with Visual Studio 2015 remaining on the Build Server. We ended up using the nuget package Microsoft.Net.Compilers that, when used in a project, will use that compiler instead of the installed one.
More on this can be found in this Thread.
It seems the updates to the build tools are installed via the command line of the VS2017 installer.
See the docs for details.
Just adding another thing: if you're using custom build template make sure to edit it and modify the ToolPath attribute value to:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin

Reliable locate mstest.exe from msbuild

there are some questions about this around here, but none has a valid (for me) answer. The question is:
Is there a way to determine the location of mstest.exe from within a msbuild project, without hardcoding either the path or using the $(VSxxComnTools) or $(VSINSTALLDIR) variables?
Reason for the latter is, because this needs to run on a build server (non-TFS but Bamboo or TeamCity) that only has the VS Test Agents installed and not a full VS.
Additional Info: Of course, this must also work on every other machine that has msbuild, the c# compiler and mstest installed, because everybody should be able to check out the project from github, call the msbuild and everything should run just smoothly.
You could use
$(MSBuildProgramFiles32)\Microsoft Visual Studio 11.0\Common7\Ide
This assumes you are working with the same version ie 2012 of the skus on all your assets. Ofcourse you can easily create fallbacks to other versions in your project itself.
Refer Use 32bit "Program Files" directory in msbuild.
It's not elegant, but a reliable way to find the latest MSTest.exe installed on a host is
<MSTestPath Condition="'$(MSTestPath)'=='' And Exists('$(MSBuildProgramFiles32)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe')">$(MSBuildProgramFiles32)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe</MSTestPath>
<MSTestPath Condition="'$(MSTestPath)'=='' And Exists('$(MSBuildProgramFiles32)\Microsoft Visual Studio 13.0\Common7\IDE\MSTest.exe')">$(MSBuildProgramFiles32)\Microsoft Visual Studio 13.0\Common7\IDE\MSTest.exe</MSTestPath>
<MSTestPath Condition="'$(MSTestPath)'=='' And Exists('$(MSBuildProgramFiles32)\Microsoft Visual Studio 12.0\Common7\IDE\MSTest.exe')">$(MSBuildProgramFiles32)\Microsoft Visual Studio 12.0\Common7\IDE\MSTest.exe</MSTestPath>
<MSTestPath Condition="'$(MSTestPath)'=='' And Exists('$(MSBuildProgramFiles32)\Microsoft Visual Studio 11.0\Common7\IDE\MSTest.exe')">$(MSBuildProgramFiles32)\Microsoft Visual Studio 11.0\Common7\IDE\MSTest.exe</MSTestPath>
<MSTestPath Condition="'$(MSTestPath)'=='' And Exists('$(MSBuildProgramFiles32)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe')">$(MSBuildProgramFiles32)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe</MSTestPath>
<MSTestPath Condition="'$(MSTestPath)'=='' And Exists('$(MSBuildProgramFiles32)\Microsoft Visual Studio 9.0\Common7\IDE\MSTest.exe')">$(MSBuildProgramFiles32)\Microsoft Visual Studio 9.0\Common7\IDE\MSTest.exe</MSTestPath>
You could add an machine environment variable that points to it and reference that in msbuild? So if you added the var MSTEST_HOME you could use $(MSTEST_HOME) in msbuild?