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

Unable to build when reference multi-targeting project #5705

Open
iskiselev opened this Issue Oct 17, 2017 · 5 comments

Comments

Projects
None yet
7 participants
@iskiselev

iskiselev commented Oct 17, 2017

Bug

  • Which version of WiX are you building with?
    v3.11.0.1528, v4.0.0.5512
  • Which version of Visual Studio are you building with (if any)?
    VS 2017 Update 4 (15.4.0)
  • Which version of the WiX Toolset Visual Studio Extension are you building with (if any)?
    0.9.21.62588
  • Which version of .NET are you building with?
    multi-targeting (net20/net40)
  • Describe the problem and the steps to reproduce it.
    Reference from WIX any multi-targeting SDK-based project (see example bellow). Try to build WIX. There will be an error ConsoleApp1.csproj(0,0): error MSB4057: The target "GetTargetPath" does not exist in the project.

Project example:
ConsoleApp1.csproj:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFrameworks>net20;net40</TargetFrameworks>
    <EnableDefaultNoneItems>false</EnableDefaultNoneItems>
    <ProduceReferenceAssembly>true</ProduceReferenceAssembly>
    <Deterministic>true</Deterministic>
  </PropertyGroup>
</Project>

Program.cs:

using System;

namespace ConsoleApp1
{
    public class Program
    {
        public static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
        }
    }
}

I've found a workaround: add to the end of project file something like:

  <Target Name="GetTargetPath" Returns="@(_FakeOutputPath)">
    <ItemGroup>
      <_FakeOutputPath Include="$(MSBuildProjectDirectory)\$(PackageOutputPath)\$(AssemblyName).UNK" />
    </ItemGroup>
  </Target>
@roozbehid-ic

This comment has been minimized.

Show comment
Hide comment
@roozbehid-ic

roozbehid-ic Oct 23, 2017

I hit the same issue. with following project file

<PropertyGroup>
<TargetFrameworks>net461</TargetFrameworks>
<ApplicationIcon />
<OutputType>Library</OutputType>
<StartupObject />
<Platforms>x64</Platforms>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Version>1.0.27</Version>

That workaround work though. thanks

roozbehid-ic commented Oct 23, 2017

I hit the same issue. with following project file

<PropertyGroup>
<TargetFrameworks>net461</TargetFrameworks>
<ApplicationIcon />
<OutputType>Library</OutputType>
<StartupObject />
<Platforms>x64</Platforms>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Version>1.0.27</Version>

That workaround work though. thanks

@barnson barnson added the msbuild label Oct 26, 2017

@barnson barnson added this to the v4.0 milestone Oct 26, 2017

@Danielku15

This comment has been minimized.

Show comment
Hide comment
@Danielku15

Danielku15 Nov 28, 2017

It appears that in the new csproj format the "AfterCompile" target does not exist anymore. I saw this issue entered on msbuild side: Microsoft/msbuild#2746 Anyhow I think it is a missing feature on https://github.com/dotnet/project-system side.

Danielku15 commented Nov 28, 2017

It appears that in the new csproj format the "AfterCompile" target does not exist anymore. I saw this issue entered on msbuild side: Microsoft/msbuild#2746 Anyhow I think it is a missing feature on https://github.com/dotnet/project-system side.

@sanderobdeijn

This comment has been minimized.

Show comment
Hide comment
@sanderobdeijn

sanderobdeijn Jul 20, 2018

What should the .UNK part do in the workaround? When I add it I get the following error.
The system cannot find the file '[filepath][filename].UNK' the .UNK part should be translated to .DLL or .EXE does this workaround work with other people?

sanderobdeijn commented Jul 20, 2018

What should the .UNK part do in the workaround? When I add it I get the following error.
The system cannot find the file '[filepath][filename].UNK' the .UNK part should be translated to .DLL or .EXE does this workaround work with other people?

@BMurri

This comment has been minimized.

Show comment
Hide comment
@BMurri

BMurri Jul 20, 2018

Collaborator
Collaborator

BMurri commented Jul 20, 2018

@sanderobdeijn

This comment has been minimized.

Show comment
Hide comment
@sanderobdeijn

sanderobdeijn Jul 23, 2018

the OutputType will be libary not dll.
I changed it to $(TargetExt) but it seems that that variable is empty

sanderobdeijn commented Jul 23, 2018

the OutputType will be libary not dll.
I changed it to $(TargetExt) but it seems that that variable is empty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment