0

I build a UWP app on Azure DevOps hosted build agent (Windows-2022, version 20220131.1). Of course, I use Microsoft.NETCore.UniversalWindowsPlatform NuGet package. As long as My app has F# code I have to hack a GateKeeper.xml and enable F# in it. So I use PowerShell to do that

foreach ($file in gci -Recurse 'C:\Users\*\.nuget\packages\*.net.native.compiler\**\GatekeeperConfig.xml')
{
    (gc $file.FullName) -replace '<FSharpRule on="true">','<FSharpRule on="false">' | sc $file.FullName
}

But for version 6.2.12 the content of Microsoft.NETCore.UniversalWindowsPlatform is present in C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.netcore.universalwindowsplatform\6.2.12\ where I have no admin rights to change anything on a build agent.

So I wonder if it is possible to force MSBuild to always use NuGet directly never using packages cached in Program Files?

Andrii
  • 1,081
  • 1
  • 11
  • 24

1 Answers1

1

If the agent and UWP adhere to 'normal' NuGet standards, you could try a nuget.config as follows:

<config>
  <packageSources>
    <clear />
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <!-- any additional sources you need-->
  </packageSources>
  <fallbackPackageFolders>
    <clear />
  </fallbackPackageFolders>
</config>

Keep in mind though, that this might break caching facilities on agents.

CaringDev
  • 8,391
  • 1
  • 24
  • 43