Uploaded image for project: 'TVLibrary (TVE35)'
  1. TVLibrary (TVE35)
  2. TVLIB-11

Build fails the first time because NuGet packages (incl. targets) were not available, yet

    XMLWordPrintable

Details

    • Icon: Task Task
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • None
    • None
    • None

    Description

      The in case the Packages directory is not available, yet (cleanup or new clone) or any package is missing (not downloaded yet) it might happen that the first try to build the solutions fails.

      The reason for the are potential targets that are being imported to a {{*.csproj}} when then it is being opened.
      Example: {{Anysee.csproj}} is referring to the anysee.ciapi.1.0.0 package and it's targets file
      {code:xml}
      <Project>
        ...
        <ItemGroup>
          <None Include="build.targets" />
          <None Include="packages.config" />
        </ItemGroup>
        <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
        <Import Project="build.targets" />
        <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
        <Import Project="..\..\..\..\..\..\..\Packages\anysee.ciapi.1.0.0\build\anysee.ciapi.targets" Condition="Exists('..\..\..\..\..\..\..\Packages\anysee.ciapi.1.0.0\build\anysee.ciapi.targets')" />
      </Project>
      {code}
      The {{anysee.ciapi.targets}} is responsible for copying the {{CIAPI.dll}} to the {{TargetDir}} of the project that is importing it. In that case {{Anysee.csproj}}.

      If the package and it's targets' file does not exist, yet this file is being ignored.
      When compiling the Anysee.csproj, it's {{build.targets}} file expects that the {{CIAPI.dll}} in {{TargetsDir}}:
      {Code:xml}
        <ItemGroup>
          <References Include="$(TargetDir)CIAPI.dll" />
        </ItemGroup>

        <Target Name="AfterBuild">
          <Copy SourceFiles="@(PluginFiles)" DestinationFolder="$(PluginDestination)" />
          <Copy SourceFiles="@(References)" DestinationFolder="$(PluginDestination)Resources\" />
        </Target>
      {Code}

      Starting a second run to build the source, while the packages are already existing should not throw that error.

      Attachments

        Activity

          People

            chefkoch chefkoch (Inactive)
            chefkoch chefkoch (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: