diff --git a/README.md b/README.md
index 2e45c01fc..ba014315e 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@ Looking for V1 of the .NET Core tooling?
If you are looking for the v2.0 release of the .NET Core tools (CLI, MSBuild and the new csproj), head over to https://dot.net/core and download!
-> **Note:** the release/2.1.3xx branch of the CLI repo is based on an upcoming update of the SDK and is considered pre-release. For production-level usage, please use the
+> **Note:** the release/2.1.4xx branch of the CLI repo is based on an upcoming update of the SDK and is considered pre-release. For production-level usage, please use the
> released version of the tools available at https://dot.net/core
Found an issue?
@@ -65,7 +65,7 @@ To download the .NET Core runtime **without** the SDK, visit https://github.com/
> want to install the latest released versions, check out the [preceding section](#looking-for-v1-of-the-net-core-tooling).
> In order to be able to restore these pre-release packages, you may need to add a NuGet feed pointing to https://dotnet.myget.org/F/dotnet-core/api/v3/index.json. Other feeds may also be necessary depending on what kind of project you are working with.
-| Platform | Latest Daily Build *release/2.1.3xx* [![][version-badge]][version] |
+| Platform | Latest Daily Build *release/2.1.4xx* [![][version-badge]][version] |
| -------- | :-------------------------------------: |
| **Windows x64** | [Installer][win-x64-installer] - [Checksum][win-x64-installer-checksum] [zip][win-x64-zip] - [Checksum][win-x64-zip-checksum] |
| **Windows x86** | [Installer][win-x86-installer] - [Checksum][win-x86-installer-checksum] [zip][win-x86-zip] - [Checksum][win-x86-zip-checksum] |
@@ -76,7 +76,7 @@ To download the .NET Core runtime **without** the SDK, visit https://github.com/
| **RHEL 6** | [tar.gz][rhel-6-targz] - [Checksum][rhel-6-targz-checksum] |
| **Linux-musl** | [tar.gz][linux-musl-targz] - [Checksum][linux-musl-targz-checksum] |
-| Latest Coherent Build2 *release/2.1.3xx* |
+| Latest Coherent Build2 *release/2.1.4xx* |
|:------:|
| [![][coherent-version-badge]][coherent-version] |
@@ -84,44 +84,44 @@ Reference notes:
> **1**: *Our Debian packages are put together slightly differently than the other OS specific installers. Instead of combining everything, we have separate component packages that depend on each other. If you're installing these directly from the .deb files (via dpkg or similar), then you'll need to install the [corresponding Host, Host FX Resolver, and Shared Framework packages](https://github.com/dotnet/core-setup#daily-builds) before installing the Sdk package.*
>
**2**: *A 'coherent' build is defined as a build where the Runtime version matches between the CLI and Asp.NET.*
-[version]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/latest.version
-[coherent-version]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/latest.coherent.version
+[version]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.4xx/latest.version
+[coherent-version]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.4xx/latest.coherent.version
[comment]: # (The latest versions are always the same across all platforms. Just need one to show, so picking win-x64's svg.)
-[version-badge]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/win_x64_Release_version_badge.svg
-[coherent-version-badge]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/win_x64_Release_coherent_badge.svg
+[version-badge]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.4xx/win_x64_Release_version_badge.svg
+[coherent-version-badge]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.4xx/win_x64_Release_coherent_badge.svg
-[win-x64-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-win-x64.exe
-[win-x64-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-win-x64.exe.sha
-[win-x64-zip]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-win-x64.zip
-[win-x64-zip-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-win-x64.zip.sha
+[win-x64-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.4xx/dotnet-sdk-latest-win-x64.exe
+[win-x64-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.4xx/dotnet-sdk-latest-win-x64.exe.sha
+[win-x64-zip]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.4xx/dotnet-sdk-latest-win-x64.zip
+[win-x64-zip-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.4xx/dotnet-sdk-latest-win-x64.zip.sha
-[win-x86-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-win-x86.exe
-[win-x86-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-win-x86.exe.sha
-[win-x86-zip]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-win-x86.zip
-[win-x86-zip-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-win-x86.zip.sha
+[win-x86-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.4xx/dotnet-sdk-latest-win-x86.exe
+[win-x86-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.4xx/dotnet-sdk-latest-win-x86.exe.sha
+[win-x86-zip]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.4xx/dotnet-sdk-latest-win-x86.zip
+[win-x86-zip-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.4xx/dotnet-sdk-latest-win-x86.zip.sha
-[osx-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-osx-x64.pkg
-[osx-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-osx-x64.pkg.sha
-[osx-targz]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-osx-x64.tar.gz
-[osx-targz-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-osx-x64.tar.gz.sha
+[osx-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.4xx/dotnet-sdk-latest-osx-x64.pkg
+[osx-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.4xx/dotnet-sdk-latest-osx-x64.pkg.sha
+[osx-targz]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.4xx/dotnet-sdk-latest-osx-x64.tar.gz
+[osx-targz-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.4xx/dotnet-sdk-latest-osx-x64.tar.gz.sha
-[linux-targz]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-linux-x64.tar.gz
-[linux-targz-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-linux-x64.tar.gz.sha
+[linux-targz]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.4xx/dotnet-sdk-latest-linux-x64.tar.gz
+[linux-targz-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.4xx/dotnet-sdk-latest-linux-x64.tar.gz.sha
-[linux-arm-targz]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-linux-arm.tar.gz
-[linux-arm-targz-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-linux-arm.tar.gz.sha
+[linux-arm-targz]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.4xx/dotnet-sdk-latest-linux-arm.tar.gz
+[linux-arm-targz-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.4xx/dotnet-sdk-latest-linux-arm.tar.gz.sha
-[linux-arm64-targz]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-linux-arm64.tar.gz
-[linux-arm64-targz-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-linux-arm64.tar.gz.sha
+[linux-arm64-targz]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.4xx/dotnet-sdk-latest-linux-arm64.tar.gz
+[linux-arm64-targz-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.4xx/dotnet-sdk-latest-linux-arm64.tar.gz.sha
-[linux-DEB-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-x64.deb
-[linux-DEB-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-x64.deb.sha
+[linux-DEB-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.4xx/dotnet-sdk-latest-x64.deb
+[linux-DEB-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.4xx/dotnet-sdk-latest-x64.deb.sha
-[linux-RPM-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-x64.rpm
-[linux-RPM-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-x64.rpm.sha
+[linux-RPM-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.4xx/dotnet-sdk-latest-x64.rpm
+[linux-RPM-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.4xx/dotnet-sdk-latest-x64.rpm.sha
-[rhel-6-targz]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-rhel.6-x64.tar.gz
-[rhel-6-targz-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-rhel.6-x64.tar.gz.sha
+[rhel-6-targz]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.4xx/dotnet-sdk-latest-rhel.6-x64.tar.gz
+[rhel-6-targz-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.4xx/dotnet-sdk-latest-rhel.6-x64.tar.gz.sha
[linux-musl-targz]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-linux-musl-x64.tar.gz
[linux-musl-targz-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-linux-musl-x64.tar.gz.sha
diff --git a/TestAssets/TestProjects/ProjectPrintsNoWarn/ProjectPrintsNoWarn.csproj b/TestAssets/TestProjects/ProjectPrintsNoWarn/ProjectPrintsNoWarn.csproj
new file mode 100644
index 000000000..4e83f2fad
--- /dev/null
+++ b/TestAssets/TestProjects/ProjectPrintsNoWarn/ProjectPrintsNoWarn.csproj
@@ -0,0 +1,12 @@
+
+
+
+ library
+ netcoreapp2.0
+
+
+
+
+
+
+
diff --git a/build/BranchInfo.props b/build/BranchInfo.props
index f62c8fd00..c7a84c19d 100644
--- a/build/BranchInfo.props
+++ b/build/BranchInfo.props
@@ -1,6 +1,6 @@
- master
- master
+ release/2.1.4xx
+ release/2.1.4xx
diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props
index d79ed2c5e..024f2de04 100644
--- a/build/DependencyVersions.props
+++ b/build/DependencyVersions.props
@@ -5,7 +5,7 @@
$(MicrosoftAspNetCoreAllPackageVersion)2.1.0$(MicrosoftNETCoreAppPackageVersion)
- 15.7.179
+ 15.8.0-preview-000060$(MicrosoftBuildPackageVersion)$(MicrosoftBuildPackageVersion)$(MicrosoftBuildPackageVersion)
@@ -16,7 +16,7 @@
$(MicrosoftCodeAnalysisCSharpPackageVersion)$(MicrosoftCodeAnalysisCSharpPackageVersion)$(MicrosoftCodeAnalysisCSharpPackageVersion)
- 2.1.300
+ 1.0.0-preview-62924-09$(MicrosoftNETSdkPackageVersion)$(MicrosoftAspNetCoreAppPackageVersion)2.1.300
@@ -36,7 +36,7 @@
1.3.1$(MicrosoftDotNetProjectJsonMigrationPackageVersion)0.2.0-beta-62628-01
- 4.7.0-rtm.5148
+ 4.8.0-preview1.5196$(NuGetBuildTasksPackageVersion)$(NuGetBuildTasksPackageVersion)$(NuGetBuildTasksPackageVersion)
@@ -45,7 +45,8 @@
$(NuGetBuildTasksPackageVersion)$(NuGetBuildTasksPackageVersion)$(NuGetBuildTasksPackageVersion)
- 15.7.0
+ $(NuGetBuildTasksPackageVersion)
+ 15.8.0-preview-20180510-03$(MicrosoftNETTestSdkPackageVersion)$(MicrosoftNETTestSdkPackageVersion)0.2.0-beta-000042
diff --git a/build/Version.props b/build/Version.props
index 47493fa53..cde7dcc9d 100644
--- a/build/Version.props
+++ b/build/Version.props
@@ -2,7 +2,7 @@
21
- 301
+ 400preview$(VersionMajor).$(VersionMinor)
diff --git a/packaging/osx/clisdk/scripts/postinstall b/packaging/osx/clisdk/scripts/postinstall
index 8211444d2..28339be99 100755
--- a/packaging/osx/clisdk/scripts/postinstall
+++ b/packaging/osx/clisdk/scripts/postinstall
@@ -8,9 +8,6 @@ PACKAGE=$1
INSTALL_DESTINATION=$2
INSTALL_TEMP_HOME=/tmp/dotnet-installer
-# A temporary fix for the permissions issue(s)
-chmod -R 755 $INSTALL_DESTINATION
-
first_run() {
$INSTALL_DESTINATION/dotnet exec $INSTALL_DESTINATION/sdk/%SDK_VERSION%/dotnet.dll internal-reportinstallsuccess "$1" > /dev/null 2>&1 || true
}
diff --git a/scripts/obtain/dotnet-install.ps1 b/scripts/obtain/dotnet-install.ps1
index 1a35ec4fb..5bfd355eb 100644
--- a/scripts/obtain/dotnet-install.ps1
+++ b/scripts/obtain/dotnet-install.ps1
@@ -522,6 +522,7 @@ else {
throw "Invalid value for `$Runtime"
}
+# Check if the SDK version is already installed.
$isAssetInstalled = Is-Dotnet-Package-Installed -InstallRoot $InstallRoot -RelativePathToPackage $dotnetPackageRelativePath -SpecificVersion $SpecificVersion
if ($isAssetInstalled) {
Say "$assetName version $SpecificVersion is already installed."
@@ -561,6 +562,12 @@ catch {
Say "Extracting zip from $DownloadLink"
Extract-Dotnet-Package -ZipPath $ZipPath -OutPath $InstallRoot
+# Check if the SDK version is now installed; if not, fail the installation.
+$isAssetInstalled = Is-Dotnet-Package-Installed -InstallRoot $InstallRoot -RelativePathToPackage $dotnetPackageRelativePath -SpecificVersion $SpecificVersion
+if (!$isAssetInstalled) {
+ throw "$assetName version $SpecificVersion failed to install with an unknown error."
+}
+
Remove-Item $ZipPath
Prepend-Sdk-InstallRoot-To-Path -InstallRoot $InstallRoot -BinFolderRelativePath $BinFolderRelativePath
diff --git a/scripts/obtain/dotnet-install.sh b/scripts/obtain/dotnet-install.sh
index 27443c397..588d32814 100755
--- a/scripts/obtain/dotnet-install.sh
+++ b/scripts/obtain/dotnet-install.sh
@@ -754,6 +754,7 @@ install_dotnet() {
return 1
fi
+ # Check if the SDK version is already installed.
if is_dotnet_package_installed "$install_root" "$asset_relative_path" "$specific_version"; then
say "$asset_name version $specific_version is already installed."
return 0
@@ -791,6 +792,12 @@ install_dotnet() {
say "Extracting zip from $download_link"
extract_dotnet_package "$zip_path" "$install_root"
+ # Check if the SDK version is now installed; if not, fail the installation.
+ if ! is_dotnet_package_installed "$install_root" "$asset_relative_path" "$specific_version"; then
+ say_err "$asset_name version $specific_version failed to install with an unknown error."
+ return 1
+ fi
+
return 0
}
diff --git a/src/Microsoft.DotNet.Cli.Utils/ArgumentEscaper.cs b/src/Microsoft.DotNet.Cli.Utils/ArgumentEscaper.cs
index afaa58d48..c87268c00 100644
--- a/src/Microsoft.DotNet.Cli.Utils/ArgumentEscaper.cs
+++ b/src/Microsoft.DotNet.Cli.Utils/ArgumentEscaper.cs
@@ -59,14 +59,10 @@ namespace Microsoft.DotNet.Cli.Utils
///
private static IEnumerable EscapeArgArray(IEnumerable args)
{
- var escapedArgs = new List();
-
foreach (var arg in args)
{
- escapedArgs.Add(EscapeSingleArg(arg));
+ yield return EscapeSingleArg(arg);
}
-
- return escapedArgs;
}
///
@@ -79,23 +75,19 @@ namespace Microsoft.DotNet.Cli.Utils
///
///
///
- private static IEnumerable EscapeArgArrayForCmd(IEnumerable arguments)
+ private static IEnumerable EscapeArgArrayForCmd(IEnumerable args)
{
- var escapedArgs = new List();
-
- foreach (var arg in arguments)
+ foreach (var arg in args)
{
- escapedArgs.Add(EscapeArgForCmd(arg));
+ yield return EscapeArgForCmd(arg);
}
-
- return escapedArgs;
}
- public static string EscapeSingleArg(string arg)
+ public static string EscapeSingleArg(string arg, bool forceQuotes = false)
{
var sb = new StringBuilder();
- var needsQuotes = ShouldSurroundWithQuotes(arg);
+ var needsQuotes = forceQuotes || ShouldSurroundWithQuotes(arg);
var isQuoted = needsQuotes || IsSurroundedWithQuotes(arg);
if (needsQuotes) sb.Append("\"");
diff --git a/src/Microsoft.DotNet.Cli.Utils/FileAccessRetryer.cs b/src/Microsoft.DotNet.Cli.Utils/FileAccessRetryer.cs
index f73d5d4d1..80201ecac 100644
--- a/src/Microsoft.DotNet.Cli.Utils/FileAccessRetryer.cs
+++ b/src/Microsoft.DotNet.Cli.Utils/FileAccessRetryer.cs
@@ -3,6 +3,7 @@
using System;
using System.IO;
+using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.DotNet.Cli.Utils
@@ -47,5 +48,35 @@ namespace Microsoft.DotNet.Cli.Utils
}
}
}
+
+ ///
+ /// Run Directory.Move and File.Move in Windows has a chance to get IOException with
+ /// HResult 0x80070005 due to Indexer. But this error is transient.
+ ///
+ internal static void RetryOnMoveAccessFailure(Action action)
+ {
+ const int ERROR_HRESULT_ACCESS_DENIED = unchecked((int)0x80070005);
+ int nextWaitTime = 10;
+ int remainRetry = 10;
+
+ while (true)
+ {
+ try
+ {
+ action();
+ break;
+ }
+ catch (IOException e) when (e.HResult == ERROR_HRESULT_ACCESS_DENIED)
+ {
+ Thread.Sleep(nextWaitTime);
+ nextWaitTime *= 2;
+ remainRetry--;
+ if (remainRetry == 0)
+ {
+ throw;
+ }
+ }
+ }
+ }
}
}
diff --git a/src/Microsoft.DotNet.Cli.Utils/MSBuildForwardingAppWithoutLogging.cs b/src/Microsoft.DotNet.Cli.Utils/MSBuildForwardingAppWithoutLogging.cs
index d46eb52f2..cee835aa0 100644
--- a/src/Microsoft.DotNet.Cli.Utils/MSBuildForwardingAppWithoutLogging.cs
+++ b/src/Microsoft.DotNet.Cli.Utils/MSBuildForwardingAppWithoutLogging.cs
@@ -34,7 +34,7 @@ namespace Microsoft.DotNet.Cli.Utils
{
_forwardingApp = new ForwardingAppImplementation(
msbuildPath ?? GetMSBuildExePath(),
- _msbuildRequiredParameters.Concat(argsToForward.Select(Escape)),
+ _msbuildRequiredParameters.Concat(argsToForward.Select(QuotePropertyValue)),
environmentVariables: _msbuildRequiredEnvironmentVariables);
}
@@ -49,13 +49,6 @@ namespace Microsoft.DotNet.Cli.Utils
return GetProcessStartInfo().Execute();
}
- private static string Escape(string arg) =>
- // this is a workaround for https://github.com/Microsoft/msbuild/issues/1622
- IsRestoreSources(arg) ?
- arg.Replace(";", "%3B")
- .Replace("://", ":%2F%2F") :
- arg;
-
private static string GetMSBuildExePath()
{
return Path.Combine(
@@ -82,12 +75,37 @@ namespace Microsoft.DotNet.Cli.Utils
return new Muxer().MuxerPath;
}
- private static bool IsRestoreSources(string arg)
+ private static bool IsPropertyArgument(string arg)
{
- return arg.StartsWith("/p:RestoreSources=", StringComparison.OrdinalIgnoreCase) ||
- arg.StartsWith("/property:RestoreSources=", StringComparison.OrdinalIgnoreCase) ||
- arg.StartsWith("-p:RestoreSources=", StringComparison.OrdinalIgnoreCase) ||
- arg.StartsWith("-property:RestoreSources=", StringComparison.OrdinalIgnoreCase);
+ return
+ arg.StartsWith("/p:", StringComparison.OrdinalIgnoreCase) ||
+ arg.StartsWith("/property:", StringComparison.OrdinalIgnoreCase) ||
+ arg.StartsWith("-p:", StringComparison.OrdinalIgnoreCase) ||
+ arg.StartsWith("-property:", StringComparison.OrdinalIgnoreCase);
+ }
+
+ private static string QuotePropertyValue(string arg)
+ {
+ if (!IsPropertyArgument(arg))
+ {
+ return arg;
+ }
+
+ var parts = arg.Split(new[] { '=' }, 2);
+ if (parts.Length != 2)
+ {
+ return arg;
+ }
+
+ // Escaping `://` is a workaround for https://github.com/Microsoft/msbuild/issues/1622
+ // The issue is that MSBuild is collapsing multiple slashes to a single slash due to a bad regex.
+ var value = parts[1].Replace("://", ":%2f%2f");
+ if (ArgumentEscaper.IsSurroundedWithQuotes(value))
+ {
+ return $"{parts[0]}={value}";
+ }
+
+ return $"{parts[0]}={ArgumentEscaper.EscapeSingleArg(value, forceQuotes: true)}";
}
}
}
diff --git a/src/Microsoft.DotNet.Cli.Utils/PathUtility.cs b/src/Microsoft.DotNet.Cli.Utils/PathUtility.cs
index 32620e0d5..df4ab26aa 100644
--- a/src/Microsoft.DotNet.Cli.Utils/PathUtility.cs
+++ b/src/Microsoft.DotNet.Cli.Utils/PathUtility.cs
@@ -119,6 +119,11 @@ namespace Microsoft.DotNet.Tools.Common
///
public static string GetRelativePath(string path1, string path2)
{
+ if (!Path.IsPathRooted(path1) || !Path.IsPathRooted(path2))
+ {
+ throw new ArgumentException("both paths need to be rooted/full path");
+ }
+
return GetRelativePath(path1, path2, Path.DirectorySeparatorChar, true);
}
diff --git a/src/Microsoft.DotNet.Cli.Utils/Properties/AssemblyInfo.cs b/src/Microsoft.DotNet.Cli.Utils/Properties/AssemblyInfo.cs
index 119f225c7..a9a1b42c3 100644
--- a/src/Microsoft.DotNet.Cli.Utils/Properties/AssemblyInfo.cs
+++ b/src/Microsoft.DotNet.Cli.Utils/Properties/AssemblyInfo.cs
@@ -7,6 +7,7 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyMetadataAttribute("Serviceable", "True")]
[assembly: InternalsVisibleTo("dotnet, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("dotnet.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
+[assembly: InternalsVisibleTo("Microsoft.DotNet.Configurer, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.DotNet.Tools.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.DotNet.Cli.Utils.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.DotNet.TestFramework, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
diff --git a/src/Microsoft.DotNet.Configurer/AspNetCertificateSentinel.cs b/src/Microsoft.DotNet.Configurer/AspNetCertificateSentinel.cs
index c8dc622c0..7a8e282e9 100644
--- a/src/Microsoft.DotNet.Configurer/AspNetCertificateSentinel.cs
+++ b/src/Microsoft.DotNet.Configurer/AspNetCertificateSentinel.cs
@@ -21,7 +21,7 @@ namespace Microsoft.DotNet.Configurer
private string SentinelPath => Path.Combine(_dotnetUserProfileFolderPath, SENTINEL);
- public AspNetCertificateSentinel(CliFolderPathCalculator cliFallbackFolderPathCalculator) :
+ public AspNetCertificateSentinel() :
this(
CliFolderPathCalculator.DotnetUserProfileFolderPath,
FileSystemWrapper.Default.File,
diff --git a/src/Microsoft.DotNet.Configurer/CliFolderPathCalculator.cs b/src/Microsoft.DotNet.Configurer/CliFolderPathCalculator.cs
index f75920997..006aec821 100644
--- a/src/Microsoft.DotNet.Configurer/CliFolderPathCalculator.cs
+++ b/src/Microsoft.DotNet.Configurer/CliFolderPathCalculator.cs
@@ -4,40 +4,59 @@
using System;
using System.IO;
using System.Runtime.InteropServices;
+using Microsoft.DotNet.Cli.Utils;
using NuGet.Common;
namespace Microsoft.DotNet.Configurer
{
- public class CliFolderPathCalculator
+ public static class CliFolderPathCalculator
{
+ public const string DotnetHomeVariableName = "DOTNET_CLI_HOME";
private const string DotnetProfileDirectoryName = ".dotnet";
private const string ToolsShimFolderName = "tools";
- public string CliFallbackFolderPath => Environment.GetEnvironmentVariable("DOTNET_CLI_TEST_FALLBACKFOLDER") ??
- Path.Combine(new DirectoryInfo(AppContext.BaseDirectory).Parent.FullName, "NuGetFallbackFolder");
- public string ToolsShimPath => Path.Combine(DotnetUserProfileFolderPath, ToolsShimFolderName);
- public string ToolsPackagePath => ToolPackageFolderPathCalculator.GetToolPackageFolderPath(ToolsShimPath);
- public BashPathUnderHomeDirectory ToolsShimPathInUnix
+ public static string CliFallbackFolderPath =>
+ Environment.GetEnvironmentVariable("DOTNET_CLI_TEST_FALLBACKFOLDER") ??
+ Path.Combine(new DirectoryInfo(AppContext.BaseDirectory).Parent.FullName, "NuGetFallbackFolder");
+
+ public static string ToolsShimPath => Path.Combine(DotnetUserProfileFolderPath, ToolsShimFolderName);
+
+ public static string ToolsPackagePath => ToolPackageFolderPathCalculator.GetToolPackageFolderPath(ToolsShimPath);
+
+ public static BashPathUnderHomeDirectory ToolsShimPathInUnix =>
+ new BashPathUnderHomeDirectory(
+ DotnetHomePath,
+ Path.Combine(DotnetProfileDirectoryName, ToolsShimFolderName));
+
+ public static string DotnetUserProfileFolderPath =>
+ Path.Combine(DotnetHomePath, DotnetProfileDirectoryName);
+
+ public static string PlatformHomeVariableName =>
+ RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "USERPROFILE" : "HOME";
+
+ public static string DotnetHomePath
{
get
{
- return new BashPathUnderHomeDirectory(Environment.GetEnvironmentVariable("HOME"),
- Path.Combine(DotnetProfileDirectoryName, ToolsShimFolderName));
+ var home = Environment.GetEnvironmentVariable(DotnetHomeVariableName);
+ if (string.IsNullOrEmpty(home))
+ {
+ home = Environment.GetEnvironmentVariable(PlatformHomeVariableName);
+ if (string.IsNullOrEmpty(home))
+ {
+ throw new ConfigurationException(
+ string.Format(
+ LocalizableStrings.FailedToDetermineUserHomeDirectory,
+ DotnetHomeVariableName))
+ .DisplayAsError();
+ }
+ }
+
+ return home;
}
}
- public static string DotnetUserProfileFolderPath
- {
- get
- {
- string profileDir = Environment.GetEnvironmentVariable(
- RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "USERPROFILE" : "HOME");
-
- return Path.Combine(profileDir, DotnetProfileDirectoryName);
- }
- }
-
- public string NuGetUserSettingsDirectory =>
+ public static string NuGetUserSettingsDirectory =>
NuGetEnvironment.GetFolderPath(NuGetFolderPath.UserSettingsDirectory);
}
}
diff --git a/src/Microsoft.DotNet.Configurer/ConfigurationException.cs b/src/Microsoft.DotNet.Configurer/ConfigurationException.cs
new file mode 100644
index 000000000..591203c4a
--- /dev/null
+++ b/src/Microsoft.DotNet.Configurer/ConfigurationException.cs
@@ -0,0 +1,22 @@
+// Copyright (c) .NET Foundation and contributors. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using System;
+
+namespace Microsoft.DotNet.Configurer
+{
+ internal class ConfigurationException : Exception
+ {
+ public ConfigurationException()
+ {
+ }
+
+ public ConfigurationException(string message) : base(message)
+ {
+ }
+
+ public ConfigurationException(string message, Exception innerException) : base(message, innerException)
+ {
+ }
+ }
+}
diff --git a/src/Microsoft.DotNet.Configurer/DotnetFirstRunConfiguration.cs b/src/Microsoft.DotNet.Configurer/DotnetFirstRunConfiguration.cs
new file mode 100644
index 000000000..b959c7c41
--- /dev/null
+++ b/src/Microsoft.DotNet.Configurer/DotnetFirstRunConfiguration.cs
@@ -0,0 +1,24 @@
+// Copyright (c) .NET Foundation and contributors. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+namespace Microsoft.DotNet.Configurer
+{
+ public class DotnetFirstRunConfiguration
+ {
+ public bool GenerateAspNetCertificate { get; }
+
+ public bool PrintTelemetryMessage { get; }
+
+ public bool SkipFirstRunExperience { get; }
+
+ public DotnetFirstRunConfiguration(
+ bool generateAspNetCertificate,
+ bool printTelemetryMessage,
+ bool skipFirstRunExperience)
+ {
+ GenerateAspNetCertificate = generateAspNetCertificate;
+ PrintTelemetryMessage = printTelemetryMessage;
+ SkipFirstRunExperience = skipFirstRunExperience;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Microsoft.DotNet.Configurer/DotnetFirstTimeUseConfigurer.cs b/src/Microsoft.DotNet.Configurer/DotnetFirstTimeUseConfigurer.cs
index 2cb502256..94478909b 100644
--- a/src/Microsoft.DotNet.Configurer/DotnetFirstTimeUseConfigurer.cs
+++ b/src/Microsoft.DotNet.Configurer/DotnetFirstTimeUseConfigurer.cs
@@ -12,7 +12,7 @@ namespace Microsoft.DotNet.Configurer
public class DotnetFirstTimeUseConfigurer
{
private IReporter _reporter;
- private IEnvironmentProvider _environmentProvider;
+ private DotnetFirstRunConfiguration _dotnetFirstRunConfiguration;
private INuGetCachePrimer _nugetCachePrimer;
private INuGetCacheSentinel _nugetCacheSentinel;
private IFirstTimeUseNoticeSentinel _firstTimeUseNoticeSentinel;
@@ -29,7 +29,7 @@ namespace Microsoft.DotNet.Configurer
IAspNetCertificateSentinel aspNetCertificateSentinel,
IAspNetCoreCertificateGenerator aspNetCoreCertificateGenerator,
IFileSentinel toolPathSentinel,
- IEnvironmentProvider environmentProvider,
+ DotnetFirstRunConfiguration dotnetFirstRunConfiguration,
IReporter reporter,
string cliFallbackFolderPath,
IEnvironmentPath pathAdder)
@@ -40,7 +40,7 @@ namespace Microsoft.DotNet.Configurer
_aspNetCertificateSentinel = aspNetCertificateSentinel;
_aspNetCoreCertificateGenerator = aspNetCoreCertificateGenerator;
_toolPathSentinel = toolPathSentinel;
- _environmentProvider = environmentProvider;
+ _dotnetFirstRunConfiguration = dotnetFirstRunConfiguration;
_reporter = reporter;
_cliFallbackFolderPath = cliFallbackFolderPath;
_pathAdder = pathAdder ?? throw new ArgumentNullException(nameof(pathAdder));
@@ -93,11 +93,8 @@ namespace Microsoft.DotNet.Configurer
#if EXCLUDE_ASPNETCORE
return false;
#else
- var generateAspNetCertificate =
- _environmentProvider.GetEnvironmentVariableAsBool("DOTNET_GENERATE_ASPNET_CERTIFICATE", true);
-
return ShouldRunFirstRunExperience() &&
- generateAspNetCertificate &&
+ _dotnetFirstRunConfiguration.GenerateAspNetCertificate &&
!_aspNetCertificateSentinel.Exists();
#endif
}
@@ -116,11 +113,8 @@ namespace Microsoft.DotNet.Configurer
private bool ShouldPrintFirstTimeUseNotice()
{
- var showFirstTimeUseNotice =
- _environmentProvider.GetEnvironmentVariableAsBool("DOTNET_PRINT_TELEMETRY_MESSAGE", true);
-
return ShouldRunFirstRunExperience() &&
- showFirstTimeUseNotice &&
+ _dotnetFirstRunConfiguration.PrintTelemetryMessage &&
!_firstTimeUseNoticeSentinel.Exists();
}
@@ -157,10 +151,7 @@ namespace Microsoft.DotNet.Configurer
private bool ShouldRunFirstRunExperience()
{
- var skipFirstTimeExperience =
- _environmentProvider.GetEnvironmentVariableAsBool("DOTNET_SKIP_FIRST_TIME_EXPERIENCE", false);
-
- return !skipFirstTimeExperience;
+ return !_dotnetFirstRunConfiguration.SkipFirstRunExperience;
}
}
}
diff --git a/src/Microsoft.DotNet.Configurer/FirstTimeUseNoticeSentinel.cs b/src/Microsoft.DotNet.Configurer/FirstTimeUseNoticeSentinel.cs
index 78ae9caa5..84ad4bb3a 100644
--- a/src/Microsoft.DotNet.Configurer/FirstTimeUseNoticeSentinel.cs
+++ b/src/Microsoft.DotNet.Configurer/FirstTimeUseNoticeSentinel.cs
@@ -19,7 +19,7 @@ namespace Microsoft.DotNet.Configurer
private string SentinelPath => Path.Combine(_dotnetUserProfileFolderPath, SENTINEL);
- public FirstTimeUseNoticeSentinel(CliFolderPathCalculator cliFolderPathCalculator) :
+ public FirstTimeUseNoticeSentinel() :
this(
CliFolderPathCalculator.DotnetUserProfileFolderPath,
FileSystemWrapper.Default.File,
diff --git a/src/Microsoft.DotNet.Configurer/LocalizableStrings.resx b/src/Microsoft.DotNet.Configurer/LocalizableStrings.resx
index b40513e00..88d8f0736 100644
--- a/src/Microsoft.DotNet.Configurer/LocalizableStrings.resx
+++ b/src/Microsoft.DotNet.Configurer/LocalizableStrings.resx
@@ -154,4 +154,7 @@ Successfully installed the ASP.NET Core HTTPS Development Certificate.
To trust the certificate run 'dotnet dev-certs https --trust' (Windows and macOS only). For establishing trust on other platforms refer to the platform specific documentation.
For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054.
+
+ The user's home directory could not be determined. Set the '{0}' environment variable to specify the directory to use.
+
diff --git a/src/Microsoft.DotNet.Configurer/Microsoft.DotNet.Configurer.csproj b/src/Microsoft.DotNet.Configurer/Microsoft.DotNet.Configurer.csproj
index dbc6f7e6f..7ee265313 100644
--- a/src/Microsoft.DotNet.Configurer/Microsoft.DotNet.Configurer.csproj
+++ b/src/Microsoft.DotNet.Configurer/Microsoft.DotNet.Configurer.csproj
@@ -17,6 +17,7 @@
+
diff --git a/src/Microsoft.DotNet.Configurer/NuGetCachePrimer.cs b/src/Microsoft.DotNet.Configurer/NuGetCachePrimer.cs
index a0bc3bca5..6d71b89b5 100644
--- a/src/Microsoft.DotNet.Configurer/NuGetCachePrimer.cs
+++ b/src/Microsoft.DotNet.Configurer/NuGetCachePrimer.cs
@@ -17,31 +17,20 @@ namespace Microsoft.DotNet.Configurer
private readonly INuGetCacheSentinel _nuGetCacheSentinel;
- private readonly CliFolderPathCalculator _cliFolderPathCalculator;
-
- public NuGetCachePrimer(
- INuGetPackagesArchiver nugetPackagesArchiver,
- INuGetCacheSentinel nuGetCacheSentinel,
- CliFolderPathCalculator cliFolderPathCalculator)
- : this(nugetPackagesArchiver,
- nuGetCacheSentinel,
- cliFolderPathCalculator,
- FileSystemWrapper.Default.File)
+ public NuGetCachePrimer(INuGetPackagesArchiver nugetPackagesArchiver, INuGetCacheSentinel nuGetCacheSentinel)
+ : this(nugetPackagesArchiver, nuGetCacheSentinel, FileSystemWrapper.Default.File)
{
}
internal NuGetCachePrimer(
INuGetPackagesArchiver nugetPackagesArchiver,
INuGetCacheSentinel nuGetCacheSentinel,
- CliFolderPathCalculator cliFolderPathCalculator,
IFile file)
{
_nugetPackagesArchiver = nugetPackagesArchiver;
_nuGetCacheSentinel = nuGetCacheSentinel;
- _cliFolderPathCalculator = cliFolderPathCalculator;
-
_file = file;
}
@@ -52,7 +41,7 @@ namespace Microsoft.DotNet.Configurer
return;
}
- var nuGetFallbackFolder = _cliFolderPathCalculator.CliFallbackFolderPath;
+ var nuGetFallbackFolder = CliFolderPathCalculator.CliFallbackFolderPath;
_nugetPackagesArchiver.ExtractArchive(nuGetFallbackFolder);
diff --git a/src/Microsoft.DotNet.Configurer/NuGetCacheSentinel.cs b/src/Microsoft.DotNet.Configurer/NuGetCacheSentinel.cs
index ebaff5819..53a2137bd 100644
--- a/src/Microsoft.DotNet.Configurer/NuGetCacheSentinel.cs
+++ b/src/Microsoft.DotNet.Configurer/NuGetCacheSentinel.cs
@@ -27,8 +27,8 @@ namespace Microsoft.DotNet.Configurer
private Stream InProgressSentinel { get; set; }
- public NuGetCacheSentinel(CliFolderPathCalculator cliFolderPathCalculator) :
- this(cliFolderPathCalculator.CliFallbackFolderPath,
+ public NuGetCacheSentinel() :
+ this(CliFolderPathCalculator.CliFallbackFolderPath,
FileSystemWrapper.Default.File,
FileSystemWrapper.Default.Directory)
{
diff --git a/src/Microsoft.DotNet.Configurer/UserLevelCacheWriter.cs b/src/Microsoft.DotNet.Configurer/UserLevelCacheWriter.cs
index eeb69e526..678445ae7 100644
--- a/src/Microsoft.DotNet.Configurer/UserLevelCacheWriter.cs
+++ b/src/Microsoft.DotNet.Configurer/UserLevelCacheWriter.cs
@@ -14,7 +14,7 @@ namespace Microsoft.DotNet.Configurer
private readonly IDirectory _directory;
private string _dotnetUserProfileFolderPath;
- public UserLevelCacheWriter(CliFolderPathCalculator cliFolderPathCalculator) :
+ public UserLevelCacheWriter() :
this(
CliFolderPathCalculator.DotnetUserProfileFolderPath,
FileSystemWrapper.Default.File,
diff --git a/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.cs.xlf b/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.cs.xlf
index fef05f8fa..643ec0b2a 100644
--- a/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.cs.xlf
+++ b/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.cs.xlf
@@ -71,6 +71,11 @@ Pokud chcete certifikátu důvěřovat (platí jenom pro Windows a macOS), nains
Další informace o konfiguraci protokolu HTTPS najdete na webu https://go.microsoft.com/fwlink/?linkid=848054.
+
+ The user's home directory could not be determined. Set the '{0}' environment variable to specify the directory to use.
+ The user's home directory could not be determined. Set the '{0}' environment variable to specify the directory to use.
+
+