Skip to content

Unable to build from command line: restore.cmd/build.cmd fails #33411

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

Closed
shirhatti opened this issue Jun 9, 2021 · 14 comments
Closed

Unable to build from command line: restore.cmd/build.cmd fails #33411

shirhatti opened this issue Jun 9, 2021 · 14 comments
Labels
area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework good first issue Good for newcomers.

Comments

@shirhatti
Copy link
Contributor

shirhatti commented Jun 9, 2021

Describe the bug

Unable to build from command line: restore.cmd/build.cmd fails.

(Running .\build.cmd /p:BuildNative=false also fails)

To Reproduce

Running restore.cmd fails on main ( which is currently at 0ecf4c1)

Exceptions (if any)

Build FAILED.

C:\Users\shirh\source\repos\aspnetcore\src\Servers\IIS\AspNetCoreModuleV2\AspNetCore\AspNetCore.vcxproj(39,3): error MSB4019: The imported project "C:\Users\shirh\source\repos\aspnetcore\.tools\msbuild\16.5.0-
alpha\tools\MSBuild\Microsoft\VC\v160\Microsoft.Cpp.Default.props" was not found. Confirm that the expression in the Import declaration "C:\Users\shirh\source\repos\aspnetcore\.tools\msbuild\16.5.0-alpha\tools
\MSBuild\Microsoft\VC\v160\\Microsoft.Cpp.Default.props" is correct, and that the file exists on disk.
C:\Users\shirh\source\repos\aspnetcore\src\Servers\IIS\AspNetCoreModuleV2\IISLib\IISLib.vcxproj(36,3): error MSB4019: The imported project "C:\Users\shirh\source\repos\aspnetcore\.tools\msbuild\16.5.0-alpha\to
ols\MSBuild\Microsoft\VC\v160\Microsoft.Cpp.Default.props" was not found. Confirm that the expression in the Import declaration "C:\Users\shirh\source\repos\aspnetcore\.tools\msbuild\16.5.0-alpha\tools\MSBuild
\Microsoft\VC\v160\\Microsoft.Cpp.Default.props" is correct, and that the file exists on disk.
C:\Users\shirh\source\repos\aspnetcore\src\Servers\IIS\AspNetCoreModuleV2\InProcessRequestHandler\InProcessRequestHandler.vcxproj(38,3): error MSB4019: The imported project "C:\Users\shirh\source\repos\aspnetc
ore\.tools\msbuild\16.5.0-alpha\tools\MSBuild\Microsoft\VC\v160\Microsoft.Cpp.Default.props" was not found. Confirm that the expression in the Import declaration "C:\Users\shirh\source\repos\aspnetcore\.tools\
msbuild\16.5.0-alpha\tools\MSBuild\Microsoft\VC\v160\\Microsoft.Cpp.Default.props" is correct, and that the file exists on disk.
C:\Users\shirh\source\repos\aspnetcore\src\Servers\IIS\AspNetCoreModuleV2\OutOfProcessRequestHandler\OutOfProcessRequestHandler.vcxproj(38,3): error MSB4019: The imported project "C:\Users\shirh\source\repos\a
spnetcore\.tools\msbuild\16.5.0-alpha\tools\MSBuild\Microsoft\VC\v160\Microsoft.Cpp.Default.props" was not found. Confirm that the expression in the Import declaration "C:\Users\shirh\source\repos\aspnetcore\.
tools\msbuild\16.5.0-alpha\tools\MSBuild\Microsoft\VC\v160\\Microsoft.Cpp.Default.props" is correct, and that the file exists on disk.
C:\Users\shirh\source\repos\aspnetcore\src\Servers\IIS\AspNetCoreModuleV2\RequestHandlerLib\RequestHandlerLib.vcxproj(36,3): error MSB4019: The imported project "C:\Users\shirh\source\repos\aspnetcore\.tools\m
sbuild\16.5.0-alpha\tools\MSBuild\Microsoft\VC\v160\Microsoft.Cpp.Default.props" was not found. Confirm that the expression in the Import declaration "C:\Users\shirh\source\repos\aspnetcore\.tools\msbuild\16.5
.0-alpha\tools\MSBuild\Microsoft\VC\v160\\Microsoft.Cpp.Default.props" is correct, and that the file exists on disk.
C:\Users\shirh\source\repos\aspnetcore\src\Servers\IIS\AspNetCoreModuleV2\RequestHandlerLib\RequestHandlerLib.vcxproj(36,3): error MSB4019: The imported project "C:\Users\shirh\source\repos\aspnetcore\.tools\m
sbuild\16.5.0-alpha\tools\MSBuild\Microsoft\VC\v160\Microsoft.Cpp.Default.props" was not found. Confirm that the expression in the Import declaration "C:\Users\shirh\source\repos\aspnetcore\.tools\msbuild\16.5
.0-alpha\tools\MSBuild\Microsoft\VC\v160\\Microsoft.Cpp.Default.props" is correct, and that the file exists on disk.
C:\Users\shirh\source\repos\aspnetcore\src\Servers\IIS\AspNetCoreModuleV2\IISLib\IISLib.vcxproj(36,3): error MSB4019: The imported project "C:\Users\shirh\source\repos\aspnetcore\.tools\msbuild\16.5.0-alpha\to
ols\MSBuild\Microsoft\VC\v160\Microsoft.Cpp.Default.props" was not found. Confirm that the expression in the Import declaration "C:\Users\shirh\source\repos\aspnetcore\.tools\msbuild\16.5.0-alpha\tools\MSBuild
\Microsoft\VC\v160\\Microsoft.Cpp.Default.props" is correct, and that the file exists on disk.
C:\Users\shirh\source\repos\aspnetcore\src\Servers\IIS\AspNetCoreModuleV2\CommonLibTests\CommonLibTests.vcxproj(41,3): error MSB4019: The imported project "C:\Users\shirh\source\repos\aspnetcore\.tools\msbuild
\16.5.0-alpha\tools\MSBuild\Microsoft\VC\v160\Microsoft.Cpp.Default.props" was not found. Confirm that the expression in the Import declaration "C:\Users\shirh\source\repos\aspnetcore\.tools\msbuild\16.5.0-alp
ha\tools\MSBuild\Microsoft\VC\v160\\Microsoft.Cpp.Default.props" is correct, and that the file exists on disk.
C:\Users\shirh\source\repos\aspnetcore\src\Servers\IIS\AspNetCoreModuleV2\CommonLibTests\CommonLibTests.vcxproj(41,3): error MSB4019: The imported project "C:\Users\shirh\source\repos\aspnetcore\.tools\msbuild
\16.5.0-alpha\tools\MSBuild\Microsoft\VC\v160\Microsoft.Cpp.Default.props" was not found. Confirm that the expression in the Import declaration "C:\Users\shirh\source\repos\aspnetcore\.tools\msbuild\16.5.0-alp
ha\tools\MSBuild\Microsoft\VC\v160\\Microsoft.Cpp.Default.props" is correct, and that the file exists on disk.
C:\Users\shirh\source\repos\aspnetcore\src\Servers\IIS\AspNetCoreModuleV2\OutOfProcessRequestHandler\OutOfProcessRequestHandler.vcxproj(38,3): error MSB4019: The imported project "C:\Users\shirh\source\repos\a
spnetcore\.tools\msbuild\16.5.0-alpha\tools\MSBuild\Microsoft\VC\v160\Microsoft.Cpp.Default.props" was not found. Confirm that the expression in the Import declaration "C:\Users\shirh\source\repos\aspnetcore\.
tools\msbuild\16.5.0-alpha\tools\MSBuild\Microsoft\VC\v160\\Microsoft.Cpp.Default.props" is correct, and that the file exists on disk.
C:\Users\shirh\source\repos\aspnetcore\src\Servers\IIS\AspNetCoreModuleV2\InProcessRequestHandler\InProcessRequestHandler.vcxproj(38,3): error MSB4019: The imported project "C:\Users\shirh\source\repos\aspnetc
ore\.tools\msbuild\16.5.0-alpha\tools\MSBuild\Microsoft\VC\v160\Microsoft.Cpp.Default.props" was not found. Confirm that the expression in the Import declaration "C:\Users\shirh\source\repos\aspnetcore\.tools\
msbuild\16.5.0-alpha\tools\MSBuild\Microsoft\VC\v160\\Microsoft.Cpp.Default.props" is correct, and that the file exists on disk.
C:\Users\shirh\source\repos\aspnetcore\src\Servers\IIS\AspNetCoreModuleV2\AspNetCore\AspNetCore.vcxproj(39,3): error MSB4019: The imported project "C:\Users\shirh\source\repos\aspnetcore\.tools\msbuild\16.5.0-
alpha\tools\MSBuild\Microsoft\VC\v160\Microsoft.Cpp.Default.props" was not found. Confirm that the expression in the Import declaration "C:\Users\shirh\source\repos\aspnetcore\.tools\msbuild\16.5.0-alpha\tools
\MSBuild\Microsoft\VC\v160\\Microsoft.Cpp.Default.props" is correct, and that the file exists on disk.
C:\Users\shirh\source\repos\aspnetcore\src\Servers\IIS\AspNetCoreModuleV2\gtest\gtest.vcxproj(39,3): error MSB4019: The imported project "C:\Users\shirh\source\repos\aspnetcore\.tools\msbuild\16.5.0-alpha\tool
s\MSBuild\Microsoft\VC\v160\Microsoft.Cpp.Default.props" was not found. Confirm that the expression in the Import declaration "C:\Users\shirh\source\repos\aspnetcore\.tools\msbuild\16.5.0-alpha\tools\MSBuild\M
icrosoft\VC\v160\\Microsoft.Cpp.Default.props" is correct, and that the file exists on disk.
C:\Users\shirh\source\repos\aspnetcore\src\Servers\IIS\AspNetCoreModuleV2\CommonLib\CommonLib.vcxproj(36,3): error MSB4019: The imported project "C:\Users\shirh\source\repos\aspnetcore\.tools\msbuild\16.5.0-al
pha\tools\MSBuild\Microsoft\VC\v160\Microsoft.Cpp.Default.props" was not found. Confirm that the expression in the Import declaration "C:\Users\shirh\source\repos\aspnetcore\.tools\msbuild\16.5.0-alpha\tools\M
SBuild\Microsoft\VC\v160\\Microsoft.Cpp.Default.props" is correct, and that the file exists on disk.
C:\Users\shirh\source\repos\aspnetcore\src\Servers\IIS\AspNetCoreModuleV2\CommonLib\CommonLib.vcxproj(36,3): error MSB4019: The imported project "C:\Users\shirh\source\repos\aspnetcore\.tools\msbuild\16.5.0-al
pha\tools\MSBuild\Microsoft\VC\v160\Microsoft.Cpp.Default.props" was not found. Confirm that the expression in the Import declaration "C:\Users\shirh\source\repos\aspnetcore\.tools\msbuild\16.5.0-alpha\tools\M
SBuild\Microsoft\VC\v160\\Microsoft.Cpp.Default.props" is correct, and that the file exists on disk.
C:\Users\shirh\source\repos\aspnetcore\src\Servers\IIS\AspNetCoreModuleV2\gtest\gtest.vcxproj(39,3): error MSB4019: The imported project "C:\Users\shirh\source\repos\aspnetcore\.tools\msbuild\16.5.0-alpha\tool
s\MSBuild\Microsoft\VC\v160\Microsoft.Cpp.Default.props" was not found. Confirm that the expression in the Import declaration "C:\Users\shirh\source\repos\aspnetcore\.tools\msbuild\16.5.0-alpha\tools\MSBuild\M
icrosoft\VC\v160\\Microsoft.Cpp.Default.props" is correct, and that the file exists on disk.
    0 Warning(s)
    16 Error(s)

Time Elapsed 00:00:15.57
Build failed with exit code 1. Check errors above.

Further technical details

.NET SDK (reflecting any global.json):
 Version:   6.0.100-preview.5.21264.3
 Commit:    94d9b1ee65

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.21390
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Users\shirh\source\repos\aspnetcore\.dotnet\sdk\6.0.100-preview.5.21264.3\

Host (useful for support):
  Version: 6.0.0-preview.6.21308.1
  Commit:  d52f925042

.NET SDKs installed:
  6.0.100-preview.5.21264.3 [C:\Users\shirh\source\repos\aspnetcore\.dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.14 [C:\Users\shirh\source\repos\aspnetcore\.dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.0-preview.5.21263.4 [C:\Users\shirh\source\repos\aspnetcore\.dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.27 [C:\Users\shirh\source\repos\aspnetcore\.dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.14 [C:\Users\shirh\source\repos\aspnetcore\.dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.0-preview.5.21263.1 [C:\Users\shirh\source\repos\aspnetcore\.dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.0-preview.6.21308.1 [C:\Users\shirh\source\repos\aspnetcore\.dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 6.0.0-preview.5.21262.4 [C:\Users\shirh\source\repos\aspnetcore\.dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download
@shirhatti
Copy link
Contributor Author

Turns out this was my mistake. Running ./eng/scripts/InstallVisualStudio.ps1 -Edition Enterprise -Channel Preview fixed it for me.

Leaving this issue open in case we want to add anything to the build scripts to make this easier to diagnose.

@mkArtakMSFT mkArtakMSFT added the area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework label Jun 9, 2021
@dougbu
Copy link
Contributor

dougbu commented Jun 24, 2021

Documents already say

If you don't have visual studio installed you can run eng/scripts/InstallVisualStudio.ps1 to install the exact required dependencies.

Is the action here to:

  • Mention the need to run this script if builds complain of missing components (when the script wasn't used before)❔
  • Stop mentioning preview versions now that 16,10 is out❔

If yes, the fix would be in https://github.com/dotnet/aspnetcore/blob/main/docs/BuildFromSource.md and this would be a good first issue (hint, hint).

@dougbu dougbu added the good first issue Good for newcomers. label Jun 24, 2021
@shirhatti
Copy link
Contributor Author

Is the action here to:

  • Mention the need to run this script if builds complain of missing components (when the script wasn't used before)❔
  • Stop mentioning preview versions now that 16,10 is out❔

I'd rather the build not fail when I've explicitly mentioned .\build.cmd /p:BuildNative=false.

@dougbu
Copy link
Contributor

dougbu commented Jul 7, 2021

I'd rather the build not fail when I've explicitly mentioned .\build.cmd /p:BuildNative=false.

There are still doc problems in that we don't need preview versions of VS at the moment and don't mention InstallVisualStudio.ps1 as a fix when paths like .tools\msbuild\16.5.0-alpha\ show up in the logs prior to a build break.

In addition to that, /p:BuildNative=false doesn't actually disable native builds because the -buildNative default in eng/build.ps1 will override that property setting. Use -noBuildNative instead. That would be safer anyway because it completely skips the desktop msbuild step and will use only dotnet msbuild.

@shirhatti
Copy link
Contributor Author

Use -noBuildNative instead

Ah thank you! That's what I was looking for

@KevRitchie
Copy link

Hi @dougbu, I'd be happy to make the changes to the document if it's still required?

@dougbu
Copy link
Contributor

dougbu commented Oct 11, 2021

Hi @dougbu, I'd be happy to make the changes to the document if it's still required?

If a doc change would have helped you, @shirhatti, or others get going in this repo, I'm all for it. Much appreciated @KevRitchie

@KevRitchie
Copy link

No problem @dougbu.

In summary the changes would be:

  • Remove references to "16.10 Preview 3" of Visual Studio.
  • Maintain the reference to "Preview" in the InstallVisualStudio.ps1 command line script for the -channel flag as this can still be used.
  • Add a note that if the build fails and references paths like .tools\msbuild\16.5.0-alpha\ - they must run the InstallVisualStudio.ps1 script, even if VS is already installed.

That look OK?

@dougbu
Copy link
Contributor

dougbu commented Oct 12, 2021

That look OK?

Sounds great. Thanks @KevRitchie

@adrianwright109
Copy link
Contributor

Sounds like the Build From Source instructions have been redesigned so this issue may no longer be relevant. See comment

@dougbu
Copy link
Contributor

dougbu commented Jan 20, 2022

@dotnet/aspdoi this or similar problems come up most times we change our VS requirements and it's not clear how best to inform our community. A pinned issue for (say) two weeks after we add a new component or stop supporting a VS version might work but I've heard comments about usability there. Ideas much appreciated.

@BrennanConroy
Copy link
Member

A curated error message would be great instead of some random vcxproj error that no one understands. Like if there was a way for us to see what you have available on the machine and compare it to what is required.

@ilonatommy
Copy link
Member

ilonatommy commented Jan 21, 2023

I have a similar problem, only updating VS does not help, no matter if I run ./eng/scripts/InstallVisualStudio.ps1 or manually upload .vsconfig to the installer.

Running ./restore.cmd, results in:

 Restore was successful.
  All projects are up-to-date for restore.
Attempting to install dotnet from public location.
dotnet-install: Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:
dotnet-install: - The SDK needs to be installed without user interaction and without admin rights.
dotnet-install: - The SDK installation doesn't need to persist across multiple CI runs.
dotnet-install: To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.
dotnet-install: .NET Core Runtime with version '8.0.0-alpha.1.23067.2' is already installed.
dotnet-install: Adding to current process PATH: "source\repos\aspnetcore\.dotnet\x86\". Note: This change will not be visible if PowerShell was run as a child process.
Attempting to install dotnet from public location.
dotnet-install: Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:
dotnet-install: - The SDK needs to be installed without user interaction and without admin rights.
dotnet-install: - The SDK installation doesn't need to persist across multiple CI runs.
dotnet-install: To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.
dotnet-install: .NET Core Runtime with version '8.0.0-alpha.1.23067.2' is already installed.
dotnet-install: Adding to current process PATH: "source\repos\aspnetcore\.dotnet\". Note: This change will not be visible if PowerShell was run as a child process.
.nuget\packages\microsoft.dotnet.arcade.sdk\8.0.0-beta.23063.7\tools\Build.proj(221,5): error MSB3202: The project file "source\repos\aspnetcore\src\**\*.vcxproj" was not found.
.nuget\packages\microsoft.dotnet.arcade.sdk\8.0.0-beta.23063.7\tools\Build.proj(221,5): error MSB3202: The project file "source\repos\aspnetcore\src\**\*.vcxproj" was not found.
.nuget\packages\microsoft.dotnet.arcade.sdk\8.0.0-beta.23063.7\tools\Build.proj(221,5): error MSB3202: The project file "source\repos\aspnetcore\src\**\*.vcxproj" was not found.

Build FAILED.

Edit:
removing the repository and cloning again (in the same location) solved this problem.

@mkArtakMSFT
Copy link
Contributor

Closing as we haven't heard more feedback about this being a problem.

@mkArtakMSFT mkArtakMSFT closed this as not planned Won't fix, can't repro, duplicate, stale Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework good first issue Good for newcomers.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants
@shirhatti @dougbu @BrennanConroy @ilonatommy @mkArtakMSFT @adrianwright109 @KevRitchie and others