Skip to content
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
25 changes: 25 additions & 0 deletions src/NuGet.Clients/NuGet.CommandLine/MsBuildUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,17 @@ public static Lazy<MsBuildToolset> GetMsBuildDirectoryFromMsBuildPath(string msb
throw new CommandException(message);
}

if (IsNetCoreMsBuildDirectory(msbuildPath))
{
var message = string.Format(
CultureInfo.CurrentCulture,
LocalizedResourceManager.GetString(
nameof(NuGetResources.Error_MsBuildIsNetCoreMsBuild)),
msbuildPath);

throw new CommandException(message);
}

return new Lazy<MsBuildToolset>(() => new MsBuildToolset(msbuildVersion, msbuildPath));
}
else
Expand All @@ -871,6 +882,20 @@ public static Lazy<MsBuildToolset> GetMsBuildDirectoryFromMsBuildPath(string msb
}
}

/// <summary>
/// Detects whether the given directory contains a .NET SDK (dotnet) MSBuild installation
/// rather than a .NET Framework MSBuild installation.
/// NuGet.exe requires .NET Framework MSBuild because it loads Microsoft.Build.dll
/// in-process via Assembly.LoadFrom, which is incompatible with .NET Core assemblies.
/// Detection uses the presence of MSBuild.runtimeconfig.json, which is the canonical
/// indicator of a .NET Core application and will be present even if a future SDK
/// ships an AoT-compiled MSBuild.exe.
/// </summary>
internal static bool IsNetCoreMsBuildDirectory(string msbuildPath)
{
return File.Exists(Path.Combine(msbuildPath, "MSBuild.runtimeconfig.json"));
}

private static void AddProperty(List<string> args, string property, string value)
{
if (string.IsNullOrEmpty(value))
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/NuGet.Clients/NuGet.CommandLine/NuGetResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,10 @@ Do not localize `SDK`, `dotnet pack`, msbuild -t:pack` and 'true'.</comment>
<data name="Error_CannotFindNonArchitectureSpecificMsbuild" xml:space="preserve">
<value>The resolved MSBuild directory is `{0}` which is an architecture-specific directory. Could not find MSBuild in its parent directory (non-architecture specific).</value>
</data>
<data name="Error_MsBuildIsNetCoreMsBuild" xml:space="preserve">
<value>The MSBuild directory '{0}' appears to be a .NET SDK (dotnet) MSBuild installation. NuGet.exe requires the .NET Framework version of MSBuild, which is included with Visual Studio. Use 'dotnet restore' instead, or provide the path to a Visual Studio MSBuild installation.</value>
<comment>{0} is the MSBuild directory path. Do not localize 'NuGet.exe', 'MSBuild', '.NET SDK', '.NET Framework', 'dotnet restore', 'Visual Studio'.</comment>
</data>
<data name="Warning_CommandDeprecated" xml:space="preserve">
<value>'{0} {1}' is deprecated. Use '{0} {2}' instead.</value>
<comment>{0} - name of the assembly running the command, e.g., NuGet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ Do not localize `SDK`, `dotnet pack`, msbuild -t:pack` and 'true'.</note>
<target state="translated">Není zadaný zdrojový parametr.</target>
<note />
</trans-unit>
<trans-unit id="Error_MsBuildIsNetCoreMsBuild">
<source>The MSBuild directory '{0}' appears to be a .NET SDK (dotnet) MSBuild installation. NuGet.exe requires the .NET Framework version of MSBuild, which is included with Visual Studio. Use 'dotnet restore' instead, or provide the path to a Visual Studio MSBuild installation.</source>
<target state="new">The MSBuild directory '{0}' appears to be a .NET SDK (dotnet) MSBuild installation. NuGet.exe requires the .NET Framework version of MSBuild, which is included with Visual Studio. Use 'dotnet restore' instead, or provide the path to a Visual Studio MSBuild installation.</target>
<note>{0} is the MSBuild directory path. Do not localize 'NuGet.exe', 'MSBuild', '.NET SDK', '.NET Framework', 'dotnet restore', 'Visual Studio'.</note>
</trans-unit>
<trans-unit id="Error_MsBuildTimedOut">
<source>MsBuild timeout out while trying to get project to project references.</source>
<target state="translated">Při pokusu o získání odkazů projektu na projekt vypršel časový limit nástroje MsBuild.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ Do not localize `SDK`, `dotnet pack`, msbuild -t:pack` and 'true'.</note>
<target state="translated">Der Quellparameter wurde nicht angegeben.</target>
<note />
</trans-unit>
<trans-unit id="Error_MsBuildIsNetCoreMsBuild">
<source>The MSBuild directory '{0}' appears to be a .NET SDK (dotnet) MSBuild installation. NuGet.exe requires the .NET Framework version of MSBuild, which is included with Visual Studio. Use 'dotnet restore' instead, or provide the path to a Visual Studio MSBuild installation.</source>
<target state="new">The MSBuild directory '{0}' appears to be a .NET SDK (dotnet) MSBuild installation. NuGet.exe requires the .NET Framework version of MSBuild, which is included with Visual Studio. Use 'dotnet restore' instead, or provide the path to a Visual Studio MSBuild installation.</target>
<note>{0} is the MSBuild directory path. Do not localize 'NuGet.exe', 'MSBuild', '.NET SDK', '.NET Framework', 'dotnet restore', 'Visual Studio'.</note>
</trans-unit>
<trans-unit id="Error_MsBuildTimedOut">
<source>MsBuild timeout out while trying to get project to project references.</source>
<target state="translated">MsBuild-Zeitüberschreitung beim Abrufen von Projekt-zu-Projekt-Verweisen.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ Do not localize `SDK`, `dotnet pack`, msbuild -t:pack` and 'true'.</note>
<target state="translated">No se especificó el parámetro de origen.</target>
<note />
</trans-unit>
<trans-unit id="Error_MsBuildIsNetCoreMsBuild">
<source>The MSBuild directory '{0}' appears to be a .NET SDK (dotnet) MSBuild installation. NuGet.exe requires the .NET Framework version of MSBuild, which is included with Visual Studio. Use 'dotnet restore' instead, or provide the path to a Visual Studio MSBuild installation.</source>
<target state="new">The MSBuild directory '{0}' appears to be a .NET SDK (dotnet) MSBuild installation. NuGet.exe requires the .NET Framework version of MSBuild, which is included with Visual Studio. Use 'dotnet restore' instead, or provide the path to a Visual Studio MSBuild installation.</target>
<note>{0} is the MSBuild directory path. Do not localize 'NuGet.exe', 'MSBuild', '.NET SDK', '.NET Framework', 'dotnet restore', 'Visual Studio'.</note>
</trans-unit>
<trans-unit id="Error_MsBuildTimedOut">
<source>MsBuild timeout out while trying to get project to project references.</source>
<target state="translated">Se agotó el tiempo de espera de MsBuild al intentar obtener referencias de proyecto a proyecto.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ Do not localize `SDK`, `dotnet pack`, msbuild -t:pack` and 'true'.</note>
<target state="translated">Le paramètre source n'a pas été spécifié.</target>
<note />
</trans-unit>
<trans-unit id="Error_MsBuildIsNetCoreMsBuild">
<source>The MSBuild directory '{0}' appears to be a .NET SDK (dotnet) MSBuild installation. NuGet.exe requires the .NET Framework version of MSBuild, which is included with Visual Studio. Use 'dotnet restore' instead, or provide the path to a Visual Studio MSBuild installation.</source>
<target state="new">The MSBuild directory '{0}' appears to be a .NET SDK (dotnet) MSBuild installation. NuGet.exe requires the .NET Framework version of MSBuild, which is included with Visual Studio. Use 'dotnet restore' instead, or provide the path to a Visual Studio MSBuild installation.</target>
<note>{0} is the MSBuild directory path. Do not localize 'NuGet.exe', 'MSBuild', '.NET SDK', '.NET Framework', 'dotnet restore', 'Visual Studio'.</note>
</trans-unit>
<trans-unit id="Error_MsBuildTimedOut">
<source>MsBuild timeout out while trying to get project to project references.</source>
<target state="translated">Expiration du délai de MsBuild lors de la tentative d’obtention des références de projet à projet.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ Do not localize `SDK`, `dotnet pack`, msbuild -t:pack` and 'true'.</note>
<target state="translated">Il parametro di origine non è stato specificato.</target>
<note />
</trans-unit>
<trans-unit id="Error_MsBuildIsNetCoreMsBuild">
<source>The MSBuild directory '{0}' appears to be a .NET SDK (dotnet) MSBuild installation. NuGet.exe requires the .NET Framework version of MSBuild, which is included with Visual Studio. Use 'dotnet restore' instead, or provide the path to a Visual Studio MSBuild installation.</source>
<target state="new">The MSBuild directory '{0}' appears to be a .NET SDK (dotnet) MSBuild installation. NuGet.exe requires the .NET Framework version of MSBuild, which is included with Visual Studio. Use 'dotnet restore' instead, or provide the path to a Visual Studio MSBuild installation.</target>
<note>{0} is the MSBuild directory path. Do not localize 'NuGet.exe', 'MSBuild', '.NET SDK', '.NET Framework', 'dotnet restore', 'Visual Studio'.</note>
</trans-unit>
<trans-unit id="Error_MsBuildTimedOut">
<source>MsBuild timeout out while trying to get project to project references.</source>
<target state="translated">Timeout di MsBuild durante il tentativo di ottenere i riferimenti da progetto a progetto.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ Do not localize `SDK`, `dotnet pack`, msbuild -t:pack` and 'true'.</note>
<target state="translated">ソース パラメーターが指定されていませんでした。</target>
<note />
</trans-unit>
<trans-unit id="Error_MsBuildIsNetCoreMsBuild">
<source>The MSBuild directory '{0}' appears to be a .NET SDK (dotnet) MSBuild installation. NuGet.exe requires the .NET Framework version of MSBuild, which is included with Visual Studio. Use 'dotnet restore' instead, or provide the path to a Visual Studio MSBuild installation.</source>
<target state="new">The MSBuild directory '{0}' appears to be a .NET SDK (dotnet) MSBuild installation. NuGet.exe requires the .NET Framework version of MSBuild, which is included with Visual Studio. Use 'dotnet restore' instead, or provide the path to a Visual Studio MSBuild installation.</target>
<note>{0} is the MSBuild directory path. Do not localize 'NuGet.exe', 'MSBuild', '.NET SDK', '.NET Framework', 'dotnet restore', 'Visual Studio'.</note>
</trans-unit>
<trans-unit id="Error_MsBuildTimedOut">
<source>MsBuild timeout out while trying to get project to project references.</source>
<target state="translated">プロジェクトからプロジェクトへの参照を取得しようとしているときに MSBuild がタイムアウトしました。</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ Do not localize `SDK`, `dotnet pack`, msbuild -t:pack` and 'true'.</note>
<target state="translated">원본 매개 변수를 지정하지 않았습니다.</target>
<note />
</trans-unit>
<trans-unit id="Error_MsBuildIsNetCoreMsBuild">
<source>The MSBuild directory '{0}' appears to be a .NET SDK (dotnet) MSBuild installation. NuGet.exe requires the .NET Framework version of MSBuild, which is included with Visual Studio. Use 'dotnet restore' instead, or provide the path to a Visual Studio MSBuild installation.</source>
<target state="new">The MSBuild directory '{0}' appears to be a .NET SDK (dotnet) MSBuild installation. NuGet.exe requires the .NET Framework version of MSBuild, which is included with Visual Studio. Use 'dotnet restore' instead, or provide the path to a Visual Studio MSBuild installation.</target>
<note>{0} is the MSBuild directory path. Do not localize 'NuGet.exe', 'MSBuild', '.NET SDK', '.NET Framework', 'dotnet restore', 'Visual Studio'.</note>
</trans-unit>
<trans-unit id="Error_MsBuildTimedOut">
<source>MsBuild timeout out while trying to get project to project references.</source>
<target state="translated">프로젝트에서 프로젝트 참조를 가져오는 동안 MsBuild 시간이 초과되었습니다.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ Do not localize `SDK`, `dotnet pack`, msbuild -t:pack` and 'true'.</note>
<target state="translated">Parametr źródłowy nie został określony.</target>
<note />
</trans-unit>
<trans-unit id="Error_MsBuildIsNetCoreMsBuild">
<source>The MSBuild directory '{0}' appears to be a .NET SDK (dotnet) MSBuild installation. NuGet.exe requires the .NET Framework version of MSBuild, which is included with Visual Studio. Use 'dotnet restore' instead, or provide the path to a Visual Studio MSBuild installation.</source>
<target state="new">The MSBuild directory '{0}' appears to be a .NET SDK (dotnet) MSBuild installation. NuGet.exe requires the .NET Framework version of MSBuild, which is included with Visual Studio. Use 'dotnet restore' instead, or provide the path to a Visual Studio MSBuild installation.</target>
<note>{0} is the MSBuild directory path. Do not localize 'NuGet.exe', 'MSBuild', '.NET SDK', '.NET Framework', 'dotnet restore', 'Visual Studio'.</note>
</trans-unit>
<trans-unit id="Error_MsBuildTimedOut">
<source>MsBuild timeout out while trying to get project to project references.</source>
<target state="translated">Przekroczono limit czasu programu MsBuild podczas próby pobrania odwołań projektu do projektu.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ Do not localize `SDK`, `dotnet pack`, msbuild -t:pack` and 'true'.</note>
<target state="translated">O parâmetro de origem não foi especificado.</target>
<note />
</trans-unit>
<trans-unit id="Error_MsBuildIsNetCoreMsBuild">
<source>The MSBuild directory '{0}' appears to be a .NET SDK (dotnet) MSBuild installation. NuGet.exe requires the .NET Framework version of MSBuild, which is included with Visual Studio. Use 'dotnet restore' instead, or provide the path to a Visual Studio MSBuild installation.</source>
<target state="new">The MSBuild directory '{0}' appears to be a .NET SDK (dotnet) MSBuild installation. NuGet.exe requires the .NET Framework version of MSBuild, which is included with Visual Studio. Use 'dotnet restore' instead, or provide the path to a Visual Studio MSBuild installation.</target>
<note>{0} is the MSBuild directory path. Do not localize 'NuGet.exe', 'MSBuild', '.NET SDK', '.NET Framework', 'dotnet restore', 'Visual Studio'.</note>
</trans-unit>
<trans-unit id="Error_MsBuildTimedOut">
<source>MsBuild timeout out while trying to get project to project references.</source>
<target state="translated">O tempo limite do MsBuild foi atingido ao tentar obter referências do projeto para o projeto.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ Do not localize `SDK`, `dotnet pack`, msbuild -t:pack` and 'true'.</note>
<target state="translated">Исходный параметр не указан.</target>
<note />
</trans-unit>
<trans-unit id="Error_MsBuildIsNetCoreMsBuild">
<source>The MSBuild directory '{0}' appears to be a .NET SDK (dotnet) MSBuild installation. NuGet.exe requires the .NET Framework version of MSBuild, which is included with Visual Studio. Use 'dotnet restore' instead, or provide the path to a Visual Studio MSBuild installation.</source>
<target state="new">The MSBuild directory '{0}' appears to be a .NET SDK (dotnet) MSBuild installation. NuGet.exe requires the .NET Framework version of MSBuild, which is included with Visual Studio. Use 'dotnet restore' instead, or provide the path to a Visual Studio MSBuild installation.</target>
<note>{0} is the MSBuild directory path. Do not localize 'NuGet.exe', 'MSBuild', '.NET SDK', '.NET Framework', 'dotnet restore', 'Visual Studio'.</note>
</trans-unit>
<trans-unit id="Error_MsBuildTimedOut">
<source>MsBuild timeout out while trying to get project to project references.</source>
<target state="translated">При попытке получить ссылки проекта на проект истекло время ожидания MsBuild.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ Do not localize `SDK`, `dotnet pack`, msbuild -t:pack` and 'true'.</note>
<target state="translated">Kaynak parametresi belirtilmedi.</target>
<note />
</trans-unit>
<trans-unit id="Error_MsBuildIsNetCoreMsBuild">
<source>The MSBuild directory '{0}' appears to be a .NET SDK (dotnet) MSBuild installation. NuGet.exe requires the .NET Framework version of MSBuild, which is included with Visual Studio. Use 'dotnet restore' instead, or provide the path to a Visual Studio MSBuild installation.</source>
<target state="new">The MSBuild directory '{0}' appears to be a .NET SDK (dotnet) MSBuild installation. NuGet.exe requires the .NET Framework version of MSBuild, which is included with Visual Studio. Use 'dotnet restore' instead, or provide the path to a Visual Studio MSBuild installation.</target>
<note>{0} is the MSBuild directory path. Do not localize 'NuGet.exe', 'MSBuild', '.NET SDK', '.NET Framework', 'dotnet restore', 'Visual Studio'.</note>
</trans-unit>
<trans-unit id="Error_MsBuildTimedOut">
<source>MsBuild timeout out while trying to get project to project references.</source>
<target state="translated">Proje başvuruları için proje alınmaya çalışılırken MsBuild zaman aşımına uğradı.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ Do not localize `SDK`, `dotnet pack`, msbuild -t:pack` and 'true'.</note>
<target state="translated">未指定源参数。</target>
<note />
</trans-unit>
<trans-unit id="Error_MsBuildIsNetCoreMsBuild">
<source>The MSBuild directory '{0}' appears to be a .NET SDK (dotnet) MSBuild installation. NuGet.exe requires the .NET Framework version of MSBuild, which is included with Visual Studio. Use 'dotnet restore' instead, or provide the path to a Visual Studio MSBuild installation.</source>
<target state="new">The MSBuild directory '{0}' appears to be a .NET SDK (dotnet) MSBuild installation. NuGet.exe requires the .NET Framework version of MSBuild, which is included with Visual Studio. Use 'dotnet restore' instead, or provide the path to a Visual Studio MSBuild installation.</target>
<note>{0} is the MSBuild directory path. Do not localize 'NuGet.exe', 'MSBuild', '.NET SDK', '.NET Framework', 'dotnet restore', 'Visual Studio'.</note>
</trans-unit>
<trans-unit id="Error_MsBuildTimedOut">
<source>MsBuild timeout out while trying to get project to project references.</source>
<target state="translated">尝试将项目获取到项目引用时,MsBuild 超时。</target>
Expand Down
Loading