简体   繁体   English

在Visual Studio外部重新安装ASP.NET网站的NuGet包

[英]Reinstall NuGet packages for ASP.NET Website outside Visual Studio

I have ASP.NET website which does not have .csproj file (it's not web application), only .sln file. 我有ASP.NET网站没有.csproj文件(它不是Web应用程序),只有.sln文件。 In root is packages.config having several NuGet packages defined. 在root中是packages.config,它定义了几个NuGet包。

Calling nuget restore .\\packages.config -PackagesDirectory .\\packages downloads packages to packages folder, but bin folder is empty. 调用nuget restore .\\packages.config -PackagesDirectory .\\packages将包下载到packages文件夹,但bin文件夹为空。

nuget update requires .csproj. nuget update需要.csproj。

If I call build of website in a command line it will throw an error that DLLs were not found. 如果我在命令行中调用build的构建,则会抛出找不到DLL的错误。 If I keep bin\\*.refresh it does not work either. 如果我保留bin\\*.refresh它也不起作用。

Thank you 谢谢

You need to have a .refresh file for each of the packages you expect to be copied to the bin directory. 您需要为要复制到bin目录的每个包都有一个.refresh文件。

For example, we have a custom build of MvcSiteMapProvider.MVC2 in one of our web sites. 例如,我们在其中一个网站上有一个MvcSiteMapProvider.MVC2的自定义版本。

packages.config packages.config

<package id="Mvc2" version="2.0.1" targetFramework="net35" />
<package id="MvcSiteMapProvider.MVC2.Core" version="4.6.18.1" targetFramework="net35" />

/Bin Folder / Bin文件夹

System.Web.Mvc.dll.refresh
MvcSiteMapProvider.dll.refresh

NOTE: It may be tricky to get your source control provider to recognize these. 注意:让源控制提供程序识别这些可能会很棘手。 Make sure they are there when you clone your project to a clean directory. 将项目克隆到干净的目录时,请确保它们在那里。

System.Web.Mvc.dll.refresh System.Web.Mvc.dll.refresh

..\..\packages\Mvc2.2.0.1\lib\net35\System.Web.Mvc.dll

MvcSiteMapProvider.dll.refresh MvcSiteMapProvider.dll.refresh

..\..\packages\MvcSiteMapProvider.MVC2.Core.4.6.18.1\lib\net35\MvcSiteMapProvider.dll

You may need to adjust the number of ..\\ in your project depending on the folder structure, but this is what we have that restores successfully. 您可能需要根据文件夹结构调整项目中的..\\的数量,但这是我们成功恢复的内容。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM