Skip to content

Tools ignore $(BaseIntermediateOutputPath) #18060

@oakio

Description

@oakio

Tools ignore custom $(BaseIntermediateOutputPath)

Steps to reproduce

  1. Create a project
  2. Open <project_name>.csproj and change $(BaseIntermediateOutputPath)
  3. Run dotnet ef command
  4. Expected that file <project_name>.csproj.EntityFrameworkCore.targets was created inside $(BaseIntermediateOutputPath), but was <project_root>/obj

See buildExtensionsDir variable inside class Microsoft.EntityFrameworkCore.Tools.Project:

if (buildExtensionsDir == null)
{
    buildExtensionsDir = Path.Combine(Path.GetDirectoryName(file), "obj");
}

Directory.CreateDirectory(buildExtensionsDir);

var efTargetsPath = Path.Combine(
    buildExtensionsDir,
    Path.GetFileName(file) + ".EntityFrameworkCore.targets");
using (var input = typeof(Resources).GetTypeInfo().Assembly.GetManifestResourceStream(
    "Microsoft.EntityFrameworkCore.Tools.Resources.EntityFrameworkCore.targets"))
using (var output = File.OpenWrite(efTargetsPath))
{
    // NB: Copy always in case it changes
    Reporter.WriteVerbose(Resources.WritingFile(efTargetsPath));
    input.CopyTo(output);
}

Related issue

Further technical details

EF Core version: 3.0.0
Target framework: .NET Core 3.0
Operating system: Windows 10 x64
IDE: Visual Studio 2019 16.3

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions