Skip to content

Instantly share code, notes, and snippets.

@amaitland
Created June 20, 2022 06:32
Show Gist options
  • Save amaitland/4f7fecf464703b2b82b22d0360c3db9e to your computer and use it in GitHub Desktop.
Save amaitland/4f7fecf464703b2b82b22d0360c3db9e to your computer and use it in GitHub Desktop.
NETSDK1145 - Update KnownAppHostPack AppHostPackVersion
<Project>
<!--
Update AppHostPackVersion for .net core 3.1
https://docs.microsoft.com/en-gb/dotnet/core/tools/sdk-errors/netsdk1145
https://developercommunity.visualstudio.com/t/netsdk1145-the-apphost-pack-is-not-installed-error/1513220
-->
<ItemGroup>
<KnownAppHostPack Update="@(KnownAppHostPack)">
<AppHostPackVersion Condition="'%(TargetFramework)' == 'netcoreapp3.1'">3.1.26</AppHostPackVersion>
</KnownAppHostPack>
</ItemGroup>
<!--
<Target Name="OutputBeforeProcessFrameworkReferences" BeforeTargets="ProcessFrameworkReferences">
<Message Importance="high" Text="KnownAppHostPack = %(KnownAppHostPack.AppHostPackVersion)" />
<Message Importance="high" Text="KnownAppHostPack = %(KnownAppHostPack.TargetFramework)" />
</Target>
-->
</Project>
@amaitland
Copy link
Author

In vcxproj attempting to update the ItemGroup from a .props file failed, seems it was set too soon. Adding directly to the vcxproj file was necessary to add after all .targets imports. Using Directory.Build.targets appears to work as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment