Search code examples
c#c++wixoutlook-addinwix3.7

Wix Setup Project Giving Error While Building


I have developed add-in in C# (Not VSTO App). There are 4 projects in one solution.

  • Project1 (Class library type)
  • Project2 (Class library type)
  • Project3 (C++ project)
  • Project4 (Class library type)

Now i want to make a installer of it. I have created a wix setup project of it. But when i am trying to build this project, Its giving error as below :

Candle.exe : The extension 'Project1.dll' could not be loaded because of the following reason: Could not load file or assembly 'Project1.dll' or one of its dependencies. The module was expected to contain an assembly manifest.

If i am changing configuration from x64 to x86, It gives below error :

candle.exe(0,0): error CNDL0307: Either 'Microsoft.Tools.WindowsInstallerXml.AssemblyDefaultWixExtensionAttribute' was not defined in the assembly or the type defined in extension '...._bin\output\Project4.dll' could not be loaded.

Here is the build log where i am getting above (2nd) error :

C:\Program Files (x86)\WiX Toolset v3.14\bin\candle.exe
-d"DevEnvDir=C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\\" -dSolutionDir=C:\Users\...\OutlookPlugin\ 
-dSolutionExt=.sln 
-dSolutionFileName=app.sln
-dSolutionName=app 
-dSolutionPath=C:\Users\...\OutlookPlugin\app.sln
-dConfiguration=Debug 
-dOutDir=C:\Users\...\OutlookPlugin\_bin\output\ 
-dPlatform=x64 
-dProjectDir=C:\Users\...\OutlookPlugin\installers\Project1.addin.setup\ 
-dProjectExt=.wixproj -dProjectFileName=Project1.addin.setup.wixproj 
-dProjectName=Project1.addin.setup
-dProjectPath=C:\Users\...\OutlookPlugin\installers\Project1.addin.setup\Project1.addin.setup.wixproj 
-dTargetDir=C:\Users\...\OutlookPlugin\_bin\output\ 
-dTargetExt=.msi -dTargetFileName=Project1.addin.setup.msi 
-dTargetName=Project1.addin.setup 
-dTargetPath=C:\Users\...\OutlookPlugin\_bin\output\Project1.addin.setup.msi 
    -out obj\\Debug\ -arch x64 
    -ext "C:\Program Files (x86)\WiX Toolset v3.14\bin\\WixUIExtension.dll" 
    -ext "C:\Program Files (x86)\WiX Toolset v3.14\bin\\WixNetFxExtension.dll" 
    -ext ..\..\_bin\output\Project4.dll 
    -ext ..\..\_bin\output\Project3.dll 
    -ext ..\..\_bin\output\Project2.dll 
    -ext ..\..\_bin\output\Project1.dll Product.wxs

I have added all references to it & Wix editor not showing any error.

I don't know why this error is occurring.

Need a solution of it. Thanks All.


Solution

  • Is ...._bin\output\Project4.dll a WixExtension?

    If not (and I'm guessing it isn't), you need to remove the -ext switch and the path so the WiX Toolset doesn't try to load the file as a WixExtension. You'll probably want to do the same for all of these as well.

    -ext ..\..\_bin\output\Project4.ui.dll 
    -ext ..\..\_bin\output\Project3.dll 
    -ext ..\..\_bin\output\Project2.dll 
    -ext ..\..\_bin\output\Project1.dll