Asp.net web api MSBuild Web API项目未创建可部署包
我试图从一个WebAPI项目创建一个可部署的包,但我得到了一个错误Asp.net web api MSBuild Web API项目未创建可部署包,asp.net-web-api,msbuild,webdeploy,Asp.net Web Api,Msbuild,Webdeploy,我试图从一个WebAPI项目创建一个可部署的包,但我得到了一个错误 error MSB4057: The target "Package" does not exist in the project. 当我尝试构建一个运行MVC5的web应用程序时,我没有任何问题 构建MVC5应用程序的命令是 MSBuild.exe Project.Web.csproj /P:Configuration=Debug /T:Package MSBuild.exe Project.Api.csproj /P:C
error MSB4057: The target "Package" does not exist in the project.
当我尝试构建一个运行MVC5的web应用程序时,我没有任何问题
构建MVC5应用程序的命令是
MSBuild.exe Project.Web.csproj /P:Configuration=Debug /T:Package
MSBuild.exe Project.Api.csproj /P:Configuration=Debug /T:Package
失败的web api应用程序的命令为
MSBuild.exe Project.Web.csproj /P:Configuration=Debug /T:Package
MSBuild.exe Project.Api.csproj /P:Configuration=Debug /T:Package
我假设我可能需要安装一些东西,但我不知道是什么。谁知道我做错了什么
注意:如果您需要更多信息,请告诉我。我四处阅读,发现可能需要添加属性
VisualStudioVersion
,但每次尝试该属性时,软件包仍然失败
我刚刚比较了csproj文件,发现缺少以下属性组:
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
10
$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
添加此选项可以修复此问题,因此我可能需要VisualStudioVersion
和VSToolsPath
在那之后,我很快遇到了部署问题,这反过来又与更多的配置差异有关。这一次,它是最顶层的节点项目
。属性ToolsVersion
在一个项目中设置为4.0
,在另一个项目中设置为12.0
。将它们都设置为4.0
修复了它,可能是因为我使用MSBuild 4进行编译?我不想撒谎,这主要是几天来的反复试验。上帝啊,我希望我再也不用碰这个密码了