Skip to content

ProjectDepsFilePath broken when output path is changed. #706

@NickCraver

Description

@NickCraver

Repro steps

  1. Grab the MiniProfiler repo here: https://github.com/MiniProfiler/dotnet/tree/09c96865f550f0d75b27119837853fc4b613bfe4
  2. Open in VS 2017 build 26116.0
  3. Build solution

If you already have the repo, git clean away the samples\Samples.Mvc5\bin\net462 directory (it should not exist)

Open building, you'll get an error:

Error:MSB4018
Details:
The "GenerateDepsFile" task failed unexpectedly.
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\git\MiniProfiler\dotnet\samples\Samples.Mvc5\bin\net462\Samples.Mvc5.deps.json'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
at Microsoft.NET.Build.Tasks.GenerateDepsFile.ExecuteCore()
at Microsoft.NET.Build.Tasks.TaskBase.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()
Project: Samples.Mvc5
File: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.targets
Line: 76

Context

To work around the always appending the TFM to the output path (see #550), there's currently a Directory.build.targets in place:

<Project>
    <!-- Working around https://github.com/dotnet/sdk/issues/550 -->
    <PropertyGroup>
        <OutputPath>bin/</OutputPath>
        <OutDir>bin/</OutDir>
    </PropertyGroup>
</Project>

However, the GenerateBuildDependencyFile target doesn't seem to be respecting this. It still creates the $(project).deps.json at:
samples\Samples.Mvc5\bin\net462\Samples.Mvc5.deps.json. It doesn't automatically create the net462 folder, so this causes the build failure above. I'm not saying it should automatically create the directory, instead it should put it in the bin\ folder beneath, like all other output.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions