This project has moved and is read-only. For the latest updates, please go here.
1

Closed

Script is depending on Nuget.exe console output in English

description

I have found an issue with this script. This script is parsing the console output using regular expressions, that are expecting English output only. This means the Script breaks if the system is running with any other Locale and thus the console output of Nuget.exe is not English. In my case it is Spanish.

This issue is actually related to Issue ID35 and ID42.

Since i am not very proficient in Powershell, i fixed the Issue with the following solution. Maybe there is an better solution to this, but this is what i came up with.

I created an Console App "NugetEn" which sets the Thread and UI Culture strictly to English and then executes Nuget.exe in the same Appdomain, with the same arguments. This causes Nuget.exe to be called from within an Appdomain where all locales are set to English, and thus all Output will be in English only, independently from the system Locale.

To call NugetEn y changed the "New-NuGetPackage.ps1" to use "NugetEn.exe" instead of "Nuget.exe"

The code for NugetEn.exe is actually quite simple (Project is atached). The code expects the actual Nuget.exe in the same directory as NugetEn.exe.


using System;
using System.Threading;

namespace NugetEn
{
class Program
{
    static int Main(string[] args)
    {
        var culture = System.Globalization.CultureInfo.GetCultureInfo("en");
        Thread.CurrentThread.CurrentCulture = culture;
        Thread.CurrentThread.CurrentUICulture = culture;
        return AppDomain.CurrentDomain.ExecuteAssembly(AppDomain.CurrentDomain.BaseDirectory + "Nuget.exe",  args);
    }
}
}

file attachments

Closed Apr 13 at 6:51 AM by deadlydog
The new New-NuGetPackage.ps1 v1.5.8 (and CreateNewNuGetPackageFromProjectAfterEachBuild NuGet package v1.8.10) now includes the required -ForceEnglishOutput parameter to NuGet.exe, so this problem should be resolved. NOTE: The -ForceEnglishOutput parameter is only supported by NuGet.exe v3.5.0+, so be sure you are using at least that version of the NuGet.exe.

comments

deadlydog wrote Jan 23 at 3:05 AM

The new New-NuGetPackage.ps1 v1.5.8 now includes the required -ForceEnglishOutput parameter to NuGet.exe, so this problem should be resolved. NOTE: The -ForceEnglishOutput parameter is only supported by NuGet.exe v3.5.0+, so be sure you are using at least that version of the NuGet.exe.

If you could try the new version of the script and NuGet.exe and let me know that it does indeed work as expected, I would appreciate that. Thanks.