Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting TargetFrameworks in .wixproj can confuse Restore #7925

Open
vdrasutis opened this issue Dec 15, 2023 · 6 comments
Open

Setting TargetFrameworks in .wixproj can confuse Restore #7925

vdrasutis opened this issue Dec 15, 2023 · 6 comments
Assignees
Labels
Milestone

Comments

@vdrasutis
Copy link

WiX Version

4.0.3

.NET or MSBuild or Visual Studio Version

.NET 8 / VS 2022 17.8

HeatWave Version

1.0.2

Windows Version

Win11 23H2

Repro Repo

No response

Repro Steps

  1. I have "Product.wxs" like below:
 <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
     xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
     ...
    <!--<ui:WixUI Id="WixUI_InstallDir" />
    <UIRef Id="WixUI_ErrorProgressText" />
    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />-->
    
    <!-- Tried also  '<ui:WixUI Id="WixUI_Common" />' did not helped -->
    <UIRef Id="WixUI_Common" />
    <!-- In wix v3 was '<UIRef Id="GeoUICommon" />' , Found realated issue that in I need to use "ui:WixUI" Wiki: https://github.com/wixtoolset/issues/issues/6998 -->
/*[61 line]*/    <ui:WixUI Id="GeoUICommon" />
    ...

And "GeoUICommon.wxs" liek this:

<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
  <Fragment>

    <!-- Common Geo UI elements -->
    <UI Id="GeoUICommon">
      <Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION" />
      <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
      <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="11" Bold="yes" />
      <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
      <Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />

      <!-- Reference the dialogs we are going to use in the installer UI workflow -->
      <DialogRef Id="ErrorDlg" />
      <DialogRef Id="FatalError" />
      <DialogRef Id="FilesInUse" />
      <DialogRef Id="MsiRMFilesInUse" />
      <DialogRef Id="PrepareDlg" />
      <DialogRef Id="ProgressDlg" />
      <DialogRef Id="ResumeDlg" />
      <DialogRef Id="UserExit" />
      <DialogRef Id="GeoVerifyReadyDlg" />
      <DialogRef Id="NoneSelected" />
    </UI>
    
	</Fragment>
</Wix>
  1. When I tried to build project, I get error below:
Severity	Code	Description	Project	File	Line	Suppression State	Details
Error	WIX0200	The Package element contains an unhandled extension element 'WixUI'. Please ensure that the extension for elements in the 'http://wixtoolset.org/schemas/v4/wxs/ui' namespace has been provided.	GeoDatabaseScripts	C:\dev\git\geo\geotrunk\Geo\Source\Installers\GeoDatabaseScripts\Product.wxs	61		

I tried

In the wix project I have:

  <Project Sdk="WixToolset.Sdk/4.0.3">
  <Import Project="Sdk.props" Sdk="WixToolset.Sdk" Version="4.0.3" />
  <PropertyGroup>
    <EnableDefaultCompileItems>false</EnableDefaultCompileItems>
  </PropertyGroup>
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">x64</Platform>
    <ProductVersion>16.0</ProductVersion>
    <OutputName>ariesoGEODatabaseScriptsInstaller</OutputName>
    <Name>GeoDatabaseScripts</Name>
    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
    <TargetFrameworks>net472</TargetFrameworks>
  </PropertyGroup>
  <!-- Specifiy the source root directory and include our common geo targets -->
  <PropertyGroup>
    <GEOSourceRoot>..\..</GEOSourceRoot>
  </PropertyGroup>
  <Import Project="$(GEOSourceRoot)\GEO.CSharp.sdk.targets" />
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
    <GEOSourceRoot>..\..</GEOSourceRoot>
    <PlatformName>$(Platform)</PlatformName>
    <OutputPath>$(GEOSourceRoot)\..\ariesoGEOInstallers\</OutputPath>
    <DefineConstants>GEOSourceRoot=$(GEOSourceRoot);GEOOutputDirectory=$(GEOOutputDirectory);GEOVersion=$(GEOVersion)</DefineConstants>
    <SuppressPdbOutput>True</SuppressPdbOutput>
    <SuppressIces>ICE80</SuppressIces>
  </PropertyGroup>
  <ItemGroup>
     ...
    <Compile Include="..\Common\UI\GeoInstallDirectoryDialog.wxs">
      <Link>GeoInstallDirectoryDialog.wxs</Link>
    </Compile>
    <Compile Include="..\Common\UI\GeoUICommon.wxs">
      <Link>GeoUICommon.wxs</Link>
    </Compile>
    <Compile Include="..\Common\UI\GeoVerifyReadyDialog.wxs">
      <Link>GeoVerifyReadyDialog.wxs</Link>
    </Compile>
    <Compile Include="Product.wxs" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="WixToolset.UI.wixext" Version="4.0.3" />
    <PackageReference Include="WixToolset.Util.wixext" Version="4.0.3" />
  </ItemGroup>
  <ItemGroup>
    <WixExtension Include="GeoWixFileVersionExtension">
      <HintPath>..\..\..\BuildTools\Wix\GeoWixFileVersionExtension.dll</HintPath>
      <Name>GeoWixFileVersionExtension</Name>
    </WixExtension>
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\..\ConfigFilesHandler\ConfigFilesHandler.csproj" />
  </ItemGroup>
</Project>

In wix v3 before upgrading there was elements like this (only custom includes) - maybe these elements include is impacting, not properly migrated:

...
<ItemGroup>
    <WixExtension Include="GeoWixFileVersionExtension">
      <HintPath>..\..\..\BuildTools\Wix\GeoWixFileVersionExtension.dll</HintPath>
      <Name>GeoWixFileVersionExtension</Name>
    </WixExtension>
    <WixExtension Include="WixUIExtension">
      <HintPath>$(WixExtDir)\WixUIExtension.dll</HintPath>
      <Name>WixUIExtension</Name>
    </WixExtension>
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\..\ConfigFilesHandler\ConfigFilesHandler.csproj">
      <Name>ConfigFilesHandler</Name>
      <Project>{f3f31d87-8ac9-49c3-93c8-88fcebb659e7}</Project>
      <Private>True</Private>
      <DoNotHarvest>True</DoNotHarvest>
      <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
      <RefTargetDir>INSTALLFOLDER</RefTargetDir>
    </ProjectReference>
  </ItemGroup>
...

Any advice what I am missing?

Actual Result

Getting error

Expected Result

project would build

@barnson
Copy link
Member

barnson commented Dec 17, 2023

Please provide a minimal reproducible example as an attachment or GitHub repo.

vdrasutis added a commit to vdrasutis/wix_installer_issue_7925 that referenced this issue Dec 18, 2023
@vdrasutis
Copy link
Author

Hello, here the test project - with it you can repeat the issue: https://github.com/vdrasutis/wix_installer_issue_7925

@vdrasutis
Copy link
Author

Also same time could you provide sample how with defining/getting version parameter from some dll/exe, thank.

As I have in "Package.wxs"

<?define ProductVersion="$(fileVersion.ProductVersion($(var.MyOutputDirectory)\MyApp.exe))"?>

But if I add it to this minimal project as example - when I have commended out UI part and MSI is building successfully. Then I get that "ProductVersion" is not defined. Updated test project to also include this parameter code part.

Thanks

@robmen
Copy link
Member

robmen commented Dec 20, 2023

Your test repo does not build, and those warnings are also troublesome. Can you fix it, please?

MSBuild version 17.8.3+195e7f5a3 for .NET Framework
Build started 12/19/2023 5:50:04 PM.

Project "D:\src\xxx\wix_installer_issue_7925\Wix4Msi.sln" on node 1 (Restore target(s)).
ValidateSolutionConfiguration:
  Building solution configuration "Debug|ARM64".
D:\src\xxx\wix_installer_issue_7925\Installers\MyApp1\MyApp1.wixproj(2,3): warning MSB4011: "C:\Users\Rob\.nuget\packag
es\wixtoolset.sdk\4.0.3\Sdk\Sdk.props" cannot be imported again. It was already imported at "D:\src\xxx\wix_installer_i
ssue_7925\Installers\MyApp1\MyApp1.wixproj". This is most likely a build authoring error. This subsequent import will b
e ignored.
_GetAllRestoreProjectPathItems:
  Determining projects to restore...
D:\src\xxx\wix_installer_issue_7925\Installers\MyApp1\MyApp1.wixproj(2,3): warning MSB4011: "C:\Users\Rob\.nuget\packag
es\wixtoolset.sdk\4.0.3\Sdk\Sdk.props" cannot be imported again. It was already imported at "D:\src\xxx\wix_installer_i
ssue_7925\Installers\MyApp1\MyApp1.wixproj". This is most likely a build authoring error. This subsequent import will b
e ignored.
Restore:
  X.509 certificate chain validation will use the default trust store selected by .NET for code signing.
  X.509 certificate chain validation will use the default trust store selected by .NET for timestamping.
  Restoring packages for D:\src\xxx\wix_installer_issue_7925\Installers\MyApp1\MyApp1.wixproj...
    CACHE https://api.nuget.org/v3/vulnerabilities/index.json
    CACHE https://api.nuget.org/v3/vulnerabilities/vulnerability.base.json
    CACHE https://api.nuget.org/v3/vulnerabilities/vulnerability.update.json
  Generating MSBuild file D:\src\xxx\wix_installer_issue_7925\Installers\MyApp1\obj\MyApp1.wixproj.nuget.g.props.
  Generating MSBuild file D:\src\xxx\wix_installer_issue_7925\Installers\MyApp1\obj\MyApp1.wixproj.nuget.g.targets.
  Writing assets file to disk. Path: D:\src\xxx\wix_installer_issue_7925\Installers\MyApp1\obj\project.assets.json
  Restored D:\src\xxx\wix_installer_issue_7925\Installers\MyApp1\MyApp1.wixproj (in 445 ms).

  NuGet Config files used:
      C:\Users\Rob\AppData\Roaming\NuGet\NuGet.Config
      C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.FallbackLocation.config
      C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config

  Feeds used:
      https://api.nuget.org/v3/index.json
      C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
      https://nuget.pkg.github.com/wixtoolset/index.json
      D:\src\firegiant\HeatWaveBuildTools\build\artifacts\
Done Building Project "D:\src\xxx\wix_installer_issue_7925\Wix4Msi.sln" (Restore target(s)).

Project "D:\src\xxx\wix_installer_issue_7925\Wix4Msi.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
  Building solution configuration "Debug|ARM64".
D:\src\xxx\wix_installer_issue_7925\Installers\MyApp1\MyApp1.wixproj(2,3): warning MSB4011: "C:\Users\Rob\.nuget\packag
es\wixtoolset.sdk\4.0.3\Sdk\Sdk.props" cannot be imported again. It was already imported at "D:\src\xxx\wix_installer_i
ssue_7925\Installers\MyApp1\MyApp1.wixproj". This is most likely a build authoring error. This subsequent import will b
e ignored.
Project "D:\src\xxx\wix_installer_issue_7925\Wix4Msi.sln" (1:2) is building "D:\src\xxx\wix_installer_issue_7925\Instal
lers\MyApp1\MyApp1.wixproj" (2:9) on node 1 (default targets).
D:\src\xxx\wix_installer_issue_7925\Installers\MyApp1\MyApp1.wixproj(15,3): error MSB4019: The imported project "D:\src
\xxx\wix_installer_issue_7925\GEO.CSharp.sdk.targets" was not found. Confirm that the expression in the Import declarat
ion "..\..\GEO.CSharp.sdk.targets" is correct, and that the file exists on disk.
Done Building Project "D:\src\xxx\wix_installer_issue_7925\Installers\MyApp1\MyApp1.wixproj" (default targets) -- FAILE
D.

Done Building Project "D:\src\xxx\wix_installer_issue_7925\Wix4Msi.sln" (default targets) -- FAILED.


Build FAILED.

  D:\src\xxx\wix_installer_issue_7925\Installers\MyApp1\MyApp1.wixproj(2,3): warning MSB4011: "C:\Users\Rob\.nuget\pack
ages\wixtoolset.sdk\4.0.3\Sdk\Sdk.props" cannot be imported again. It was already imported at "D:\src\xxx\wix_installer
_issue_7925\Installers\MyApp1\MyApp1.wixproj". This is most likely a build authoring error. This subsequent import will
 be ignored.


  D:\src\xxx\wix_installer_issue_7925\Installers\MyApp1\MyApp1.wixproj(2,3): warning MSB4011: "C:\Users\Rob\.nuget\pack
ages\wixtoolset.sdk\4.0.3\Sdk\Sdk.props" cannot be imported again. It was already imported at "D:\src\xxx\wix_installer
_issue_7925\Installers\MyApp1\MyApp1.wixproj". This is most likely a build authoring error. This subsequent import will
 be ignored.


  D:\src\xxx\wix_installer_issue_7925\Installers\MyApp1\MyApp1.wixproj(2,3): warning MSB4011: "C:\Users\Rob\.nuget\pack
ages\wixtoolset.sdk\4.0.3\Sdk\Sdk.props" cannot be imported again. It was already imported at "D:\src\xxx\wix_installer
_issue_7925\Installers\MyApp1\MyApp1.wixproj". This is most likely a build authoring error. This subsequent import will
 be ignored.


"D:\src\xxx\wix_installer_issue_7925\Wix4Msi.sln" (default target) (1:2) ->
"D:\src\xxx\wix_installer_issue_7925\Installers\MyApp1\MyApp1.wixproj" (default target) (2:9) ->
  D:\src\xxx\wix_installer_issue_7925\Installers\MyApp1\MyApp1.wixproj(15,3): error MSB4019: The imported project "D:\s
rc\xxx\wix_installer_issue_7925\GEO.CSharp.sdk.targets" was not found. Confirm that the expression in the Import declar
ation "..\..\GEO.CSharp.sdk.targets" is correct, and that the file exists on disk.

@vdrasutis
Copy link
Author

Updated - hopefully should build now. Try and let me know. I know commended out the

<UIRef Id="WixUI_Common" />
<ui:WixUI Id="MyUICommon" />

So MSI should build initially successfully - need to uncomment to get error.

@barnson barnson added msbuild and removed triage labels Jan 2, 2024
@barnson barnson added this to the v5.0.0-preview.1 milestone Jan 2, 2024
@barnson
Copy link
Member

barnson commented Jan 2, 2024

TargetFrameworks is not applicable to WiX and prevents a proper restore.

@robmen robmen changed the title After upgrading Wix v3.11 projects to v4.0.3 - I am not able to reference UI elements Setting TargetFrameworks in .wixproj can confuse Restore Jan 16, 2024
@robmen robmen modified the milestones: v5.0.0-rc.1, v.Future Mar 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants