0

I'm trying to create my MSI setup with WiX and MSBuild command which deploy my img.png into a repertory and i have this error :

"MSB4019: project imported "C:\Program Files\MSBuild\Microsoft\WiX\v[[Version.M ajor]].x\Wix.targets" was not found. " Make sure that path of declaration are correct

In this line :

<Import Project="$(WixTargetPath)" />

Here my 2 files (test.wixproj and test.wxs) :

test.wixproj

<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
        <PropertyGroup>
                <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
                <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
                <ProductVersion>3.0</ProductVersion>
                <ProjectGuid>{}</ProjectGuid>
                <SchemaVersion>2.0</SchemaVersion>
                <OutputName>WixProject1</OutputName>
                <OutputType>Package</OutputType>
                <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v[[Version.Major]].x\Wix.targets</WixTargetsPath>
        </PropertyGroup>
        <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
                <OutputPath>bin\$(Configuration)\</OutputPath>
                <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
                <DefineConstants>Debug</DefineConstants>
        </PropertyGroup>
        <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
                <OutputPath>bin\$(Configuration)\</OutputPath>
                <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
        </PropertyGroup>
        <ItemGroup>
                <Compile Include="C:\testW2.wxs" />
        </ItemGroup>
        <Import Project="$(WixTargetsPath)" />
    </Project>

test.wxs

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*" UpgradeCode="" Version="1.0.0.0" Language="1033" Name="My Application Name" Manufacturer="My Manufacturer Name">
        <Package InstallerVersion="300" Compressed="yes"/>
        <Media Id="1" Cabinet="myapplication.cab" EmbedCab="yes" />


        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder">
                <Directory Id="APPLICATIONROOTDIRECTORY" Name="Application test"/>
            </Directory>
        </Directory>


        <DirectoryRef Id="APPLICATIONROOTDIRECTORY">
            <Component Id="myimg" Guid="">
                <File Id="myimg" Source="C:\img.png" KeyPath="yes" Checksum="yes"/>
            </Component>

        </DirectoryRef>


        <Feature Id="MainApplication" Title="Main Application" Level="1">
            <ComponentRef Id="myimg" />
        </Feature>
    </Product>
</Wix>

I don't unstandand where is the problem and i don't find an easy tutorial on WiX without VisualStudio.

Can you help me ?

1 Answer 1

1

There are two problems with your project file:

  1. The <WixTargetPath ...> line [[MajorVersion]] should be replaced with '3',
  2. The <Compile...> line should to refer to the correct file 'Test.wxs'.

Try this project file:

<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
            <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
            <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
            <ProductVersion>3.0</ProductVersion>
            <ProjectGuid>{}</ProjectGuid>
            <SchemaVersion>2.0</SchemaVersion>
            <OutputName>WixProject1</OutputName>
            <OutputType>Package</OutputType>
            <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
    </PropertyGroup>
    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
            <OutputPath>bin\$(Configuration)\</OutputPath>
            <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
            <DefineConstants>Debug</DefineConstants>
    </PropertyGroup>
    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
            <OutputPath>bin\$(Configuration)\</OutputPath>
            <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
    </PropertyGroup>
    <ItemGroup>
            <Compile Include="test.wxs" />
    </ItemGroup>
    <Import Project="$(WixTargetsPath)" />
</Project>

You also need to make sure test.wxs has a GUID in the UpgradeCode attribute.

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

3 Comments

Oh thank you, it works. But do you know how to change the repertory to install, here is C\Programmfiles\myapplication ? I would C:\Documents and settings\toto\Desktop for example. Or if i want install 2 files into a folder and 2 others files in another folder ?
The WIX toolset has good documentation on this topic wixtoolset.org/documentation/manual/v3/howtos/…. If that does not help try searching Stack Overflow for existing questions on WIX directories. If after this you can't find your answer, then ask a new question. Note: A comment is not the correct place for new questions.
Yes excuse me, i'm currently reading the documentation and stack overflow questions. Thanks for all.

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.