Меню Закрыть

Microsoft net sdk web

Got questions about NuGet or the NuGet Gallery?

Find out the service status of NuGet.org and its related services.

Read the Frequently Asked Questions about NuGet and see if your question made the list.

В версии MSBuild MSBuild 15.0 представлена новая концепция "пакет SDK проекта", которая упрощает применение пакетов разработки программного обеспечения, требующих импортировать свойства и целевые объекты. MSBuild MSBuild 15.0 introduced the concept of the "project SDK", which simplifies using software development kits that require properties and targets to be imported.

На этапе оценки проекта MSBuild MSBuild добавляет неявные директивы импорта в начале и конце кода проекта: During evaluation of the project, MSBuild MSBuild adds implicit imports at the top and bottom of your project:

Ссылка на пакет SDK проекта Reference a project SDK

Есть три разных способа указать ссылку на пакет SDK проекта: There are three ways to reference a project SDK:

Используйте атрибут Sdk в элементе

. Use the Sdk attribute on the

При этом в начале и конце кода проекта добавляются неявные директивы импорта, как описано выше. An implicit import is added to the top and bottom of the project as discussed above.

Чтобы указать определенную версию пакета SDK, ее можно добавить в атрибут Sdk . To specify a specific version of the SDK you may append it to the Sdk attribute:

Сейчас это единственный способ добавить ссылку на пакет SDK для проекта в Visual Studio для Mac. This is currently the only supported way to reference a project SDK in Visual Studio for Mac.

Используйте элемент верхнего уровня. Use the top-level element:

Читайте также:  Bitrix upload resize cache

При этом в начале и конце кода проекта добавляются неявные директивы импорта, как описано выше. An implicit import is added to the top and bottom of the project as discussed above. Атрибут Version не является обязательным. The Version attribute is not required.

Используйте элемент в любом месте кода проекта. Use the element anywhere in your project:

Явное включение директив импорта позволяет самостоятельно контролировать порядок добавления элементов. Explicitly including the imports in your project allows you full control over the order.

Если вы используете элемент , можно указать необязательный атрибут Version . When using the element, you can specify an optional Version attribute as well. Например, так: . For example, you can specify .

Как разрешаются ссылки на пакеты SDK проекта How project SDKs are resolved

При оценке директив импорта MSBuild MSBuild динамически разрешает путь к пакету SDK проекта, используя указанные значения имени и версии. When evaluating the import, MSBuild MSBuild dynamically resolves the path to the project SDK based on the name and version you specified. Также MSBuild MSBuild использует список зарегистрированных распознавателей SDK. Это подключаемые модули, которые отвечают за расположение пакетов SDK на компьютере. MSBuild MSBuild also has a list of registered SDK resolvers which are plug-ins that locate project SDKs on your machine. Далее следует список этих подключаемых модулей. These plug-ins include:

C:WebAppWebApp.csproj : error : The SDK ‘Microsoft.NET.Sdk.Web’ specified could not be found. C:WebAppWebApp.csproj

I am trying to open Dotnet core project and I am getting the above error.

I have checked the path for dotnet cmd and it works fine.

Am I missing something? Let me know if you need more information.

Читайте также:  Игра на кого я похож

The target framework is set to .NET 4.5.2

12 Answers 12

I stumbled upon this issue a number of times recently. Here’s a brief list of the workaround I found (one of them always worked until now):

  1. Install the right .NET Core SDK: Either the latest version or the version required by your project.
  2. Clean-up obsolete .NET Core versions: Go to Control Panel and uninstall previous .NET Core SDK/Runtime versions (as long as you don’t use them anymore).

Create a Global.json file: Add a new global.json file to your project’s root with the following content (replace the .NET Core version build with the one you want to run the project with):

Rename the SDK reference: Open your .proj file and replace

Add the MSBuildSDKsPath Environment Variable: The dotnet CLI sets the MSBuildSDKsPath environment variable when invoking MSBuild: however, a December 2016 patch changed the CLI behaviour so that it will respect an existing environment variable, if it has already been set: this will allow the developer to “force” the CLI to use a specific SDK.

  • Check your PATH: Verify that both C:Program Filesdotnet and C:Program Files (x86)dotnet are in the PATH environment variable.
  • For additional info regarding the issue and other viable fixes check out this blog post that I wrote on this topic.

    Рекомендуем к прочтению

    Добавить комментарий

    Ваш адрес email не будет опубликован.