Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto generation of feature.cs fails when using MSBuild that comes with VS2015 #471

Closed
johnfettig opened this issue Aug 10, 2015 · 29 comments

Comments

@johnfettig
Copy link

It appears that there is some problem using MSBuild that comes with VS2015. I would like the feature.cs files to be auto-generated, so I have added

   <Import Project="path\to\nuget-packages\SpecFlow.1.9.0\tools\TechTalk.SpecFlow.targets" />

to my .csproj. This worked fine with the MSBuild that came with VS2013, but now it results in this error:

"nuget-packages\SpecFlow.1.9.0\tools\TechTalk.SpecFlow.targets(47,5): error : Unable to cast object of type 'System.Xml.XmlComment' to type 'System.Xml.XmlElement'."

Googling this error shows that other people are having this problem too: http://forum.ncrunch.net/yaf_postst1608_Build-fails-with-VS-2015-RTM.aspx

@TerribleDev
Copy link

👍 we are having this problem as well....

@SeaGees
Copy link

SeaGees commented Sep 1, 2015

I've got exactly the same problem. If you edit the .csproj file and change the <Project ToolsVersion="14.0" to "12.0", which is the value for the previous version of Visual Studio, specflow runs happily.

It looks like specflow is not able to cope with a ToolsVersion of 14.
This problem won't be seen using the Visual Studio integration because it won't be reading the .csproj file directly.

@johnfettig
Copy link
Author

I don't have this issue when using the generator from v2, so hopefully this will be resolved when v2 is released.

@mikeblakeuk
Copy link

+1

@stajs
Copy link

stajs commented Oct 30, 2015

I've been trying to hack around the lack of support for dnx projects (.xproj) by generating a fake .csproj and calling specflow.exe against that on the command line. I was also at the point of getting the " Unable to cast object of type 'System.Xml.XmlComment' to type 'System.Xml.XmlElement'" and @SeaGees suggestion of referencing the previous ToolsVersion/Visual Studio worked for me.

@markwinspear
Copy link

+1

2 similar comments
@marhoily
Copy link

marhoily commented Nov 5, 2015

+1

@dprochownik
Copy link

+1

@andrebires
Copy link

Same problem here, but only when building it with NCrunch. A workaround for his case can be found here:
http://forum.ncrunch.net/yaf_postst1608_Build-fails-with-VS-2015-RTM.aspx

@darrencauthon
Copy link
Contributor

Hmm, looking at this, this actually looks like a real issue that needs to get resolved with SpecFlow. I have not yet run SpecFlow with VS 2015, so perhaps someone with more exp in that can help.

Without any background, I'd first be looking around that "tools version" brought up by @SeaGees .

@samholder
Copy link
Contributor

I was under the impression that the issue was resolved in the v2 branch,
based on an earlier comment.
On 6 Nov 2015 18:28, "Darren Cauthon" notifications@github.com wrote:

Hmm, looking at this, this actually looks like a real issue that needs to
get resolved with SpecFlow. I have not yet run SpecFlow with VS 2015, so
perhaps someone with more exp in that can help.

Without any background, I'd first be looking around that "tools version"
brought up by @SeaGees https://github.com/SeaGees .


Reply to this email directly or view it on GitHub
#471 (comment).

@darrencauthon
Copy link
Contributor

@samholder Oh I see this now, the comment from @johnfettig .

I wonder if we should label this as ready for resolution after v2 is released?

Oh, which reminds me...

@stajs
Copy link

stajs commented Nov 10, 2015

I'd be happy to see this fixed in v2, but in the meantime, as I mentioned earlier (and in case anyone else is interested) I hacked together this as a workaround. The main part is this gulpfile.js, which can be then run by the built in Task Runner in VS2015:

image

I haven't, but you could also set the gulp task as a pre-build step in the project.json. The basic action is generate a fake .csproj so that the command linespecflow.exe can run against it. I've gone a couple of steps further to also generate a specflow.exe.config so I can target .NET 4.6, and fix the generated files to work with xUnit 2.

image

You can then see and run your SpecFlow tests from within the VS2015 Test Explorer:

image

@darrencauthon
Copy link
Contributor

@stajs Thank you for going into such good detail on this issue! It's given me a better view into what's going on.

I might be hoping into this on a new instance of VS 2015 in December... but if someone wants to beat me to this, feel free! :)

@stajs
Copy link

stajs commented Nov 10, 2015

Apologies all round, I think I've hijacked this thread: the original topic was in regards to MSBuild, where as I'm working around the "SpecFlow for Visual Studio 2015" extension not generating .feature.cs files in .xproj's. They might be related though, I'm not sure.

@darrencauthon Hope you are not waiting on Santa to bring you VS2015 😜

@darrencauthon
Copy link
Contributor

@stajs Well, VS2015 is easy for me now, the free version is functional with SpecFlow now (I think, haven't verified). It's a Windows computer that has been my hurdle. I might have to have one for work soon, so I'll finally be back. Can you believe I've been working on SpecFlow through mono on my Mac for the past few years? 👅

@stajs
Copy link

stajs commented Nov 11, 2015

:brain_splode:

@stajs
Copy link

stajs commented Nov 18, 2015

In a bid to stop the hijacking of this thread, I've moved my discussion to the Google Group (and also created a NuGet package to generate .feature.cs files in .xproj's).

@andresd24
Copy link

please, has anyone resolved this. @stajs thanks for the workaround but I'm not able to reference DNX.. also we are looking for solution that doesn't involve adding so much code. any help will be greatly appreciated. thanks!!

@jemerald
Copy link

@andresd24 try change
Project ToolsVersion="14.0"
to
Project ToolsVersion="12.0"
in the csproj file?

@andresd24
Copy link

yes

On Tue, Apr 12, 2016 at 12:21 AM, Jackie Weng notifications@github.com
wrote:

@andresd24 https://github.com/andresd24 try change
Project ToolsVersion="14.0"
to
Project ToolsVersion="12.0"
in the csproj file?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#471 (comment)

@saquibmian
Copy link

I'm having the same issue with VS2015 Update 2. Was this resolved?

@samholder
Copy link
Contributor

samholder commented May 13, 2016

if you are using 1.9 in 2015 then you need to change
Project ToolsVersion="14.0"
to
Project ToolsVersion="12.0"
in the csproj file.

I thought it had been fixed for 2.0 in VS2015

@saquibmian
Copy link

@samholder But that means that I can't use C#6 features, doesn't it? I.e., no Roslyn.

@samholder
Copy link
Contributor

It would mean that I think yes. But as I said I think it's working for 2.0,
so it's only a work around for 1.9
On 13 May 2016 7:55 p.m., "Saquib Mian" notifications@github.com wrote:

@samholder https://github.com/samholder But that means that I can't use
C#6 features, doesn't it? I.e., no Roslyn.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#471 (comment)

@saquibmian
Copy link

Ah I missed that, my apologies. Thanks!

@SabotageAndi
Copy link
Contributor

As it is working for 2.0+, we are closing this issue.
If you have this problem in the actual version, please reopen the issue.

@jkarthick89
Copy link

Changing Project ToolsVersion to "12.0". Works well !! Thank you.

@lock
Copy link

lock bot commented Jul 9, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests