0

次のような nuspec ファイルがあります。

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
  <metadata>
    <id>MyDll.Service</id>
    <version>1.0.0</version>
    <title>MyDll.Service</title>
    <authors>MyDll</authors>
    <owners>MyDll</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>Description</description>
    <copyright>Copyright © 2017</copyright>
    <dependencies>
      <dependency id="SomeDll" version="1.0.0" />
    </dependencies>
    <references>
      <reference file="MyDll.Service.Context.dll" />
    </references>
  </metadata>
  <files>
    <file src="..\..\Folder\MyDll.Service.Context\bin\Release\MyDll.Service.Context.dll" target="lib\net452"/>
    <file src="..\..\Folder\MyDll.Service\bin\Release\MyDll.Service.dll" target="lib\net452"/>
  </files>
</package>

これにより、2 つの dll を含む nuget パッケージが生成されます。プロジェクト自体は参照のみですMyDll.Service.Context.dll(これはまさに私が望むものです)。

MyDll.Service.dllクラスMyDll.Service.Context.dllが言及されている場所ならどこにでも挿入するためにインジェクションを使用しています。私の唯一の問題は、ビルド時に dllMyDll.Service.dllがメイン プロジェクトの bin フォルダーに取り込まれないことです。のみMyDll.Service.Context.dllです。コンテキスト dll のみを参照するため、これは理にかなっています。

MyDll.Service.dll私の質問は、プロジェクトでその dll を参照することなく、プロジェクトをビルドして公開するときに、どうすればbin フォルダーに取り込めますか?

編集:

コメントの提案に従って、MSBuild でこれを実行しようとしました。nuspec を次のように変更しました。

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
  <metadata>
    <id>MyDll.Service</id>
    <version>1.0.0</version>
    <title>MyDll.Service</title>
    <authors>MyDll</authors>
    <owners>MyDll</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>Description</description>
    <copyright>Copyright © 2017</copyright>
    <dependencies>
      <dependency id="SomeDll" version="1.0.0" />
    </dependencies>
    <references>
      <reference file="MyDll.Service.Context.dll" />
    </references>
  </metadata>
  <files>
    <file src="..\..\Folder\MyDll.Service.Context\bin\Release\MyDll.Service.Context.dll" target="lib\net452"/>
    <file src="..\..\Folder\MyDll.Service\bin\Release\MyDll.Service.dll" target="lib\net452"/>
  </files>
</package>

残念ながら、これにより、MyDll.Service.dlldll がパッケージに 2 回 (ビルド フォルダーに 1 回、lib フォルダーに 1 回) 表示されるだけでした。ただし、ビルド時にdllはまだフォルダーにありませんでした。

4

0 に答える 0