我遇到了一个我创建的自定义Nuget包的问题.我们称之为MyCompany.Library.nupkg.它由企业Artifactory Nuget回购托管.这个包依赖于Newtonsoft.Json.由于某种原因,如果我引用使用该Nuget包的项目,则不会将依赖DLL复制到项目的输出文件夹中.奇怪的是,当我使用另一个包(例如Moq而不是我自己的包)时,依赖的DLL被复制.
我已经创建了测试解决方案来重现问题:
解决方案参考测试:
当我查看SomeLib的输出文件夹时,我看到:
看起来很好.
但是,当我查看MyWinFormsApp的输出文件夹时,缺少Newtonsoft.Json.dll,并且在运行应用程序时,它会抛出找不到Newtonsoft.Json dll的异常.但是,Castle.Core.dll IS位于MyWinFormsApp的输出文件夹中.
我比较了Moq和MyCompany.Library的nuspecs,我真的找不到任何显着的差异.
我可以改变使用我的SomeLib引用Newtonsoft.Json的所有项目,但这是很多项目,我不想打扰其他开发人员.他们不应该知道SomeLib使用该程序集.
SomeLib.csproj中的引用如下所示:
<ItemGroup>
<Reference Include="MyCompany.Library, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MyCompany.Library.1.0.0\lib\net461\MyCompany.Library.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Castle.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\packages\Castle.Core.3.3.3\lib\net45\Castle.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Moq, Version=4.5.28.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.5.28\lib\net45\Moq.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.8.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" /> …Run Code Online (Sandbox Code Playgroud) 我正在用 Vagrant 创建一个 VirtualBox 机器。在配置中,我需要知道 VirtualBox DHCP 分配的框的 IP 地址。有没有办法在 Vagrantfile 中使用分配的 IP 地址?
Vagrant.configure(2) do |config|
# ... some more config
config.vm.network "private_network", type: "dhcp"
# ... some more config
config.vm.provision "shell", inline: <<-SHELL
sudo -i /vagrant/my_provisioning_script.sh <insert ip here>
SHELL
end
Run Code Online (Sandbox Code Playgroud)