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

VS2015 Update 1: MVC build fails with error MSB4064: The "Features" parameter is not supported by the "Csc" tas #1537

Closed
mlidbom opened this issue Mar 22, 2016 · 64 comments

Comments

@mlidbom
Copy link

mlidbom commented Mar 22, 2016

There are a few twists to when you encounter this bug.
I eventually found that it occurs every time if:

  • Packages are restored before build starts.
  • The obj folder is missing
  • The bin folder is missing

I've attached a zip with a repro solution.
Run build-fails.bat to see the build fail.
Run build-succeeds.bat to see the build succeed.

Edit: Seems the problem occurs with VS2015 Update 1. I'm afraid this likely means that every paket user with an MVC project will start to see their builds failing when they update.

Edit2: The exact error from the build log:

2>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.CSharp.Core.targets(88,11): error MSB4064: The "Features" parameter is not supported by the "Csc" task. Verify the parameter exists on the task, and it is a settable public instance property.
2>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.CSharp.Core.targets(67,5): error MSB4063: The "Csc" task could not be initialized with its input parameters. 

PaketBugRepro.zip

@inosik
Copy link
Contributor

inosik commented Mar 22, 2016

Strangely enough, both scripts work on my machine.

And actually, it shouldn't make any difference, since paket.targets already does paket restore before building.

There is somebody else having the same issue at StackOverflow and at the Roslyn repo (dotnet/roslyn#9538).

@mlidbom
Copy link
Author

mlidbom commented Mar 22, 2016

That is strange indeed.
I'm running in in the "Developer Command Prompt for VS2015"
Are you using the same version?

@inosik
Copy link
Contributor

inosik commented Mar 22, 2016

I don't have VS 2015 on this machine, only up to 2013.

So this is some MSBuild f**kery going on here, not an Paket issue.

@Stift
Copy link
Contributor

Stift commented Mar 22, 2016

I only can reproduce it when I explicitly use C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe

@mlidbom
Copy link
Author

mlidbom commented Mar 22, 2016

It may well be msbuild related, but before paket modified the csproj file it worked just fine.
I on the other hand don't have VS2013 on this machine. Will try to see if I can borrow one to see if I can verify that it works on VS2013.

@mlidbom
Copy link
Author

mlidbom commented Mar 22, 2016

Well it worked with "Developer Command Prompt for VS2012". So it does seem to be related to msbuild versions.

@Stift
Copy link
Contributor

Stift commented Mar 22, 2016

A little bit strange. The documentation of the Csc Task does not say anything about a Features Property (https://msdn.microsoft.com/en-us/library/s5c8athz%28v=vs.140%29.aspx)

@mlidbom
Copy link
Author

mlidbom commented Mar 22, 2016

And I just failed to recreate on another workstation that does have VS2015.
Even when I used the exact path to msbuild as Stift did.

That machine however did not have VS2015 Update 1 nor is it a Windows 10 machine like mine.
So Windows 10 and/or update 1 of VS2015 might be relevant.
Edit: I'm updating the other machine to update 1 to see if that breaks things.

@Stift: Do you have Update 1 and/or Windows 10?

@mlidbom
Copy link
Author

mlidbom commented Mar 22, 2016

Confirmed. It seems the problem occurs once you upgrade to VS2015 Update 1.
I'm afraid that may well mean that every MVC project using paket will stop working once the developers upgrade to VS2015 Update 1 .

@mlidbom mlidbom changed the title Converted MVC project build fails with error MSB4064: The "Features" parameter is not supported by the "Csc" task VS2015h Update 1: MVC build fails with error MSB4064: The "Features" parameter is not supported by the "Csc" task Mar 22, 2016
@mlidbom mlidbom changed the title VS2015h Update 1: MVC build fails with error MSB4064: The "Features" parameter is not supported by the "Csc" task VS2015 Update 1: MVC build fails with error MSB4064: The "Features" parameter is not supported by the "Csc" tas Mar 22, 2016
@forki
Copy link
Member

forki commented Mar 23, 2016

can I get a TLDR? What's the exact issue?

@Stift
Copy link
Contributor

Stift commented Mar 23, 2016

the props files don't get imported. in this case for microsoft.net.compilers

@Stift
Copy link
Contributor

Stift commented Mar 23, 2016

Oh. I see - They are imported but at the end of the file. VS puts them on top of the csproj. When I put manually the paket stuff on top, it works.

@forki
Copy link
Member

forki commented Mar 23, 2016

It doesn't get imported? at all? or just too late? what do we need to change? XML looks correct to me.

@Stift
Copy link
Contributor

Stift commented Mar 23, 2016

Repro: Create a MVC project in VS 2015, convert it to paket, run C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe (VS 2015 Update 1)

@Stift
Copy link
Contributor

Stift commented Mar 23, 2016

xml looks okay, but position seems to play a role.

@mlidbom
Copy link
Author

mlidbom commented Mar 23, 2016

Ah, then this might be related to(possibly a duplicate) #1487

@mlidbom
Copy link
Author

mlidbom commented Mar 23, 2016

Repro: Create a MVC project in VS, convert it to paket, run C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe (VS 2015 Update 1)

@forki @Stift
That is excactly what I did to create the attached Zip. The Zip contains a git repo with the steps as separate commits along with the scripts to recreate the problem.

@forki
Copy link
Member

forki commented Mar 23, 2016

ok looks like I have an idea how to fix this.

If we move the props up to right after the property groups (See https://gist.github.com/forki/479c1c8e355e69e165af#file-test-csproj-L44) then it builds for me.

@Stift
Copy link
Contributor

Stift commented Mar 23, 2016

i think it could also have to do with the package itself. I have to recheck but it seems newer versions of net.compilers package works fine

@Stift
Copy link
Contributor

Stift commented Mar 23, 2016

Ok.
When I do .paket\paket.exe update nuget Microsoft.net.Compilers version 1.1.1 & "c:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" /t:Rebuild then it works.
But .paket\paket.exe update nuget Microsoft.net.Compilers version 1.0.0 & "c:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" /t:Rebuild fails.

@mlidbom could you also reproduce this. Because then it seems to be a problem in the package.

@mlidbom
Copy link
Author

mlidbom commented Mar 23, 2016

@forki With the real problem solution (not the minimal repro havent tested with that) it only seems to work for me if I move the props to the very top of the csproj. Right below the imports Microsoft.TypeScript.Default.props and Microsoft.Common.props

Note that once you get it building you have to delete the obj and bin folder to recreate the problem again. It is easy to miss and believe that something works even though it does not.

@forki
Copy link
Member

forki commented Mar 23, 2016

I did that. the file in the gist works fine for me. But it needs to be right after the propertygroups - otherwise it doesn't know which target framework was set

@mlidbom
Copy link
Author

mlidbom commented Mar 23, 2016

Ah, most likely me not doing the edits correctly then. I don't speak msbuild :)

@forki
Copy link
Member

forki commented Mar 23, 2016

I don't speak msbuild :)

Nobody does.

My strategy:

strategy

@mlidbom
Copy link
Author

mlidbom commented Mar 23, 2016

:)

@inosik
Copy link
Contributor

inosik commented Mar 23, 2016

I bet if you remove the framework restriction from paket.dependencies and run paket install, it would work again.

If so, the solution would be, to import the .props file without the conditional __paket__... stuff, if the file is not framework-specific, regardless of the framework restriction.

@mlidbom
Copy link
Author

mlidbom commented Mar 23, 2016

I'm having real trouble trying to upgrade the compiler package in the problem solution.
Every time I run paket update it "automagically" downgrades all preversion packages to a non-preversion version. This breaks the compile completely

Is this a bug? If I explicitly ask for an upgrade of a singe package, should paket go ahead and downgrade each preversion packages automatically? Actually I find it odd to say the least that it would silently downgrade any package during any update operation....

@forki
Copy link
Member

forki commented Mar 24, 2016

thanks. Let's do it then.

@Stift
Copy link
Contributor

Stift commented Mar 24, 2016

And with that I just found another bug in the bootstrapper. Not a serious one. Will take care about this after Easter.

@cdrnet
Copy link
Member

cdrnet commented Mar 30, 2016

Since the property definitions depend on $(TargetFrameworkIdentifier) it seems to me in C# projects they need to be defined after <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />. Otherwise none of the properties actually get defined and thus none of the targets being included. Unfortunately if I fix my build manually by moving the Microsoft.CSharp.targets up again it automatically moves it back down on each paket.exe install and breaking the build again.

@forki
Copy link
Member

forki commented Mar 30, 2016

See https://github.com/fsprojects/Paket/blob/master/src/Paket.Core/ProjectFile.fs#L949

If you could send a PR which moves "k" right behind that node (if it exists) then this would be awesome.

@cdrnet
Copy link
Member

cdrnet commented Mar 30, 2016

So we would have the following indices? That would not break the MVC issue again?

Import-1
Import-2
-> j
PropertyGroup-1
PropertyGroup-2
-> k (old)
Import-3
Import-4
-> k (new)
Other...

@forki
Copy link
Member

forki commented Mar 30, 2016

That would not break the MVC issue again

don't think so. It's still very "high" in the xml.

@cdrnet
Copy link
Member

cdrnet commented Mar 30, 2016

I've just realized you actually proposed to move it right behind Microsoft.CSharp.targets in general (if it exists), not only in cases it had been moved up as in my workaround.

Should it look specifically for <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />?

@forki
Copy link
Member

forki commented Mar 30, 2016

yes I think that would be better

@forki
Copy link
Member

forki commented Mar 30, 2016

actually I think that would indeed fix all the current issues. (until we find the next one)

@forki
Copy link
Member

forki commented Mar 30, 2016

see #1564

@forki
Copy link
Member

forki commented Mar 30, 2016

please try with 2.57.1

@forki
Copy link
Member

forki commented Apr 3, 2016

@mlidbom does it still work for you?

@mlidbom
Copy link
Author

mlidbom commented Apr 4, 2016

I'm afraid not (Actually I don't think it ever did. I must have screwed up testing it somehow. Sorry.).
From my experimenting it seems as though we have a catch 22 style situation here:

  • The two prop file imports have to happen before the csharp targets import. If they are imported after we get the error: The "Features" parameter is not supported by the "Csc" task.
  • The two prop files imports cannot happen before the csharp targets import since $(TargetFrameworkIdentifier) is not defined before we import the csharp targets and $(TargetFrameworkIdentifier) is one of the conditions that we use to define if we should import the prop files.

I'm attaching a zip with a git repository that attempts to illustrate this with different branches and commits.

PaketBugRepro.zip

@forki
Copy link
Member

forki commented Apr 4, 2016

but it still works with latest version of said package?

@mlidbom
Copy link
Author

mlidbom commented Apr 4, 2016

I was about to say no until I checked and it turns out that there are two new stable versions.

Version 1.1.1 no longer works. I get error MSB4064: The "PublicSign" parameter is not supported by the "Csc" task. Likely related to me having updated to update 2 of VS2015.

But luckily it does work with the 1.2.0 and 1.2.1 versions of the package that were both released March 31.

@forki
Copy link
Member

forki commented Apr 4, 2016

so latest version of the package works with latest version of paket?

@mlidbom
Copy link
Author

mlidbom commented Apr 4, 2016

Yes.

@kjellski
Copy link
Contributor

kjellski commented May 4, 2016

Hi there,
I'm currently getting the same error. I'm using Paket 2.63.3.0

I've recently installed the VS15 Pre, might that be something to take into consideration?

If I create a new Asp.Net Web application with MVC4, I can build it fine. Then I've just opened up paket and tried a "convert-from-nuget" and afterwards it fails with this error.

cscfail

This is the paket.dependencies file created:

paket.dependencies.txt

Can I provide any other information to guide you?

@forki
Copy link
Member

forki commented May 4, 2016

Can you please create a sample with the broken csproj and a manually fixed version?

@kjellski
Copy link
Contributor

kjellski commented May 4, 2016

@forki I've got no clue about how to fix this, but here is a link to the example: https://github.com/kjellski/paket-conver-from-nuget-example

@forki
Copy link
Member

forki commented May 4, 2016

Did you try to update like it was described above?

@kjellski
Copy link
Contributor

kjellski commented May 4, 2016

@forki I'm really sorry, I must have missed the instructions... should I try to reproduce with version 3.0.0-beta028 of paket or how can I try to fix this by myself? I don't understand how you rearranged the xml to be honest... :/

@forki
Copy link
Member

forki commented May 4, 2016

I meant did you try to use the latest packages. There was a bug in on of
the older versions that made only work with nuget. But AFAIK the latest
fixes made it work with paket.
On May 4, 2016 1:06 PM, "Kjellski" notifications@github.com wrote:

@forki https://github.com/forki I'm really sorry, I must have missed
the instructions... should I try to reproduce with version 3.0.0-beta028 of
paket or how can I try to fix this by myself? I don't understand how you
rearranged the xml to be honest... :/


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

@kjellski
Copy link
Contributor

kjellski commented May 4, 2016

Ah, no, I've just created a brand new project from VS2015 and let it do its thing, then I've made sure to build and run it once to confirm it's working. After that, I've used "paket convert-from-nuget" and let it do its thing. Afterwards it was broken. I've not updated anything.

@forki
Copy link
Member

forki commented May 4, 2016

Yes. I understand. But as described above that's not going to work with our
choose nodes. Paket only works with the fixed nuget packages. I know that
the older ones work with nuget, but that's because of different structure
in the csproj.

I know this sounds stupid, but I think there is nothing we can do here. You
need to update to newer versions of the packages and then I hope it's going
to work again.
On May 4, 2016 1:10 PM, "Kjellski" notifications@github.com wrote:

Ah, no, I've just created a brand new project from VS2015 and let it do
its thing, then I've made sure to build and run it once to confirm it's
working. After that, I've used "paket convert-from-nuget" and let it do its
thing. Afterwards it was broken. I've not updated anything.


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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants