2

I have a custom WIX extension (dll) that I would like to manage as a Nuget package that I can use for WIX installer projects in Visual Studio 2017. At first the Nuget package would not install, giving me this error:

Could not install package 'MyExtension 1.0.10859'. You are trying to install this package into a project that targets 'Unsupported,Version=v0.0', but the package does not contain any assembly references or content files that are compatible with that framework.

Someone suggested that I needed to create a .targets file to include in my package that looked something like this:

<?xml version="1.0" encoding="utf-8" ?>
<Project ToolsVersion="4.0"  
 xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 <ItemGroup>
   <WixExtension 
   Include="$(MSBuildThisFileDirectory)..\tools\MyExtension.dll" />
 </ItemGroup>

Now the Nuget package is installed to the packages folder and added to my packages.config file, but the assembly MyExtension.dll is not added to the References for the WIX installer project. How can I get it to be added to the References when I install the Nuget package?

I saw this solution on How to Add Nuget package dlls to Wix installer when I was searching through StackOverflow. And it is a fine solution if the package you are installing is from a third party and you have no control on how it was packaged. But I am creating the Nuget package and would like to package it in a way that it can be directly installed into the WIX project.

1 Answer 1

0

How to add WIX extension to a Nuget package for use by a WIX installer project

You can create a new blank project (library) and install the nuget-package in this new project. Then add the .dll as a component in your installer:

<Component Id="cmpId1"  Guid="BF985D52-BA8C-4E4F-84CC-B5A95520FBD4">
      <File Id="fileId1" KeyPath="yes" Source="$(var.NugetCollectorProject.TargetDir)\Unity.Abstractions.dll" />
   </Component>

certificate:How to Add Nuget package dlls to Wix installer

Hope this helps.

Sign up to request clarification or add additional context in comments.

2 Comments

I saw this solution when I was searching through StackOverflow. And it is a fine solution if the package you are installing is from a third party and you have no control on how it was packaged. But I am creating the Nuget package and would like to package it in a way that it can be directly installed into the WIX project.
@KevinJunghans, If you want a way to directly installed nuget into the WIX project, I am afraid you have to using .targets file to include in the package, but if you still want add .dll file the References node, I am afraid you could not do that. stackoverflow.com/questions/49507194/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.