I am trying to build AspNetIdentity from source available in https://github.com/aspnet/AspNetIdentity. It throws errors in the build process. Steps to reproduce:
- Start Visual Studio 2019 Community and select
Clone a repository. Enter the following URL and clickClone: https://github.com/aspnet/AspNetIdentity.git - Copy nuget.exe to the
.nugetdirectory in the cloned project. - Build the solution.
The output is:
1>------ Build started: Project: Microsoft.AspNet.Identity.EntityFramework, Configuration: Debug Any CPU ------
2>------ Build started: Project: Microsoft.AspNet.Identity.Owin, Configuration: Debug Any CPU ------
2> Restoring NuGet packages...
2> To prevent NuGet from downloading packages during build, open the Visual Studio Options dialog, click on the NuGet Package Manager node and uncheck 'Allow NuGet to download missing packages'.
2> Feeds used:
2> C:\Users\MyUserName\.nuget\packages\
2> http://myget.org/F/owin
2> https://nuget.org/api/v2/
2>
2> Restoring NuGet package Microsoft.Owin.3.0.1.
2> Restoring NuGet package Microsoft.Owin.Security.Cookies.3.0.1.
2> Restoring NuGet package Microsoft.Owin.Security.3.0.1.
2> Restoring NuGet package Microsoft.Owin.Security.OAuth.3.0.1.
2> Adding package 'Microsoft.Owin.Security.Cookies.3.0.1' to folder 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages'
2> Adding package 'Microsoft.Owin.Security.3.0.1' to folder 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages'
2> Adding package 'Microsoft.Owin.3.0.1' to folder 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages'
2> Adding package 'Microsoft.Owin.Security.OAuth.3.0.1' to folder 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages'
2>EXEC : warning : Could not find a part of the path 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages\Microsoft.Owin.Security.Cookies.3.0.1'.
2>EXEC : warning : Could not find a part of the path 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages\Microsoft.Owin.Security.3.0.1'.
2>EXEC : warning : Could not find a part of the path 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages\Microsoft.Owin.3.0.1'.
2>EXEC : warning : Could not find a part of the path 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages\Microsoft.Owin.Security.OAuth.3.0.1'.
2> Restoring NuGet package Newtonsoft.Json.6.0.4.
2> Restoring NuGet package Owin.1.0.0.
2> Adding package 'Newtonsoft.Json.6.0.4' to folder 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages'
2> Adding package 'Owin.1.0.0' to folder 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages'
2>EXEC : warning : Could not find a part of the path 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages\Owin.1.0'.
2>EXEC : warning : Could not find a part of the path 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages\Newtonsoft.Json.6.0.4'.
2>C:\Users\MyUserName\Source\Repos\AspNetIdentity\.nuget\nuget.targets(89,9): error : Could not find a part of the path 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages\Microsoft.Owin.Security.Cookies.3.0.1'.
2>C:\Users\MyUserName\Source\Repos\AspNetIdentity\.nuget\nuget.targets(89,9): error : Could not find a part of the path 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages\Microsoft.Owin.Security.OAuth.3.0.1'.
2>C:\Users\MyUserName\Source\Repos\AspNetIdentity\.nuget\nuget.targets(89,9): error : Could not find a part of the path 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages\Microsoft.Owin.Security.3.0.1'.
2>C:\Users\MyUserName\Source\Repos\AspNetIdentity\.nuget\nuget.targets(89,9): error : Could not find a part of the path 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages\Microsoft.Owin.3.0.1'.
2>C:\Users\MyUserName\Source\Repos\AspNetIdentity\.nuget\nuget.targets(89,9): error : Could not find a part of the path 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages\Owin.1.0'.
2>C:\Users\MyUserName\Source\Repos\AspNetIdentity\.nuget\nuget.targets(89,9): error : Could not find a part of the path 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages\Newtonsoft.Json.6.0.4'.
2>C:\Users\MyUserName\Source\Repos\AspNetIdentity\.nuget\nuget.targets(89,9): error MSB3073: The command ""C:\Users\MyUserName\Source\Repos\AspNetIdentity\.nuget\nuget.exe" install "C:\Users\MyUserName\Source\Repos\AspNetIdentity\src\Microsoft.AspNet.Identity.Owin\packages.config" -source "http://myget.org/F/owin;https://nuget.org/api/v2/" -RequireConsent -solutionDir "C:\Users\MyUserName\Source\Repos\AspNetIdentity\ "" exited with code 1.
1> Restoring NuGet packages...
1> To prevent NuGet from downloading packages during build, open the Visual Studio Options dialog, click on the NuGet Package Manager node and uncheck 'Allow NuGet to download missing packages'.
1> Feeds used:
1> C:\Users\MyUserName\.nuget\packages\
1> http://myget.org/F/owin
1> https://nuget.org/api/v2/
1>
1> Restoring NuGet package EntityFramework.6.1.1.
1> Adding package 'EntityFramework.6.1.1' to folder 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages'
1>EXEC : warning : Could not find a part of the path 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages\EntityFramework.6.1.1'.
1>C:\Users\MyUserName\Source\Repos\AspNetIdentity\.nuget\nuget.targets(89,9): error : Could not find a part of the path 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages\EntityFramework.6.1.1'.
1>C:\Users\MyUserName\Source\Repos\AspNetIdentity\.nuget\nuget.targets(89,9): error MSB3073: The command ""C:\Users\MyUserName\Source\Repos\AspNetIdentity\.nuget\nuget.exe" install "C:\Users\MyUserName\Source\Repos\AspNetIdentity\src\Microsoft.AspNet.Identity.EntityFramework\packages.config" -source "http://myget.org/F/owin;https://nuget.org/api/v2/" -RequireConsent -solutionDir "C:\Users\MyUserName\Source\Repos\AspNetIdentity\ "" exited with code 1.
3>------ Build started: Project: Identity.Test, Configuration: Debug Any CPU ------
3> Restoring NuGet packages...
3> To prevent NuGet from downloading packages during build, open the Visual Studio Options dialog, click on the NuGet Package Manager node and uncheck 'Allow NuGet to download missing packages'.
3> Feeds used:
3> C:\Users\MyUserName\.nuget\packages\
3> http://myget.org/F/owin
3> https://nuget.org/api/v2/
3>
3> Restoring NuGet package Microsoft.Owin.Security.Cookies.3.0.1.
3> Restoring NuGet package Microsoft.Owin.Security.3.0.1.
3> Restoring NuGet package Microsoft.Owin.3.0.1.
3> Restoring NuGet package EntityFramework.6.1.1.
3> Adding package 'Microsoft.Owin.3.0.1' to folder 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages'
3> Adding package 'Microsoft.Owin.Security.3.0.1' to folder 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages'
3> Adding package 'Microsoft.Owin.Security.Cookies.3.0.1' to folder 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages'
3> Adding package 'EntityFramework.6.1.1' to folder 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages'
3>EXEC : warning : Could not find a part of the path 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages\Microsoft.Owin.Security.3.0.1'.
3>EXEC : warning : Could not find a part of the path 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages\EntityFramework.6.1.1'.
3>EXEC : warning : Could not find a part of the path 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages\Microsoft.Owin.Security.Cookies.3.0.1'.
3>EXEC : warning : Could not find a part of the path 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages\Microsoft.Owin.3.0.1'.
3> Restoring NuGet package Moq.4.0.10827.
3> Restoring NuGet package Owin.1.0.0.
3> Restoring NuGet package xunit.extensions.1.9.2.
3> Restoring NuGet package xunit.1.9.2.
3> Adding package 'Owin.1.0.0' to folder 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages'
3> Adding package 'Moq.4.0.10827' to folder 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages'
3> Adding package 'xunit.extensions.1.9.2' to folder 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages'
3> Adding package 'xunit.1.9.2' to folder 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages'
3>EXEC : warning : Could not find a part of the path 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages\Owin.1.0'.
3>EXEC : warning : Could not find a part of the path 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages\xunit.extensions.1.9.2'.
3>EXEC : warning : Could not find a part of the path 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages\xunit.1.9.2'.
3>EXEC : warning : Could not find a part of the path 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages\Moq.4.0.10827'.
3>C:\Users\MyUserName\Source\Repos\AspNetIdentity\.nuget\nuget.targets(89,9): error : Could not find a part of the path 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages\Microsoft.Owin.Security.Cookies.3.0.1'.
3>C:\Users\MyUserName\Source\Repos\AspNetIdentity\.nuget\nuget.targets(89,9): error : Could not find a part of the path 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages\EntityFramework.6.1.1'.
3>C:\Users\MyUserName\Source\Repos\AspNetIdentity\.nuget\nuget.targets(89,9): error : Could not find a part of the path 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages\Microsoft.Owin.3.0.1'.
3>C:\Users\MyUserName\Source\Repos\AspNetIdentity\.nuget\nuget.targets(89,9): error : Could not find a part of the path 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages\Microsoft.Owin.Security.3.0.1'.
3>C:\Users\MyUserName\Source\Repos\AspNetIdentity\.nuget\nuget.targets(89,9): error : Could not find a part of the path 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages\Owin.1.0'.
3>C:\Users\MyUserName\Source\Repos\AspNetIdentity\.nuget\nuget.targets(89,9): error : Could not find a part of the path 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages\xunit.extensions.1.9.2'.
3>C:\Users\MyUserName\Source\Repos\AspNetIdentity\.nuget\nuget.targets(89,9): error : Could not find a part of the path 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages\xunit.1.9.2'.
3>C:\Users\MyUserName\Source\Repos\AspNetIdentity\.nuget\nuget.targets(89,9): error : Could not find a part of the path 'C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages\Moq.4.0.10827'.
3>C:\Users\MyUserName\Source\Repos\AspNetIdentity\.nuget\nuget.targets(89,9): error MSB3073: The command ""C:\Users\MyUserName\Source\Repos\AspNetIdentity\.nuget\nuget.exe" install "C:\Users\MyUserName\Source\Repos\AspNetIdentity\test\Identity.Test\packages.config" -source "http://myget.org/F/owin;https://nuget.org/api/v2/" -RequireConsent -solutionDir "C:\Users\MyUserName\Source\Repos\AspNetIdentity\ "" exited with code 1.
========== Build: 0 succeeded, 3 failed, 1 up-to-date, 0 skipped ==========
It seems there is a problem with the following directory paths which contain the \ \ part, but I don't know why is it included in the path:
C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages\Moq.4.0.10827
The issue is under
RestoreCommandof thenuget.targetsfile.And by default,
SolutionDirproperty contains\. And in the command, it will make the MSBuild unable to find the package address.Besides, I noticed that:
-solutionDir "$(SolutionDir) "</RestoreCommand>there is a space between
SolutionDirand", you should delete it.Solution
change to use this in
nuget.targetsfile:When you finish it, you should close VS and then restart your project to reload the new csproj file to enable your changes.
Notice: use a new property
SolutionDir1which removes that\and then use it in the command.