IT:AD:NuGet:HowTo/Nest Solutions and still work

Nuget modifies *.csproj files, adding:

<Import Project="$(SolutionDir)\.nuget\NuGet.targets" />

At the end.

But note that it is solution based.

The first thing that needs doing is search/replacing it with a path that is relative to the Project, not the Solution:

<Import Project="$(ProjectDir)\..\..\.nuget\NuGet.targets" />

 

Also have to edit the .nuget.targets file from:

        <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
        <NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
        <NuGetExePath>$(NuGetToolsPath)\nuget.exe</NuGetExePath>
        <PackagesConfig>$(ProjectDir)packages.config</PackagesConfig>
        <PackagesDir>$(SolutionDir)packages</PackagesDir>

to

        <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
        <NuGetToolsPath>$(ProjectDir)..\..\.nuget</NuGetToolsPath>
        <NuGetExePath>$(NuGetToolsPath)\nuget.exe</NuGetExePath>
        <PackagesConfig>$(ProjectDir)packages.config</PackagesConfig>
        <PackagesDir>$(ProjectDir)..\..\packages</PackagesDir>

  • /home/skysigal/public_html/data/pages/it/ad/nuget/howto/nest_solutions_and_still_work.txt
  • Last modified: 2023/11/04 01:51
  • by 127.0.0.1