question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dotnet restore exit code is always 0

See original GitHub issue

Steps to reproduce

  • have an invalid csproj:
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <!--<RuntimeFrameworkVersion>2.0.0-preview1-005957-00</RuntimeFrameworkVersion>-->
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
    <PackageReference Include="xunit" Version="2.3.0-beta2-build3683" />
    <PackageReference Include="xunit.runner.visualstudio" Version="2.3.0-beta2-build1317" />
    <PackageReference Include="Microsoft.AspNetCore.TestHost" Version="1.1.2" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\..\src\API.csproj"></ProjectReference>
  </ItemGroup>
  <ItemGroup>
    <Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
  </ItemGroup>
</Project>Invalid Characters to fail processing of the project file

then dotnet restore

Expected behavior

/app/code/test/IntegrationTests/IntegrationTests.csproj(18,11): error MSB4025: The project file could not be loaded. Data at the root level is invalid. Line 18, position 11
.
exit code is not 0

Actual behavior

exit code is 0

Environment data

dotnet --info output:

.NET Command Line Tools (2.0.0-preview1-005957)

Product Information:
 Version:            2.0.0-preview1-005957
 Commit SHA-1 hash:  056ac0e9cd

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.12
 OS Platform: Darwin
 RID:         osx.10.12-x64
 Base Path:   /usr/local/share/dotnet/sdk/2.0.0-preview1-005957/

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0-preview1-002111-00
  Build    : 1ff021936263d492539399688f46fd3827169983

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Jonathan34commented, May 12, 2017

@nguerrera you need two projects and a sln referencing the two projects. then you mess up with one and restore the sln. either the return code is the one fro the last project, either it is OR’ed and should be AND’ed (not really english!)

it will return 0.

mkdir repro
cd repro
mkdir proja
mkdir projb
cd proja
dotnet new console
cd ../projb
dotnet new console
cd ..
dotnet new sln
dotnet sln add proja/proja.csproj
dotnet sln add projb/projb.csproj
echo junk >> proja/proja.csproj
dotnet restore
echo $?
0reactions
nguerreracommented, May 19, 2017

This issue was moved to Microsoft/msbuild#2113

Read more comments on GitHub >

github_iconTop Results From Across the Web

asp.net core - dotnet restore fails from Docker container
The actual error seems to be: Unable to load the service index for source https://api.nuget.org/v3/index.json.
Read more >
dotnet test command - .NET CLI
If all tests are successful, the test runner returns 0 as an exit code; otherwise if any test fails, it returns 1.
Read more >
dotnet restore command - .NET CLI
Learn how to restore dependencies and project-specific tools with the dotnet restore command.
Read more >
dotnet build command - .NET CLI
The dotnet build command builds a project and all of its dependencies. ... The file is created when dotnet restore is executed.
Read more >
dotnet publish command - .NET CLI
dotnet publish compiles the application, reads through its dependencies specified in the project file, and publishes the resulting set of files ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found