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

Update toolset to 5.0.2 #87

Merged
merged 2 commits into from
Jan 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/Subsets.props
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@

<PropertyGroup>
<!-- Temporarily disable ClickOnce native build due to compiler mismatch issue with libnethost.lib -->
<DisableClickOnceNativeBuild>true</DisableClickOnceNativeBuild>
<DisableClickOnceNativeBuild>false</DisableClickOnceNativeBuild>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"sdk": {
"version": "5.0.100-preview.5.20251.2",
"version": "5.0.102",
"allowPrerelease": true,
"rollForward": "major"
},
"tools": {
"dotnet": "5.0.100-preview.6.20266.3"
"dotnet": "5.0.102"
},
"native-tools": {
"cmake": "3.14.5",
Expand Down
5 changes: 5 additions & 0 deletions src/clickonce/MageCLI/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,11 @@ internal enum ErrorMessages
/// </summary>
MissingBinaryToLaunch,

/// <summary>
/// Current platform cannot be used for signing.
/// </summary>
InvalidSigningPlatform,

/// <summary>
/// The UseManifestForTrust argument needs to be set to true when generating/updating an application manifest
/// while a Publisher or SupportURL argument is provided.
Expand Down
3 changes: 3 additions & 0 deletions src/clickonce/MageCLI/Application.resx
Original file line number Diff line number Diff line change
Expand Up @@ -564,4 +564,7 @@ Options:
<data name="LauncherSuccessfullyAdded" xml:space="preserve">
<value>Launcher successfully added.</value>
</data>
<data name="InvalidSigningPlatform" xml:space="preserve">
<value>Signing is only supported on Windows.</value>
</data>
</root>
10 changes: 10 additions & 0 deletions src/clickonce/MageCLI/Certificate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
using System.Text;
using Microsoft.Win32.SafeHandles;
using System.Collections.Generic;
#if RUNTIME_TYPE_NETCORE
using System.Runtime.Versioning;
#endif

namespace Microsoft.Deployment.Utilities
{
Expand Down Expand Up @@ -220,12 +223,19 @@ public static bool HasPrivateKey(X509Certificate2 cert)
/// If the certificate has private key, this cert can be used for signing, if it does not,
/// try to access private key stored in the CSP, if CSP provider or key container name
/// is not provided, certificate can't be used for signing.
///
/// In .NET 5+, CspParameters type is only available on Windows - this method cannot be used
/// on other platforms.
/// Signing is only supported on Windows, anyway, due to limitations in signing code in MSBuild.
/// </summary>
/// <param name="certificate">Certificate</param>
/// <param name="cryptoProviderName">Crypto provider name</param>
/// <param name="keyContainerName">Key container name</param>
/// <param name="providerType">Provider type</param>
/// <returns></returns>
#if RUNTIME_TYPE_NETCORE
[SupportedOSPlatform("windows")]
#endif
public static bool SetPrivateKeyIfNeeded(X509Certificate2 certificate, string cryptoProviderName, string keyContainerName, int providerType = -1)
{
if (Certificate.HasPrivateKey(certificate))
Expand Down
14 changes: 14 additions & 0 deletions src/clickonce/MageCLI/Command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,13 @@ private bool CanSign()
{
bool result = true;

// Signing is only supported on Windows.
if (!OperatingSystem.IsWindows())
{
Application.PrintErrorMessage(ErrorMessages.InvalidSigningPlatform);
return false;
}

if (Requested(Operations.GenerateSomething) == false)
{
// Make sure an input file was specified and exists
Expand Down Expand Up @@ -1129,7 +1136,12 @@ private bool CanSign()
{
Application.PrintErrorMessage(ErrorMessages.InvalidCertUsage, certPath);
}
#if RUNTIME_TYPE_NETCORE
// SetPrivateKeyIfNeeded API is only available on Windows
else if (OperatingSystem.IsWindows())
#else
else
#endif
{
result = Utilities.Certificate.SetPrivateKeyIfNeeded(cert, cryptoProviderName, keyContainer);
if (!result)
Expand Down Expand Up @@ -1258,7 +1270,9 @@ private bool OpenAndCacheManifestInputFile(string path)
return result;
}

#if !RUNTIME_TYPE_NETCORE
[System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")]
#endif
public void ExecuteManifestRelated()
{
Manifest manifest = null;
Expand Down
23 changes: 18 additions & 5 deletions src/clickonce/MageCLI/CryptoApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ internal abstract class CAPIMethods : CAPIUnsafe
/// </summary>
internal sealed class CAPI : CAPIMethods
{
#if DEBUG
private const int ERROR_NO_MORE_ITEMS = 259;
#endif
internal const uint PP_ENUMCONTAINERS = 2;
internal const uint CRYPT_FIRST = 1;
internal const uint CRYPT_NEXT = 2;
Expand All @@ -180,6 +182,8 @@ internal static bool CryptAcquireContext(
out int errorCode)
{
errorCode = 0;

#if !RUNTIME_TYPE_NETCORE
CspParameters parameters = new CspParameters();
parameters.ProviderName = pwszProvider;
parameters.KeyContainerName = pwszContainer;
Expand All @@ -191,6 +195,7 @@ internal static bool CryptAcquireContext(
KeyContainerPermissionAccessEntry entry = new KeyContainerPermissionAccessEntry(parameters, KeyContainerPermissionFlags.Open);
kp.AccessEntries.Add(entry);
kp.Demand();
#endif

bool rc = CAPIMethods.CryptAcquireContext(ref hCryptProv,
pwszContainer,
Expand Down Expand Up @@ -229,13 +234,15 @@ internal static bool CryptAcquireContext(

internal static bool CertSetKeyProviderInfoProperty(IntPtr pCert, SafeLocalAllocHandle handle)
{
if (pCert == null)
if (pCert == IntPtr.Zero)
throw new ArgumentNullException(nameof(pCert));

if (handle.IsInvalid)
throw new ArgumentException(nameof(handle));

#if !RUNTIME_TYPE_NETCORE
new PermissionSet(PermissionState.Unrestricted).Demand();
#endif

return CertSetCertificateContextProperty(pCert, CAPI.CERT_KEY_PROV_INFO_PROP_ID, 0, handle);
}
Expand Down Expand Up @@ -316,8 +323,11 @@ internal static SafeLocalAllocHandle InvalidHandle
}

[DllImport(CAPI.KERNEL32, SetLastError=true),
SuppressUnmanagedCodeSecurity,
ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
SuppressUnmanagedCodeSecurity
#if !RUNTIME_TYPE_NETCORE
, ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)
#endif
]
private static extern int LocalFree(IntPtr handle);

override protected bool ReleaseHandle()
Expand All @@ -340,8 +350,11 @@ internal static SafeCryptProvHandle InvalidHandle {
}

[DllImport(CAPI.ADVAPI32, SetLastError=true),
SuppressUnmanagedCodeSecurity,
ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
SuppressUnmanagedCodeSecurity
#if !RUNTIME_TYPE_NETCORE
, ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)
#endif
]
private static extern bool CryptReleaseContext(IntPtr hCryptProv, uint dwFlags);

override protected bool ReleaseHandle()
Expand Down
5 changes: 5 additions & 0 deletions src/clickonce/MageCLI/xlf/Application.cs.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,11 @@ Možnosti:
<target state="translated">Možnost -RequiredUpdate musí mít hodnotu true, false, t nebo f – {0}</target>
<note />
</trans-unit>
<trans-unit id="InvalidSigningPlatform">
<source>Signing is only supported on Windows.</source>
<target state="new">Signing is only supported on Windows.</target>
<note />
</trans-unit>
<trans-unit id="InvalidTimestamp">
<source>The timestamp URI specified is not valid.</source>
<target state="translated">Zadaný identifikátor URI pro časová razítka není platný.</target>
Expand Down
5 changes: 5 additions & 0 deletions src/clickonce/MageCLI/xlf/Application.de.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,11 @@ Optionen:
<target state="translated">Die Option "-RequiredUpdate" muss "true", "false", "t" oder "f" sein: "{0}"</target>
<note />
</trans-unit>
<trans-unit id="InvalidSigningPlatform">
<source>Signing is only supported on Windows.</source>
<target state="new">Signing is only supported on Windows.</target>
<note />
</trans-unit>
<trans-unit id="InvalidTimestamp">
<source>The timestamp URI specified is not valid.</source>
<target state="translated">Der angegebene URI für den Zeitstempel ist ungültig.</target>
Expand Down
5 changes: 5 additions & 0 deletions src/clickonce/MageCLI/xlf/Application.es.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,11 @@ Opciones:
<target state="translated">La opción -RequiredUpdate debe ser "true", "false", "t" o "f" - "{0}"</target>
<note />
</trans-unit>
<trans-unit id="InvalidSigningPlatform">
<source>Signing is only supported on Windows.</source>
<target state="new">Signing is only supported on Windows.</target>
<note />
</trans-unit>
<trans-unit id="InvalidTimestamp">
<source>The timestamp URI specified is not valid.</source>
<target state="translated">El URI de marca de tiempo especificado no es válido.</target>
Expand Down
5 changes: 5 additions & 0 deletions src/clickonce/MageCLI/xlf/Application.fr.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,11 @@ Options :
<target state="translated">L'option -RequiredUpdate doit avoir la valeur "true", "false", "t" ou "f" - "{0}"</target>
<note />
</trans-unit>
<trans-unit id="InvalidSigningPlatform">
<source>Signing is only supported on Windows.</source>
<target state="new">Signing is only supported on Windows.</target>
<note />
</trans-unit>
<trans-unit id="InvalidTimestamp">
<source>The timestamp URI specified is not valid.</source>
<target state="translated">L'URI d'horodatage spécifiée n'est pas valide.</target>
Expand Down
5 changes: 5 additions & 0 deletions src/clickonce/MageCLI/xlf/Application.it.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,11 @@ Opzioni:
<target state="translated">L'opzione -RequiredUpdate deve essere "true", "false", "t" o "f" - "{0}"</target>
<note />
</trans-unit>
<trans-unit id="InvalidSigningPlatform">
<source>Signing is only supported on Windows.</source>
<target state="new">Signing is only supported on Windows.</target>
<note />
</trans-unit>
<trans-unit id="InvalidTimestamp">
<source>The timestamp URI specified is not valid.</source>
<target state="translated">L'URI del timestamp specificato non è valido.</target>
Expand Down
5 changes: 5 additions & 0 deletions src/clickonce/MageCLI/xlf/Application.ja.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,11 @@ Options:
<target state="translated">-RequiredUpdate オプションは、"true"、"false"、"t"、"f" のいずれかでなければなりません - "{0}"</target>
<note />
</trans-unit>
<trans-unit id="InvalidSigningPlatform">
<source>Signing is only supported on Windows.</source>
<target state="new">Signing is only supported on Windows.</target>
<note />
</trans-unit>
<trans-unit id="InvalidTimestamp">
<source>The timestamp URI specified is not valid.</source>
<target state="translated">指定されたタイムスタンプ URI は無効です。</target>
Expand Down
5 changes: 5 additions & 0 deletions src/clickonce/MageCLI/xlf/Application.ko.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,11 @@ Options:
<target state="translated">-RequiredUpdate 옵션은 "true", "false", "t" 또는 "f"여야 합니다. "{0}"</target>
<note />
</trans-unit>
<trans-unit id="InvalidSigningPlatform">
<source>Signing is only supported on Windows.</source>
<target state="new">Signing is only supported on Windows.</target>
<note />
</trans-unit>
<trans-unit id="InvalidTimestamp">
<source>The timestamp URI specified is not valid.</source>
<target state="translated">지정한 타임스탬프 URI가 잘못되었습니다.</target>
Expand Down
5 changes: 5 additions & 0 deletions src/clickonce/MageCLI/xlf/Application.pl.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,11 @@ Opcje:
<target state="translated">Opcja -RequiredUpdate musi mieć wartość „true”, „false”, „t” lub „f” — „{0}”</target>
<note />
</trans-unit>
<trans-unit id="InvalidSigningPlatform">
<source>Signing is only supported on Windows.</source>
<target state="new">Signing is only supported on Windows.</target>
<note />
</trans-unit>
<trans-unit id="InvalidTimestamp">
<source>The timestamp URI specified is not valid.</source>
<target state="translated">Określony identyfikator URI sygnatury czasowej jest nieprawidłowy.</target>
Expand Down
5 changes: 5 additions & 0 deletions src/clickonce/MageCLI/xlf/Application.pt-BR.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,11 @@ Opções:
<target state="translated">A opção -RequiredUpdate precisa ser "true", "false", "t" ou "f" – "{0}"</target>
<note />
</trans-unit>
<trans-unit id="InvalidSigningPlatform">
<source>Signing is only supported on Windows.</source>
<target state="new">Signing is only supported on Windows.</target>
<note />
</trans-unit>
<trans-unit id="InvalidTimestamp">
<source>The timestamp URI specified is not valid.</source>
<target state="translated">O URI de carimbo de data/hora especificado não é válido.</target>
Expand Down
5 changes: 5 additions & 0 deletions src/clickonce/MageCLI/xlf/Application.ru.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,11 @@ Options:
<target state="translated">Параметр -RequiredUpdate должен принимать значения "true", "false", "t" или "f" - "{0}"</target>
<note />
</trans-unit>
<trans-unit id="InvalidSigningPlatform">
<source>Signing is only supported on Windows.</source>
<target state="new">Signing is only supported on Windows.</target>
<note />
</trans-unit>
<trans-unit id="InvalidTimestamp">
<source>The timestamp URI specified is not valid.</source>
<target state="translated">Указана недопустимая отметка времени URI.</target>
Expand Down
5 changes: 5 additions & 0 deletions src/clickonce/MageCLI/xlf/Application.tr.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,11 @@ Seçenekler:
<target state="translated">-RequiredUpdate seçeneği "true", "false", "t" veya "f" olmalıdır: "{0}"</target>
<note />
</trans-unit>
<trans-unit id="InvalidSigningPlatform">
<source>Signing is only supported on Windows.</source>
<target state="new">Signing is only supported on Windows.</target>
<note />
</trans-unit>
<trans-unit id="InvalidTimestamp">
<source>The timestamp URI specified is not valid.</source>
<target state="translated">Belirtilen zaman damgası URI'si geçerli değil.</target>
Expand Down
5 changes: 5 additions & 0 deletions src/clickonce/MageCLI/xlf/Application.zh-Hans.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,11 @@ Options:
<target state="translated">-RequiredUpdate 选项必须为“true”、“false”、“t”或“f”-“{0}”</target>
<note />
</trans-unit>
<trans-unit id="InvalidSigningPlatform">
<source>Signing is only supported on Windows.</source>
<target state="new">Signing is only supported on Windows.</target>
<note />
</trans-unit>
<trans-unit id="InvalidTimestamp">
<source>The timestamp URI specified is not valid.</source>
<target state="translated">指定的时间戳 URI 无效。</target>
Expand Down
5 changes: 5 additions & 0 deletions src/clickonce/MageCLI/xlf/Application.zh-Hant.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,11 @@ Options:
<target state="translated">-RequiredUpdate 選項必須是 "true"、"false"、"t" 或 "f" - "{0}"</target>
<note />
</trans-unit>
<trans-unit id="InvalidSigningPlatform">
<source>Signing is only supported on Windows.</source>
<target state="new">Signing is only supported on Windows.</target>
<note />
</trans-unit>
<trans-unit id="InvalidTimestamp">
<source>The timestamp URI specified is not valid.</source>
<target state="translated">指定的時間戳記 URI 無效。</target>
Expand Down
7 changes: 4 additions & 3 deletions src/clickonce/native/Windows/gen-buildsys-win.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ rem This file invokes cmake and generates the build system for windows.
set argC=0
for %%x in (%*) do Set /A argC+=1

if NOT %argC%==7 GOTO :USAGE
if NOT %argC%==8 GOTO :USAGE
if %1=="/?" GOTO :USAGE

setlocal
Expand All @@ -25,10 +25,11 @@ if /i "%__Arch%" == "arm64" (set cm_BaseRid=win10&&set __ExtraCmakeParams=%__E
set __LatestCommit=%4
set __NativeVersion=%5
set __NetCorePkgVersion=%6
set __DotnetInstallDir=%~7
shift

:: Form the base RID to be used if we are doing a portable build
if /i "%7" == "1" (set cm_BaseRid=win)
if /i "%8" == "1" (set cm_BaseRid=win)
set cm_BaseRid=%cm_BaseRid%-%__Arch%
echo "Computed RID for native build is %cm_BaseRid%"

Expand All @@ -43,7 +44,7 @@ popd
set __ExtraCmakeParams=%__ExtraCmakeParams% "-DCMAKE_SYSTEM_VERSION=10.0" "-DCLI_CMAKE_NATIVE_VER=%__NativeVersion%"
set __ExtraCmakeParams=%__ExtraCmakeParams% "-DCLI_CMAKE_PKG_RID=%cm_BaseRid%" "-DCLI_CMAKE_COMMIT_HASH=%__LatestCommit%" "-DCLR_CMAKE_HOST_ARCH=%__Arch%"
set __ExtraCmakeParams=%__ExtraCmakeParams% "-DCMAKE_INSTALL_PREFIX=%__CMakeBinDir%" "-DCLI_CMAKE_RESOURCE_DIR=%__ResourcesDir%" "-DCLR_ENG_NATIVE_DIR=%__sourceDir%\..\..\..\eng\native"
set __ExtraCmakeParams=%__ExtraCmakeParams% "-DNET_CORE_PKG_VER=%__NetCorePkgVersion%" "-DDOTNET_PACKS_DIR="%__sourceDir%\..\..\..\.dotnet\packs"
set __ExtraCmakeParams=%__ExtraCmakeParams% "-DNET_CORE_PKG_VER=%__NetCorePkgVersion%" "-DDOTNET_PACKS_DIR=%__DotnetInstallDir%\packs"

echo "%CMakePath%" %__sourceDir% -G "Visual Studio %__VSString%" %__ExtraCmakeParams%
"%CMakePath%" %__sourceDir% -G "Visual Studio %__VSString%" %__ExtraCmakeParams%
Expand Down
6 changes: 4 additions & 2 deletions src/clickonce/native/build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ set "__LinkArgs= "
set "__LinkLibraries= "
set __PortableBuild=0
set __IncrementalNativeBuild=0
set __DotnetInstallDir=%~dp0..\..\..\.dotnet

:Arg_Loop
if [%1] == [] goto :ToolsVersion
Expand All @@ -35,6 +36,7 @@ if /i [%1] == [netcorepkgver] ( set __NetCorePkgVersion=%2&&shift&&shift&goto A
if /i [%1] == [commit] ( set __CommitSha=%2&&shift&&shift&goto Arg_Loop)

if /i [%1] == [incremental-native-build] ( set __IncrementalNativeBuild=1&&shift&goto Arg_Loop)
if /i [%1] == [dotnetInstallDir] ( set __DotnetInstallDir=%~2&&shift&&shift&goto Arg_Loop)
if /i [%1] == [rootDir] ( set __rootDir=%2&&shift&&shift&goto Arg_Loop)

shift
Expand Down Expand Up @@ -125,9 +127,9 @@ exit /b 1
:GenVSSolution
:: Regenerate the VS solution

echo Calling "%__nativeWindowsDir%\gen-buildsys-win.bat %~dp0 "%__VSVersion%" %__BuildArch% %__CommitSha% %__NativeVersion% %__NetCorePkgVersion% %__PortableBuild%"
echo Calling "%__nativeWindowsDir%\gen-buildsys-win.bat %~dp0 "%__VSVersion%" %__BuildArch% %__CommitSha% %__NativeVersion% %__NetCorePkgVersion% "%__DotnetInstallDir%" %__PortableBuild%"
pushd "%__IntermediatesDir%"
call "%__nativeWindowsDir%\gen-buildsys-win.bat" %~dp0 "%__VSVersion%" %__BuildArch% %__CommitSha% %__NativeVersion% %__NetCorePkgVersion% %__PortableBuild%
call "%__nativeWindowsDir%\gen-buildsys-win.bat" %~dp0 "%__VSVersion%" %__BuildArch% %__CommitSha% %__NativeVersion% %__NetCorePkgVersion% "%__DotnetInstallDir%" %__PortableBuild%
popd

:CheckForProj
Expand Down
Loading