wixtoolset / issues

WiX Toolset Issues Tracker
http://wixtoolset.org/
129 stars 36 forks source link

Setting TargetFrameworks in .wixproj can confuse Restore #7925

Open vdrasutis opened 9 months ago

vdrasutis commented 9 months ago

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>
  2. 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** 
- found/checked this https://github.com/wixtoolset/issues/issues/6998 related issue - but was not able to solve mine issue.
- changing "UIRef" to "ui:WixUI" and vise versa.
- adding 'xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui"' namespace.
- used tool for migration.

**In the wix project I have**:
false Release x64 16.0 ariesoGEODatabaseScriptsInstaller GeoDatabaseScripts ..\..\ net472 ..\.. ..\.. $(Platform) $(GEOSourceRoot)\..\ariesoGEOInstallers\ GEOSourceRoot=$(GEOSourceRoot);GEOOutputDirectory=$(GEOOutputDirectory);GEOVersion=$(GEOVersion) True ICE80 ... GeoInstallDirectoryDialog.wxs GeoUICommon.wxs GeoVerifyReadyDialog.wxs ..\..\..\BuildTools\Wix\GeoWixFileVersionExtension.dll GeoWixFileVersionExtension

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

...

..\..\..\BuildTools\Wix\GeoWixFileVersionExtension.dll GeoWixFileVersionExtension $(WixExtDir)\WixUIExtension.dll WixUIExtension ConfigFilesHandler {f3f31d87-8ac9-49c3-93c8-88fcebb659e7} True True Binaries;Content;Satellites INSTALLFOLDER

...



Any advice what I am missing?

### Actual Result

Getting error

### Expected Result

project would build
barnson commented 9 months ago

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

vdrasutis commented 9 months ago

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

vdrasutis commented 9 months ago

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 commented 9 months ago

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 commented 9 months ago

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 commented 9 months ago

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