I added a Windows Application Packaging Project to my Visual Studio solution called "Installer". Then I used that project to create a template using the Visual Studio Project "Create Template" option. When I try to use that template to create a project in another solution, it fails with the following error.
The template "Installer Project" was created successfully.
Invalid project `C:\git\Test Windows App\src\Installer\Installer.wapproj`. The imported project "C:\Program Files\dotnet\sdk\5.0.100\Microsoft\DesktopBridge\Microsoft.DesktopBridge.props" was not found. Confirm that the expression in the Import declaration "C:\Program Files\dotnet\sdk\5.0.100\Microsoft\DesktopBridge\\Microsoft.DesktopBridge.props" is correct, and that the file exists on disk. C:\git\Test Windows App\src\Installer\Installer.wapproj.
I'm using Visual Studio Enterprise 2019 Version 16.8.2 to create the template. I create the project using PowerShell
dotnet new -i .\
dotnet new mlknwindowsinstaller
I have several other projects that I have created templates for and they all work.
The Installer.wapproj file has the following
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '15.0'">
<VisualStudioVersion>15.0</VisualStudioVersion>
</PropertyGroup>
.
.
.
<PropertyGroup>
<WapProjPath Condition="'$(WapProjPath)'==''">$(MSBuildExtensionsPath)\Microsoft\DesktopBridge\</WapProjPath>
</PropertyGroup>
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.props" />
.
.
.
<ItemGroup>
<ProjectReference Include="..\Client\Client.csproj">
<DesktopBridgeSelfContained>True</DesktopBridgeSelfContained>
<DesktopBridgeIdentifier>win-x64</DesktopBridgeIdentifier>
<Properties>DesktopBridgeSelfContained=%(DesktopBridgeSelfContained);DesktopBridgeIdentifier=%(DesktopBridgeIdentifier)</Properties>
<SkipGetTargetFrameworkProperties>True</SkipGetTargetFrameworkProperties>
</ProjectReference>
</ItemGroup>
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.targets" />
</Project>
I have checked the indicated location and those files are not there.