Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NuGet config variable "globalPackagesFolder" is ignored #1436

Closed
MichaelRobl opened this issue Jan 24, 2024 · 1 comment
Closed

NuGet config variable "globalPackagesFolder" is ignored #1436

MichaelRobl opened this issue Jan 24, 2024 · 1 comment

Comments

@MichaelRobl
Copy link

On our Build-Server we have a nuget config file witch re-define the global nuget package folder from default (%userprofile%.nuget\packages) to another location e.g. D:\NugetCache%username%.

No we have build errors at the moment an call to WixSharp.CommonTasks.Wixtools.PackageDir is executed with result with an DirectoryNotFoundException. After Inspect the class I have seen that the Property NuGetDir in the WixTools class points to %userprofile%.nuget\packages.

here an example of the corresponding nuget config file:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <config>
    <add key="globalPackagesFolder" value="D:\NuGetCache\%username%\" />    
  </config>
  <packageSources>
    <clear />
    <add key="NuGet.org" value="https://api.nuget.org/v3/index.json" />
  </packageSources>
</configuration>

The reason for change the global packages folder is to switch from the system partition C:\ to another partition D:\
so that nuget packages are not backed up in a system backup (only C:\ will be backup).

oleg-shilo added a commit that referenced this issue Jan 25, 2024
- #1436: NuGet config variable "globalPackagesFolder" is ignored
- #1428: [Question] SetNetPrerequirements to NET 7 or better
         Updated SetNetPrerequirements to allow using new WiX4 `DotNetCompatibilityCheck`
@oleg-shilo
Copy link
Owner

In this case, you need to instruct WixSharp as well, about the host OS using a custom packages location. You can do it by setting the "NUGET_PACKAGES" environment variable.

Unfortunately, it was a mistake when porting WiX3 in WiX4 codebase and the envar evaluation was not ported to the WixTools class. I have corrected the problem and published the prerelease (WixSharp_wix4.bin.2.0.6-pre):

public static class WixTools
{
    static internal string NuGetDir => Environment.GetEnvironmentVariable("NUGET_PACKAGES") ?? 
                                       @"%userprofile%\.nuget\packages".ExpandEnvVars();
    . . . 

Available now as a prerelease WixSharp_wix4.bin.2.0.6-pre

oleg-shilo added a commit that referenced this issue Feb 15, 2024
- #1446: Catch all exceptions in managed WinForms UI
- #1444: wix.exe not found if installed as local tool
- #1436: NuGet config variable "globalPackagesFolder" is ignored
- #1428: [Question] SetNetPrerequirements to NET 7 or better
         Updated SetNetPrerequirements to allow using new WiX4 `DotNetCompatibilityCheck`
- #1436: NuGet config variable "globalPackagesFolder" is ignored
- Proposal #1263: Signing using JSign or other alternatives
- Added `bool None<TSource>(this IEnumerable<TSource> source, ...)` extension method
- Fixed accidental renaming of `DigitalSignature1`->`DigitalSignature`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants