Powershell: Doesn't build

Created on 18 Aug 2016  路  8Comments  路  Source: PowerShell/PowerShell

Come on people. I open the solution file, and a hundred or more files in the "gen" folder aren't found.

I try to build anyways, only to discover that that the projects are are deselected in the Configuration Manager.

I select them, hit build, it installs a bunch of NuGet stuff, and then I still get errors.

Can we please release code that actually compiles?

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.'
Unable to resolve Microsoft.WSMan.Management (>= 1.0.0) for .NETFramework,Version=v4.5.1.
NuGet Package restore failed for project Microsoft.PowerShell.Commands.Management for 'Microsoft.WSMan.Management (>= 1.0.0)'.
1>------ Build started: Project: System.Management.Automation, Configuration: CORECLR Any CPU ------
2>------ Build started: Project: PSReadLine, Configuration: CORECLR Any CPU ------
2>C:\Program Files (x86)\MSBuild\Microsoft\NuGet\Microsoft.NuGet.targets(140,5): error : Your project is not referencing the ".NETFramework,Version=v4.0,Profile=Client" framework. Add a reference to ".NETFramework,Version=v4.0,Profile=Client" in the "frameworks" section of your project.json, and then re-run NuGet restore.
1>C:\Program Files (x86)\MSBuild\Microsoft\NuGet\Microsoft.NuGet.targets(140,5): error : Your project is not referencing the ".NETFramework,Version=v4.5" framework. Add a reference to ".NETFramework,Version=v4.5" in the "frameworks" section of your project.json, and then re-run NuGet restore.
3>------ Build started: Project: Microsoft.PowerShell.ConsoleHost, Configuration: CORECLR Any CPU ------
4>------ Build started: Project: Microsoft.PowerShell.Commands.Management, Configuration: CORECLR Any CPU ------
5>------ Build started: Project: Microsoft.PowerShell.Commands.Utility, Configuration: CORECLR Any CPU ------
4>C:\Program Files (x86)\MSBuild\Microsoft\NuGet\Microsoft.NuGet.targets(140,5): error : Your project is not referencing the ".NETFramework,Version=v4.0" framework. Add a reference to ".NETFramework,Version=v4.0" in the "frameworks" section of your project.json, and then re-run NuGet restore.
3>C:\Program Files (x86)\MSBuild\Microsoft\NuGet\Microsoft.NuGet.targets(140,5): error : Your project is not referencing the ".NETFramework,Version=v4.5" framework. Add a reference to ".NETFramework,Version=v4.5" in the "frameworks" section of your project.json, and then re-run NuGet restore.
6>------ Build started: Project: powershell, Configuration: CORECLR x86 ------
5>C:\Program Files (x86)\MSBuild\Microsoft\NuGet\Microsoft.NuGet.targets(140,5): error : Your project is not referencing the ".NETFramework,Version=v4.0" framework. Add a reference to ".NETFramework,Version=v4.0" in the "frameworks" section of your project.json, and then re-run NuGet restore.
6>CSC : error CS0006: Metadata file 'D:\PowerShell\src\System.Management.Automation\bin\CORECLR\ClassLibrary.dll' could not be found
6>CSC : error CS0006: Metadata file 'D:\PowerShell\src\Microsoft.PowerShell.ConsoleHost\bin\CORECLR\Microsoft.PowerShell.ConsoleHost.dll' could not be found
========== Build: 0 succeeded, 6 failed, 0 up-to-date, 0 skipped ==========

Issue-Question Resolution-Answered

Most helpful comment

OK, well, I'm not much of command line person

That sounds a little funny considering PowerShell is a command line / shell. ;-)

All 8 comments

The solution exists to make editing code in the project easier - it is not set up to build anything.

The instructions for building are found here - right on our front page:
https://github.com/powershell/powershell#building-the-repository

Also going to throw in that while I prefer Emacs when I work on Linux, VSCode works fairly well on Windows with this project.

Indeed, I did the git clone with the --recurse option, opened the powershell.sln file with VS2015, and got the above errors. Did I miss some important step?

I would recommend going over step by step with these instructions: https://github.com/PowerShell/PowerShell/blob/master/docs/building/windows-core.md.

Maybe one of the more Windows oriented programmers can chime in, but the sln file is not setup to properly build in VS2015; it only exists for intellisense I believe. I recommend VSCode as an IDE on Windows.

_We do not recommend building the Poweshell solution from Visual Studio._

Ah ha. OK, well, I'm not much of command line person, I'll poke at the SLN file and see if I can get at working.

The recommendation you're referring to is more about opening the project.json file as a solution, which also does not work correctly, but is a different issue than the provided sln not building.

If you want to modify the solution so that it builds (and I'm sure some folks would appreciate it), you'll effectively reproduce our command line build instructions in the solution as a custom build step.

OK, well, I'm not much of command line person

That sounds a little funny considering PowerShell is a command line / shell. ;-)

I encountered a similar problem, I download the source code from an opensource called Quatz to run some official examples.
I can't build it successfully with VS2015, but it was successful in VS2013.
The error information is: "Your project is not referencing the ".NETFramework,Version=v4.0" framework. Add a reference to ".NETFramework,Version=v4.0" in the "frameworks" section of your project.json, and then re-run NuGet restore. Quartz.2010"
I didn't find the solution from the internet.

Was this page helpful?
0 / 5 - 0 ratings