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

dotnet Restore (& therefore msbuild /t:restore) skips projects with an explicit solution project dependency #4578

Closed
natemcmaster opened this issue Feb 11, 2017 · 4 comments

Comments

@natemcmaster
Copy link

Calling "msbuild.exe /t:Restore" on a solution skips a project in my solution.
This project has an explicit project dependency in the solution file.

Repro

  1. Download https:/aspnet/BuildTools/tree/4ec80c34339019266353e6e557f7ca68c89fbdb3
  2. dotnet restore BuildTools.sln

Expected
Restores all csproj reference .sln file.

Actual
Skips NugetPackageVerifier.csproj
(see restore log here: https://gist.github.com/natemcmaster/016baf3563e369551d8f4c88cf9dcce0)

Details
msbuild.exe 15.0.26209.0
dotnet.exe 1.0.0-rc4-004771

Right click on solution -> Project Dependencies

image

Or see the raw BuildTools.sln

cc @emgarten

natemcmaster pushed a commit to aspnet/BuildTools that referenced this issue Feb 11, 2017
@emgarten
Copy link
Member

Thanks for the repro @natemcmaster

Restore reads the solution metaproj for all project references. For this solution I see it puts the reference to NuGetPackageVerifier in an external metaproj file and references it.

    <ProjectReference Include="C:\src\repros\BuildTools\src\NuGetPackageVerifier\NuGetPackageVerifier.csproj.metaproj">
      <ToolsVersion>15.0</ToolsVersion>
      <SkipNonexistentProjects>Build</SkipNonexistentProjects>
      <AdditionalProperties>Configuration=Debug; Platform=Any CPU</AdditionalProperties>
      <Configuration>Debug</Configuration>
      <Platform>AnyCPU</Platform>
    </ProjectReference>

I believe restore has had issues with these in the past and ignores them because they don't actually exist when it tries to resolve them.

@rainersigwald what is the best way to get the set of top level projects from a solution file?

Would it work to strip the .metaproj extension from these paths and continue walking them?

@rainersigwald
Copy link

That's not a good way but I do think it might be the best way.

References are added to the metaproj by this code which only adds either a direct reference or, if there's something special about the project, a reference to its metaproj. Filed dotnet/msbuild#1694 to consider creating an item with the contents you expect (definitely not for RTW though).

Hopefully no user has a real file on disk ending with .metaproj but you might try adding both under an if-exists clause.

@rrelyea rrelyea added this to the 4.0.1 milestone Feb 13, 2017
@emgarten emgarten self-assigned this Mar 20, 2017
@rrelyea rrelyea modified the milestones: 4.3, Future-0 Mar 20, 2017
@rrelyea
Copy link
Contributor

rrelyea commented Mar 20, 2017

Got another email complaint about this today from an external customer via @Pilchie

@rrelyea rrelyea changed the title Restore skips projects with an explicit solution project dependency dotnet Restore (& therefore msbuild /t:restore) skips projects with an explicit solution project dependency Mar 20, 2017
@davkean
Copy link

davkean commented Mar 21, 2017

I also just ran into this: #4845

@emgarten emgarten modified the milestones: 4.3 - 3/6 thru 3/24, 4.3 Mar 23, 2017
emgarten added a commit to NuGet/NuGet.Client that referenced this issue Mar 23, 2017
This change adds a task to modify project references coming from a solution file. When project build order is used the solution file read by restore contains links to .metaproj files instead of the actual projects. The actual project can be found by removing the metaproj extension.

Cleaning up _SplitProjectReferencesByFileExistence, the outputs from this are not used since ProjectReference is used direcetly. There is no reason to depend on this external target.

Fixes NuGet/Home#4869
Fixes NuGet/Home#4578
Daniel15 added a commit to reactjs/React.NET that referenced this issue May 11, 2017
* Upgrade to Visual Studio 2017 + csproj tooling

* Include workaround for NuGet/Home#4337 (explicitly specify version when restoring NuGet packages)

* Work around dotnet/cli-migrate#11

* Upgrade to .NET Core 1.1.x

* Remove VersionPrefix from all csproj files

* Legacy NuGet restore is no longer needed

* Disable CS1701 warning for sample projects

* Turns out we actually do need the legacy NuGet restore

* Use VS2017 AppVeyor image

* Remove project dependencies to work around NuGet/Home#5193 and NuGet/Home#4578

* Use MSBuild 15 on AppVeyor

* Enforce .NET Core tools 1.0.0 in global.json

* Use newer npm on AppVeyor (as a workaround for https:/dotnet/cli/issues/6561 and dotnet/msbuild#406), and run correct test command
@rrelyea rrelyea modified the milestones: 4.3, 4.3 - 3/6 thru 3/24 Aug 10, 2017
toptaldev92 pushed a commit to toptaldev92/React.NET that referenced this issue Jul 28, 2021
* Upgrade to Visual Studio 2017 + csproj tooling

* Include workaround for NuGet/Home#4337 (explicitly specify version when restoring NuGet packages)

* Work around dotnet/cli-migrate#11

* Upgrade to .NET Core 1.1.x

* Remove VersionPrefix from all csproj files

* Legacy NuGet restore is no longer needed

* Disable CS1701 warning for sample projects

* Turns out we actually do need the legacy NuGet restore

* Use VS2017 AppVeyor image

* Remove project dependencies to work around NuGet/Home#5193 and NuGet/Home#4578

* Use MSBuild 15 on AppVeyor

* Enforce .NET Core tools 1.0.0 in global.json

* Use newer npm on AppVeyor (as a workaround for https:/dotnet/cli/issues/6561 and dotnet/msbuild#406), and run correct test command
onlinehub0808 added a commit to onlinehub0808/React.NET that referenced this issue Jun 2, 2023
* Upgrade to Visual Studio 2017 + csproj tooling

* Include workaround for NuGet/Home#4337 (explicitly specify version when restoring NuGet packages)

* Work around dotnet/cli-migrate#11

* Upgrade to .NET Core 1.1.x

* Remove VersionPrefix from all csproj files

* Legacy NuGet restore is no longer needed

* Disable CS1701 warning for sample projects

* Turns out we actually do need the legacy NuGet restore

* Use VS2017 AppVeyor image

* Remove project dependencies to work around NuGet/Home#5193 and NuGet/Home#4578

* Use MSBuild 15 on AppVeyor

* Enforce .NET Core tools 1.0.0 in global.json

* Use newer npm on AppVeyor (as a workaround for https:/dotnet/cli/issues/6561 and dotnet/msbuild#406), and run correct test command
DotDeveloper95 added a commit to DotDeveloper95/BuildTools that referenced this issue Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants