2

Nuget パッケージに myget を使用しています。私は資格情報を含むプライベート フィードを使用しているため、次のブログをフォローしました

私のローカル (プロジェクト) nuget.config (ソリューションの .nuget フォルダーにあります) は次のようになります。

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <solution>
    <add key="disableSourceControlIntegration" value="true" />
  </solution>
  <packageSource>
    <clear />

    <add key="EcareMyGet" value="https://www.myget.org/F/rai69/"></add>

  </packageSource>
  <activePackageSource>
    <add key="EcareMyGet" value="https://www.myget.org/F/rai69/"></add>
  </activePackageSource>
  <packageSourceCredentials>
    <EcareMyGet>
      <add key="Username" value="www.myget.org/raimond" />
      <add key="ClearTextPassword" value="wachtwoord" />
    </EcareMyGet>
  </packageSourceCredentials>
</configuration> 

私の nuget.targets では、ブログに従って復元コマンドを変更しました。

<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)"   -NonInteractive   $(RequireConsentSwitch) -solutionDir "$(SolutionDir)\" -Verbosity detailed </RestoreCommand>

それにもかかわらず、buildserver はまだ nuget.org をソースとして使用しています。

NuGet.exe sources
  Registered Sources:

    1.  https://nuget.org/api/v2/ [Enabled]
        https://nuget.org/api/v2/

誰が解決策を知っていますか?

4

2 に答える 2

2

回答: nuget.config ファイルで <packageSource> を <packageSources> に置き換えます

以下は、答えにつながる会話です...

念のため、 -RequireConsent スイッチを無効にする部分も読みましたか?

<RequireRestoreConsent Condition=" '$(RequireRestoreConsent)' != 'false' ">
false
</RequireRestoreConsent>

また、MSBuild PackageSources 要素で構成していないことを確認してください。既定では、次のようになります (パッケージ ソースが構成されていません)。

<ItemGroup Condition=" '$(PackageSources)' == '' ">
    <!-- Package sources used to restore packages. 
         By default, registered sources under %APPDATA%\NuGet\NuGet.Config 
         will be used -->
    <!-- The official NuGet package source (https://nuget.org/api/v2/) will be 
         excluded if package sources are specified and it does not appear 
         in the list -->
    <!--
        <PackageSource Include="https://nuget.org/api/v2/" />
        <PackageSource Include="https://my-nuget-source/nuget/" />
    -->
</ItemGroup>

それが問題ではない場合は、出力ログについてもう少し詳しく教えてください。問題がいつ、どのコマンドによって発生したかを判断できますか?

于 2013-06-24T14:07:37.197 に答える
0

あなたは"My local (project) nuget.config"を使用していると書いています。これにより、プロジェクト フォルダーにnuget.configファイルがあると思われます。

NuGet 構成ファイルについては、こちらを参照してください。「NuGet は最初に既定の場所からNuGet.configを読み込み、次に現在のドライブのルートから現在のディレクトリで終わる NuGet.config という名前のファイルを読み込みます。」.

つまり、NuGet は、ルートからnuget.exeの場所 (通常はソリューション ルートの.nugetフォルダーの下) まで、フォルダー階層内の構成を検索します。これは、ソリューション内のプロジェクト フォルダー内を検索しないことを意味します。そのため、 nuget.configをソリューション フォルダーに移動してみて、適切に読み取られることを確認できます。

于 2013-06-24T13:51:11.450 に答える