错误MSB4057:目标“包装"错误在名为MVCWebUIComponent.csproj的项目文件中不存在 [英] error MSB4057: The target "Package" does not exist in the project file named MVCWebUIComponent.csproj

查看:125
本文介绍了错误MSB4057:目标“包装"错误在名为MVCWebUIComponent.csproj的项目文件中不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的文件名为MVCWebUIComponent.csproj,并在文件中添加了以下几行

I have a file name MVCWebUIComponent.csproj and I added below lines into my file

   <PropertyGroup>
        <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
        <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> </PropertyGroup>

    <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />

但它不会将目标软件包v10.0导入此路径

but it doesn't import the target package v10.0 into this path

C:\ Program Files(x86)\ MSBuild \ Microsoft \ VisualStudio

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio

. 我有v9.0文件夹,但是我需要将软件包v10.0导入我的visual studio2017.我该怎么办?

. I have v9.0 folder but I need to import package v10.0 into my visual studio 2017.what should i do?

推荐答案

我有v9.0文件夹,但我需要将软件包v10.0导入我的Visual Studio 2017中.我该怎么办?

I have v9.0 folder but I need to import package v10.0 into my visual studio 2017.what should i do?

不确定为什么要将包v10.0导入到Visual Studio 2017中.由于要将其导入到Visual Studio 2017中,因此$(MSBuildExtensionsPath32)的值应该是相对于MSBuild目录的新位置:

Not sure why you want import package v10.0 into your Visual Studio 2017. Since you want to import it into Visual Studio 2017, the value of $(MSBuildExtensionsPath32) should be the new location that is relative to the MSBuild directory:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild

因此,它不会将目标软件包v10.0导入到路径C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio.

So it doesn't import the target package v10.0 into the path C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio.

此外,导入命令:

<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />

是原始行的关闭版本( Condition ="false" ),允许Visual Studio仍将您的项目视为有效的Web应用程序项目(这就是VS的诀窍2010 SP1本身).因此,通常不会导入v10.0软件包.

is a turned-off version (Condition="false") of the original line that allows for Visual Studio to still consider your project to be a valid Web Application Project (that's the trick that VS 2010 SP1 does itself). So, in general, the package v10.0 is not imported.

您可以创建一个Web应用程序项目,检查该项目文件,您将找到以下代码:

You can create a web application project, check the project file, you will find below code:

  <PropertyGroup>
    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
  </PropertyGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />

导入命令<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />实际导入,最新行将在(Condition="false")导入.

The import command <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" /> is the actual import, and latest line will be import when (Condition="false").

如果您坚持将v10.0导入我的Visual Studio 2017,则只需在csproj中添加一些内容即可重定向MSBuildExtensionsPath:

If import package v10.0 into my visual studio 2017 is your insistence, you just need to add something to the csproj to redirect MSBuildExtensionsPath:

<PropertyGroup>
    <MSBuildExtensionsPath32>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio</MSBuildExtensionsPath32>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath32)\v10.0\WebApplications\Microsoft.WebApplication.targets" />

注意:由于您具有v9.0文件夹,因此应该从其他计算机复​​制v10.0.

Note: Since you are have v9.0 folder, you should copy v10.0 from other machine.

这篇关于错误MSB4057:目标“包装"错误在名为MVCWebUIComponent.csproj的项目文件中不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆