Skip to content
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

"error NETSDK1007: Cannot find project info" when a csproj with a certain name depends on another in the same directory. #2779

Open
livarcocc opened this issue Dec 30, 2018 · 2 comments
Milestone

Comments

@livarcocc
Copy link
Contributor

From @davedissian on December 29, 2018 14:42

If I have two csproj's within the same directory, where csproj (1) depends on csproj (2), I get a NETSDK1007 error if the dependency (2) has a name which is lexicographically greater than the root project (1). For example, if I have Worker.csproj which depends on Library.csproj, it compiles fine. However, If I have AWorker.csproj which depends on Library.csproj, I get an NETSDK1007 error.

I guess the cause might have something to do with dependency resolution only being a single pass process (rather than being a two pass process that stores projects in a lookup table before resolving them).

Steps to reproduce

I have attached a zip file with 3 solutions: NETSDK1007-issue.zip

  • Broken - A solution containing projects AWorker.csproj and Library.csproj
  • Working - A solution containing projects Worker.csproj and Library.csproj
  • WorkingSeparateDir - A solution containing projects AWorker.csproj and Library\Library.csproj

If I try and run dotnet build Worker.sln inside Broken, I get the following output:

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

  Restoring packages for /Users/david/Projects/DotnetCsharpBug/Broken/AWorker.csproj...
  Generating MSBuild file /Users/david/Projects/DotnetCsharpBug/Broken/obj/AWorker.csproj.nuget.g.props.
  Generating MSBuild file /Users/david/Projects/DotnetCsharpBug/Broken/obj/AWorker.csproj.nuget.g.targets.
  Restore completed in 244.37 ms for /Users/david/Projects/DotnetCsharpBug/Broken/AWorker.csproj.
/usr/local/share/dotnet/sdk/2.2.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(129,5): error NETSDK1007: Cannot find project info for '/Users/david/Projects/DotnetCsharpBug/Broken/Library.csproj'. This can indicate a missing project reference. [/Users/david/Projects/DotnetCsharpBug/Broken/Library.csproj]

Build FAILED.

/usr/local/share/dotnet/sdk/2.2.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(129,5): error NETSDK1007: Cannot find project info for '/Users/david/Projects/DotnetCsharpBug/Broken/Library.csproj'. This can indicate a missing project reference. [/Users/david/Projects/DotnetCsharpBug/Broken/Library.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:01.23

The project files look like this:

AWorker.csproj:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
    <EnableDefaultCompileItems>false</EnableDefaultCompileItems>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="Library.csproj" />
    <Compile Include="Class1.cs" />
  </ItemGroup>

</Project>

Library.csproj:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
    <EnableDefaultCompileItems>false</EnableDefaultCompileItems>
  </PropertyGroup>

  <ItemGroup>
    <Compile Include="Library\Class1.cs" />
  </ItemGroup>

</Project>

Expected behavior

It compiles successfully.

Environment data

$ dotnet msbuild -version
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

15.9.20.62856

OS info:
macOS Mojave 10.14.2

If applicable, version of the tool that invokes MSBuild (Visual Studio, dotnet CLI, etc):

$ dotnet --version
2.2.100

Copied from original issue: dotnet/msbuild#4035

@tritao
Copy link

tritao commented Jan 14, 2019

Reproduced this same issue while trying to generate csprojs all in the same directory.

@Alex2357
Copy link

Alex2357 commented May 8, 2019

Everything was working fine in the same situation with 2 F# projects in the same directory, but after I added nuget package today I have received the same error.

dotnet --version
2.2.104

/usr/share/dotnet/sdk/2.2.104/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(129,5): error NETSDK1007: Cannot find project info for '/home/.../aproject.fsproj'. This can indicate a missing project reference. [/home/.../aproject.fsproj]

If I do stat /home/.../aproject.fsproj I get the file info

Reverted changes, deleted bin and obj folders and it works fine with 2 F# projects in the same directory.

The started dotnet add aproject.fsproj package FsUnit --version 3.4.0 and after that started dotnet build aproject.fsproj and I get the error again.

Eventually moved one of the projects into a separate folder

wli3 pushed a commit that referenced this issue Feb 7, 2020
…0190906.2 (#2779)

- Microsoft.Build - 16.3.0-preview-19456-02
wli3 pushed a commit that referenced this issue Feb 7, 2020
… merges/release/3.0.100-preview9-to-release/3.0.1xx

* upstream/release/3.0.100-preview9: (21 commits)
  Update dependencies from https://github.com/Microsoft/msbuild build 20190906.2 (#2779)
  Update dependencies from https://github.com/dotnet/cli build 20190908.6 (#2728)
  Update dependencies from https://github.com/dotnet/sdk build 20190908.1 (#2726)
  Update dependencies from https://github.com/dotnet/cli build 20190908.2 (#2715)
  Update dependencies from https://github.com/aspnet/websdk build 20190908.1 (#2713)
  Update dependencies from https://github.com/dotnet/cli build 20190907.12 (#2710)
  Update dependencies from https://github.com/dotnet/cli build 20190907.11 (#2707)
  Update dependencies from https://github.com/aspnet/websdk build 20190907.5 (#2706)
  Update dependencies from https://github.com/dotnet/cli build 20190907.9 (#2705)
  Update dependencies from https://github.com/aspnet/websdk build 20190907.4 (#2704)
  Update dependencies from https://github.com/aspnet/AspNetCore-Tooling build 20190907.3 (#2702)
  Update dependencies from https://github.com/aspnet/AspNetCore-Tooling build 20190906.6 (#2675)
  Update dependencies from https://github.com/dotnet/cli build 20190906.12 (#2670)
  Update dependencies from https://github.com/dotnet/sdk build 20190906.2 (#2669)
  Update dependencies from https://github.com/Microsoft/msbuild build 20190905.2 (#2666)
  Update dependencies from https://github.com/dotnet/core-setup build 20190906.20 (#2668)
  Update dependencies from https://github.com/dotnet/cli build 20190906.11 (#2667)
  Update dependencies from https://github.com/dotnet/core-setup build 20190906.12 (#2659)
  Update dependencies from https://github.com/aspnet/AspNetCore-Tooling build 20190905.12 (#2633)
  Update dependencies from https://github.com/Microsoft/msbuild build 20190830.3 (#2618)
  ...

Conflicts:
eng/Version.Details.xml
eng/Versions.props
wli3 pushed a commit that referenced this issue Feb 7, 2020
…elease/3.0.1xx-to-release/3.1.1xx

* upstream/release/3.0.1xx: (231 commits)
  [release/3.0.1xx] Update dependencies from microsoft/vstest (#2809)
  Update dependencies from https://github.com/dotnet/cli build 20190911.11 (#2823)
  Update dependencies from https://github.com/aspnet/websdk build 20190911.2 (#2816)
  Update dependencies from https://github.com/dotnet/cli build 20190911.1 (#2807)
  Update dependencies from https://github.com/dotnet/cli build 20190910.6 (#2803)
  Update dependencies from https://github.com/aspnet/AspNetCore-Tooling build 20190910.12 (#2801)
  Update dependencies from https://github.com/dotnet/cli build 20190910.5 (#2799)
  Update dependencies from https://github.com/aspnet/websdk build 20190910.5 (#2798)
  Update dependencies from https://github.com/aspnet/AspNetCore-Tooling build 20190910.5 (#2797)
  Update dependencies from https://github.com/dotnet/arcade build 20190910.3 (#2796)
  Update dependencies from https://github.com/dotnet/cli build 20190910.4 (#2794)
  Update dependencies from https://github.com/aspnet/websdk build 20190910.4 (#2795)
  [release/3.0.1xx] Update dependencies from aspnet/AspNetCore-Tooling (#2759)
  Update dependencies from https://github.com/aspnet/websdk build 20190910.2 (#2792)
  Update dependencies from https://github.com/dotnet/core-setup build 20190910.02
  Update dependencies from https://github.com/dotnet/arcade build 20190909.10 (#2788)
  Update dependencies from https://github.com/dotnet/core-setup build 20190909.40 (#2781)
  Update dependencies from https://github.com/Microsoft/msbuild build 20190906.2 (#2779)
  Update dependencies from https://github.com/dotnet/core-setup build 20190909.33 (#2775)
  Update dependencies from https://github.com/dotnet/cli build 20190909.10 (#2771)
  ...

Conflicts:
eng/Version.Details.xml
eng/Versions.props
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants