【发布时间】:2020-11-13 00:46:14
【问题描述】:
我正在尝试从https://github.com/aspnet/AspNetIdentity 中提供的源代码构建 AspNetIdentity。它在构建过程中引发错误。重现步骤:
- 启动 Visual Studio 2019 社区并选择
Clone a repository。输入以下网址并单击Clone: https://github.com/aspnet/AspNetIdentity.git - 将 nuget.exe 复制到克隆项目中的
.nuget目录。 - 构建解决方案。
输出是:
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 ==========
以下包含\ \部分的目录路径似乎有问题,但我不知道为什么它包含在路径中:
C:\Users\MyUserName\Source\Repos\AspNetIdentity\ \packages\Moq.4.0.10827
【问题讨论】:
-
问题来自
nuget.targets文件的RestoreCommand。默认情况下,solutiondir属性包含 \。并且在命令中会导致MSBuild无法找到包地址。所以你应该删除那个 \. -
我会添加一个答案来帮助您解决问题。
标签: c# visual-studio nuget asp.net-identity-2