Skip to content
This repository has been archived by the owner on Nov 7, 2019. It is now read-only.

Tools version is unsupported #56

Closed
TimMurphy opened this issue Sep 23, 2017 · 6 comments
Closed

Tools version is unsupported #56

TimMurphy opened this issue Sep 23, 2017 · 6 comments

Comments

@TimMurphy
Copy link
Contributor

The xunit sample in this repository does not build spec.cs files on my machine.

Withing the build output there is a call to specflow.exe generateall and it generates the following error:

The tools version "14.0" is unrecognized. Available tools versions are "2.0", "3.5", "4.0".  D:\Downloads\SpecFlow.NetCore-master\SpecFlow.NetCore-master\samples\VS2017\SpecFlow 2.1.0\net461\Sample.Website.Tests.XUnit\Sample.Website.Tests.XUnit.csproj.fake.csproj

I receive the same error from the developer command line using a manually created 'fake.csproj' file.

Is the issue caused because I only have Visual Studio 2017 on my machine? Does the project build successfully on machines with VS 2015 installed as well?

I'm aware of Issue #49 but that issue was closed because Target Framework is not supported.

Full build log.

Restoring NuGet packages...
To prevent NuGet from restoring packages during build, open the Visual Studio Options dialog, click on the Package Manager node and uncheck 'Allow NuGet to download missing packages during build.'
1>------ Rebuild All started: Project: Sample.Website, Configuration: Debug Any CPU ------
1>Sample.Website -> D:\Downloads\SpecFlow.NetCore-master\SpecFlow.NetCore-master\samples\VS2017\SpecFlow 2.1.0\net461\Sample.Website\bin\Debug\net461\win7-x86\Sample.Website.exe
2>------ Rebuild All started: Project: Sample.Website.Tests.XUnit, Configuration: Debug Any CPU ------
2>Found: C:\Users\tim\.nuget\packages\SpecFlow\2.1.0\tools\specflow.exe
2>Current directory: D:\Downloads\SpecFlow.NetCore-master\SpecFlow.NetCore-master\samples\VS2017\SpecFlow 2.1.0\net461\Sample.Website.Tests.XUnit
2>Found: D:\Downloads\SpecFlow.NetCore-master\SpecFlow.NetCore-master\samples\VS2017\SpecFlow 2.1.0\net461\Sample.Website.Tests.XUnit\Sample.Website.Tests.XUnit.csproj
2>Generating fake csproj.
2><?xml version="1.0" encoding="utf-8"?>
2><Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2>	<PropertyGroup>
2>		<RootNamespace>SpecFlow.GeneratedTests</RootNamespace>
2>		<AssemblyName>SpecFlow.GeneratedTests</AssemblyName>
2>	</PropertyGroup>
2>	<ItemGroup>
2>		<None Include="app.config">
2>			<SubType>Designer</SubType>
2>		</None>
2>		<None Include="Root.feature">
2>			<Generator>SpecFlowSingleFileGenerator</Generator>
2>			<LastGenOutput>Root.feature.cs</LastGenOutput>
2>		</None>
2>		<None Include="Folder\Folder.feature">
2>			<Generator>SpecFlowSingleFileGenerator</Generator>
2>			<LastGenOutput>Folder.feature.cs</LastGenOutput>
2>		</None>
2>	</ItemGroup>
2></Project>
2>Saving: D:\Downloads\SpecFlow.NetCore-master\SpecFlow.NetCore-master\samples\VS2017\SpecFlow 2.1.0\net461\Sample.Website.Tests.XUnit\Sample.Website.Tests.XUnit.csproj.fake.csproj
2>Found xunit in D:\Downloads\SpecFlow.NetCore-master\SpecFlow.NetCore-master\samples\VS2017\SpecFlow 2.1.0\net461\Sample.Website.Tests.XUnit\Sample.Website.Tests.XUnit.csproj
2>Validating app.config.
2>Found xunit in D:\Downloads\SpecFlow.NetCore-master\SpecFlow.NetCore-master\samples\VS2017\SpecFlow 2.1.0\net461\Sample.Website.Tests.XUnit\Sample.Website.Tests.XUnit.csproj
2>Calling: C:\Users\tim\.nuget\packages\SpecFlow\2.1.0\tools\specflow.exe generateall "D:\Downloads\SpecFlow.NetCore-master\SpecFlow.NetCore-master\samples\VS2017\SpecFlow 2.1.0\net461\Sample.Website.Tests.XUnit\Sample.Website.Tests.XUnit.csproj.fake.csproj" /force /verbose
2>The tools version "14.0" is unrecognized. Available tools versions are "2.0", "3.5", "4.0".  D:\Downloads\SpecFlow.NetCore-master\SpecFlow.NetCore-master\samples\VS2017\SpecFlow 2.1.0\net461\Sample.Website.Tests.XUnit\Sample.Website.Tests.XUnit.csproj.fake.csproj
2>
2>Removing: D:\Downloads\SpecFlow.NetCore-master\SpecFlow.NetCore-master\samples\VS2017\SpecFlow 2.1.0\net461\Sample.Website.Tests.XUnit\Sample.Website.Tests.XUnit.csproj.fake.csproj
2>Fixing SpecFlow generated files
2>New file generated: D:\Downloads\SpecFlow.NetCore-master\SpecFlow.NetCore-master\samples\VS2017\SpecFlow 2.1.0\net461\Sample.Website.Tests.XUnit\Root.feature.cs. No tests in Root.feature will be discovered by 'dotnet test'
2>New file generated: D:\Downloads\SpecFlow.NetCore-master\SpecFlow.NetCore-master\samples\VS2017\SpecFlow 2.1.0\net461\Sample.Website.Tests.XUnit\Folder\Folder.feature.cs. No tests in Folder.feature will be discovered by 'dotnet test'
2>Rebuild to make the above files discoverable, see https://github.com/stajs/SpecFlow.NetCore/issues/22.
2>SpecFlow fixed.
2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1987,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "D:\Downloads\SpecFlow.NetCore-master\SpecFlow.NetCore-master\samples\VS2017\SpecFlow 2.1.0\net461\Sample.Website\bin\Debug\net461\win7-x86\Sample.Website.exe", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
2>Sample.Website.Tests.XUnit -> D:\Downloads\SpecFlow.NetCore-master\SpecFlow.NetCore-master\samples\VS2017\SpecFlow 2.1.0\net461\Sample.Website.Tests.XUnit\bin\Debug\net461\Sample.Website.Tests.XUnit.dll
2>Done building project "Sample.Website.Tests.XUnit.csproj".
========== Rebuild All: 2 succeeded, 0 failed, 0 skipped ==========
@stajs
Copy link
Owner

stajs commented Sep 24, 2017

Is the issue caused because I only have Visual Studio 2017 on my machine? Does the project build successfully on machines with VS 2015 installed as well?

Hmm, good question. I don't have a machine with only VS2017 to test. It's unexpected, but plausible.

I'll see if I can get some time later to have a look.

@smudge202
Copy link
Contributor

ToolsVersion typically refers to MSBuild version, so yes, only having VS2017 which comes with MSBuild version 15.0 is definitely the problem.

The cause is here:

<Project ToolsVersion=""14.0"" DefaultTargets=""Build"" xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">

This will need to be made configurable or a lookup performed prior to injection of this xml.

@stajs
Copy link
Owner

stajs commented Sep 26, 2017

Ah yep, that makes sense.

A general thought is that it's the call to SpecFlow that is failing on the ToolsVersion and it might not be able to handle later versions. I haven't run any tests to prove that thought and I'm also not going to be uninstalling VS2015 any time soon to test this. I'm open to making it configurable if anyone wants to make a PR and do the testing...

@smudge202
Copy link
Contributor

I suspect the best approach is to discover the tools version, but I'm not sure what the best approach for that would be. I wonder if you can use MSBuild conditions or if there are build variables available to use so that we don't have to specify the constant 14. I'm afraid I don't know enough about msbuild to do that and nowhere near the time required to research it. Hopefully the info/ideas are of use to someone willing to pick this up though

@stajs
Copy link
Owner

stajs commented Sep 26, 2017

@smudge202 Thanks for your thoughts. I'm in a similar position; I also don't know enough about MSBuild to be helpful and I don't know if/when I would get around to investigating this.

@TimMurphy You can download/install MSBuild separately to Visual Studio. If you don't want to install VS2015 you could try just installing the required standalone version of MSBuild as a workaround.

@TimMurphy
Copy link
Contributor Author

@stajs Apologies for delay in responding. GitHub failed to send notifications and now days I'm a part-time programmer.

Instead of needing to configure my machine correctly I'll have a crack at creating a PR.

TimMurphy added a commit to TimMurphy/SpecFlow.NetCore that referenced this issue Oct 22, 2017
Resolved stajs#56 with a new optional command line argument --tools-version.

--tools-version defaults to 14.0. When running SpecFlow.NetCore on an machine with only Visual Studio 2017 installed then set --tools-version to 4.0.
TimMurphy added a commit to TimMurphy/SpecFlow.NetCore that referenced this issue Oct 22, 2017
Resolved stajs#56 with a new optional command line argument --tools-version.

--tools-version defaults to 14.0. When running SpecFlow.NetCore on an machine with only Visual Studio 2017 installed then set --tools-version to 4.0.
TimMurphy added a commit to TimMurphy/SpecFlow.NetCore that referenced this issue Oct 22, 2017
Resolved stajs#56 with a new optional command line argument --tools-version.

--tools-version defaults to 14.0. When running SpecFlow.NetCore on an machine with only Visual Studio 2017 installed then set --tools-version to 4.0.
@stajs stajs closed this as completed in #59 Oct 24, 2017
stajs pushed a commit that referenced this issue Oct 24, 2017
* Make tools version configurable

Resolved #56 with a new optional command line argument --tools-version.

--tools-version defaults to 14.0. When running SpecFlow.NetCore on an machine with only Visual Studio 2017 installed then set --tools-version to 4.0.

* Set toolsVerision to "14.0" in the optional argument instead of having it as nul
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants