summaryrefslogtreecommitdiff
path: root/src/WixToolset.Mba.Core/WixToolset.Mba.Core.csproj
blob: 2bd7ca8065554e19cd89f36af130a7d10b894d0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFrameworks>netstandard2.0;net20</TargetFrameworks>
    <AssemblyName>WixToolset.Mba.Core</AssemblyName>
    <RootNamespace>WixToolset.Mba.Core</RootNamespace>
    <DebugType>embedded</DebugType>
    <Description>Managed Bootstrapper Application Core</Description>
    <NuspecFile>$(MSBuildThisFileName).nuspec</NuspecFile>
    <IncludeSymbols>true</IncludeSymbols>
    <CreateDocumentationFile>true</CreateDocumentationFile>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
    <PackageReference Include="Nerdbank.GitVersioning" Version="3.3.37" PrivateAssets="All" />
  </ItemGroup>

  <PropertyGroup>
    <NuspecBasePath>$(OutputPath)</NuspecBasePath>
    <NativeFileListPath Condition=" '$(NCrunch)'=='' ">$(MSBuildProjectDir)..\..\build\obj\$(ProjectName)\$(Configuration)\NativeFileList.txt</NativeFileListPath>
    <NativeFileListPath Condition=" '$(NCrunch)'=='1' ">$(NCrunchOriginalProjectDir)..\..\build\obj\$(ProjectName)\$(Configuration)\NativeFileList.txt</NativeFileListPath>
  </PropertyGroup>

  <Target Name="BuildMbaNative" BeforeTargets="GetCopyToOutputDirectoryItems" Condition=" '$(NCrunch)'=='' ">
    <MSBuild Projects="..\mbanative\mbanative.vcxproj" Properties="Platform=Win32" Targets="Build;BuiltProjectOutputGroup;ContentFilesProjectOutputGroup;DebugSymbolsProjectOutputGroup">
      <Output TaskParameter="TargetOutputs" ItemName="_NativeProjectOutput" />
    </MSBuild>

    <WriteLinesToFile File="$(NativeFileListPath)" Lines="@(_NativeProjectOutput)" Overwrite="true" />

    <ItemGroup>
      <FileWrites Include="$(NativeFileListPath)" />

      <AllItemsFullPathWithTargetPath Include="@(_NativeProjectOutput->'%(FullPath)')">
        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        <TargetPath>%(Filename)%(Extension)</TargetPath>
      </AllItemsFullPathWithTargetPath>
    </ItemGroup>
  </Target>

  <Target Name="NCrunchCopyNative" AfterTargets="AfterBuild" Condition=" '$(NCrunch)'=='1' ">
    <ReadLinesFromFile File="$(NativeFileListPath)">
      <Output TaskParameter="Lines" ItemName="_NCrunchNativeProjectOutput" />
    </ReadLinesFromFile>

    <Error Text="You must build $(MSBuildProjectName) to create the referenced native projects. Once built, 'Reload and rebuild' the project in the NCrunch Tests. The $(NativeFileListPath) file must not be empty." Condition=" '@(_NCrunchNativeProjectOutput)'=='' " />

    <Copy SourceFiles="@(_NCrunchNativeProjectOutput)" DestinationFolder="$(OutputPath)" SkipUnchangedFiles="true">
      <Output TaskParameter="CopiedFiles" ItemName="_NCrunchNativeCopied" />
    </Copy>

    <ItemGroup>
      <FileWrites Include="@(_NCrunchNativeCopied)" />
    </ItemGroup>
  </Target>
</Project>