moq/labs

Builds from a fresh clone are broken

Closed this issue · 1 comments

Steps to Reproduce

  1. Clone the repository
  2. Run dotnet build Moq.sln from the src folder

Expected Behavior

The project builds.

Actual Behavior

Microsoft (R) Build Engine version 15.7.179.6572 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restoring packages for E:\Code\Buildalyzer\tests\repos\moq\src\Moq\Moq.Analyzer\Moq.Analyzer.csproj...
  Restoring packages for E:\Code\Buildalyzer\tests\repos\moq\src\Moq\Moq.Sdk.Tests\Moq.Sdk.Tests.csproj...
  Restoring packages for E:\Code\Buildalyzer\tests\repos\moq\src\Moq\Moq.Package\Moq.Package.nuproj...
  Restoring packages for E:\Code\Buildalyzer\tests\repos\moq\src\Moq\Moq.Sdk\Moq.Sdk.csproj...
C:\Program Files\dotnet\sdk\2.1.300\NuGet.targets(114,5): error : The local source 'C:\Users\dglick\AppData\Local\Temp\packages' doesn't exist. [E:\Code\Buildalyzer\tests\repos\moq\src\Moq.sln]

Build FAILED.

C:\Program Files\dotnet\sdk\2.1.300\NuGet.targets(114,5): error : The local source 'C:\Users\dglick\AppData\Local\Temp\packages' doesn't exist. [E:\Code\Buildalyzer\tests\repos\moq\src\Moq.sln]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:04.42

I noticed this problem while using Moq as an integration test for Buildalyzer. It's triggered on a fresh clone when no $(TEMP)\packages folder exists when building from the command line.

The root of the issue is that the LocalPublish target from Settings.targets is set to evaluate after the Pack target. However, the Restore target looks in the $(TEMP)\packages folder that the LocalPublish creates and populates. Since Restore runs before Pack (and thus LocalPublish), the folder doesn't exist for Restore when it's needed.

kzu commented

The intended usage is instead based on http://corebuild.io. Updated readme accordingly.