简体   繁体   English

nuget恢复后找不到文件

[英]File was not found after nuget restore

I am using Visual Studio 2017 and pull the source code from TFS server, then build the solution, I got the following error: 我正在使用Visual Studio 2017并从TFS服务器中提取源代码,然后构建解决方案,出现以下错误:

Microsoft.Common.CurrentVersion.targets (3863,5): Error MSB3113: The file "SqlServerTypes \\ x64 \\ SqlServerSpatial140.dll" was not found. Microsoft.Common.CurrentVersion.targets(3863,5):错误MSB3113:找不到文件“ SqlServerTypes \\ x64 \\ SqlServerSpatial140.dll”。

Then I found this dll file comes from the nuget package sqlserver.types, as I know, Visual Studio will restore the nuget packages when we build the solution. 然后我发现此dll文件来自nuget包sqlserver.types,据我所知,Visual Studio将在构建解决方案时还原nuget包。

Why I still have this issue? 为什么我仍然有这个问题?

您可以尝试以下方法:

Update-Package <package_name> –reinstall

File was not found after nuget restore nuget恢复后找不到文件

When you download the nuget package Microsoft.SqlServer.Types from the nuget.org and open it with nuget package explorer: 当您下载NuGet包Microsoft.SqlServer.Typesnuget.org与NuGet包Explorer中打开它:

在此处输入图片说明

You will find the sqlserver.types nuget package not only includes .dll from .net framework, but also has native binaries files. 您会发现sqlserver.types nuget软件包不仅包含.net框架中的.dll ,而且还具有本机二进制文件。 These files are designed with x64 and x84, they could not added to lib folder directly. 这些文件是使用x64和x84设计的,因此无法直接添加到lib文件夹中。 So the package owner adds them to project as content. 因此,包所有者将它们作为内容添加到项目中。 However, these dll files is setting to ignore by default for TFS, you need to add them manually. 但是,对于TFS,这些dll文件默认设置为忽略,您需要手动添加它们。

Of course, you can also use the command line Update-Package <package_name> –reinstall to reinstall this nuget package, but this requires you to execute this command every time after you pull the code from the TFS server. 当然,您也可以使用命令行Update-Package <package_name> –reinstall重新安装此nuget软件包,但这要求您每次从TFS服务器提取代码后都执行此命令。 Add this native binaries to the source control will Will reduce these unnecessary troubles. 将此本机二进制文件添加到源代码管理中将减少这些不必要的麻烦。

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 恢复 VS 2019 16.5.0 后未找到 Nuget 包 - Nuget package not found after restore VS 2019 16.5.0 错误:找不到“project.assets.json”。 运行 NuGet 包还原以生成此文件 - Error: 'project.assets.json' not found. Run a NuGet package restore to generate this file 如何修复错误 NETSDK1 project.assets.json 文件未找到。 运行 NuGet 包还原以生成此文件 - How to fix error NETSDK1 project.assets.json file not found. Run a NuGet package restore to generate this file NuGet 恢复问题:Xamarin iOS CSharp 目标未找到 - NuGet Restore Issue: Xamarin iOS CSharp Targets was not found NuGet恢复后,MSBuild在单元测试项目(.NET Core)上失败 - MSBuild fails on Unit Test Project (.NET Core) after NuGet Restore 成功的Nuget包恢复后项目不知道包 - Project Not Aware Of Packages After Successful Nuget Package Restore Windows 还原后 Nuget 包不兼容和缺少命名空间 - Nuget package incompatibility and missing namespaces after Windows restore DLL 参考仅在 NuGet 在服务器上还原后有效 - DLL Reference Only Works After NuGet Restore on Server 如何从复制恢复或安装 Nuget 包然后粘贴到 *.csproj 文件? - How to restore or install Nuget packages from copy then paste to *.csproj file? Nuget restore error:此文件夹包含多个解决方案文件 - Nuget restore error: This folder contains more than one solution file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM