【问题标题】:Nuget Update Package breaks Reference conditionalNuget 更新包中断参考条件
【发布时间】:2017-04-24 06:18:10
【问题描述】:

我的解决方案中的一些私有 Nuget 包在 Debug 中被它们的本地 dll 引用,并在 Release 中被引用为 nuget 包。

这是我的 Web.csproj:

<Choose>
<When Condition="'$(Configuration)' == 'Release'">
  <Reference Include="CustomPackage, Version=1.0.0.0, Culture=neutral">
    <HintPath>..\packages\CustomPackage.1.0.0\lib\net461\CustomPackage.dll</HintPath>
    <Private>True</Private>
  </Reference>
</When>
<Otherwise>
  <Reference Include="CustomPackage, Version=1.0.0.0, Culture=neutral">
    <HintPath >..\..\CustomPackage\bin\$(Configuration)\CustomPackage.dll</HintPath>
    <Private>True</Private>
  </Reference>
</Otherwise>
</Choose>

在 CustomPackage 发布并更新为 1.0.1 后,我会在 Nuget 包管理器中为我的解决方案更新该包。

问题: 然后,Nuget 将完全删除第一个引用,并在更新期间将更新后的引用置于条件之外。

我找到了Nuget Reference Switcher,我认为这是我的解决方案,它希望您将本地引用的所有项目添加到不适用于我的团队的解决方案中,我们只需要引用 dll。 GitHub Issue 已提交给其他有同样问题的人。

除了这个条件还有其他方法吗?

我可以在构建期间使用Web.Debug.csproj 对我的Web.csproj 应用转换吗?

谢谢,亚历克斯

【问题讨论】:

    标签: asp.net-mvc visual-studio nuget visual-studio-debugging csproj


    【解决方案1】:

    当我们为我们的项目升级 NuGet 包时,它将执行卸载和重新安装过程,这将修改我们的 .csproj 文件以将引用添加到我们的项目中。

    而且我们无法在构建过程中更改 .csproj 文件,因为构建过程需要根据 .csproj 中的设置来构建您的项目。

    以上所有过程都是 Visual Studio 中 nuget 和 project 的默认操作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-10-25
      • 2012-03-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多