vs2022升級舊項目并發布時:Microsoft.WebTools.Shared.Exceptions.WebToolsException: 生成失敗
發布時間:2023/11/14 17:06:57 作者:Admin 閱讀:1218
廣告:
日志提示:
System.AggregateException: 發生一個或多個錯誤。 ---> Microsoft.WebTools.Shared.Exceptions.WebToolsException: 生成失敗。
錯誤提示:
無法發布-舊項目升級到vs2022發布時出現:該項目中不存在目標“GatherAllFilesToPublish”
一、添加引用:<Reference Include="Microsoft.CSharp" />
二、把 *.csproj 里面內容,換成:
<PropertyGroup> <AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects> </PropertyGroup>
換成:
<PropertyGroup> <AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects> <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion> <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> </PropertyGroup>
三、把 *.csproj 里面內容二行,中間加一行:
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
<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" />
廣告:
相關文章