Skip to content

Commit e10f2d2

Browse files
committed
Fix test
1 parent 44fd86a commit e10f2d2

File tree

6 files changed

+54
-5
lines changed

6 files changed

+54
-5
lines changed

.github/workflows/dotnet_tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ jobs:
3636
run: dotnet restore
3737

3838
- name: Build main library
39-
working-directory: src/AvaloniaProjectInfoResolver
39+
working-directory: ./src/AvaloniaProjectInfoResolver
4040
run: dotnet build -c ${{ env.configuration }}
4141

4242
- name: Build tests
43-
working-directory: src/AvaloniaProjectInfoResolver.IntegrationTests
43+
working-directory: ./src/AvaloniaProjectInfoResolver.IntegrationTests
4444
run: dotnet build -c ${{ env.configuration }} -f ${{ matrix.sdk.framework }}
4545

4646
- name: Run tests
47-
working-directory: src/AvaloniaProjectInfoResolver.IntegrationTests
47+
working-directory: ./src/AvaloniaProjectInfoResolver.IntegrationTests
4848
run: dotnet test -c ${{ env.configuration }} -f ${{ matrix.sdk.framework }} --no-build

src/AvaloniaProjectInfoResolver.IntegrationTests/AvaloniaProjectInfoResolver.IntegrationTests.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,9 @@
2121
<ProjectReference Include="..\AvaloniaProjectInfoResolver\AvaloniaProjectInfoResolver.csproj" />
2222
</ItemGroup>
2323

24+
<ItemGroup>
25+
<Content Include="data\ConsoleApp1\ConsoleApp1.fsproj" CopyToOutputDirectory="PreserveNewest" />
26+
<Content Include="data\ConsoleApp1\Program.fs" CopyToOutputDirectory="PreserveNewest" />
27+
</ItemGroup>
28+
2429
</Project>

src/AvaloniaProjectInfoResolver.IntegrationTests/ProjectInfoResolverTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.IO;
12
using System.Threading;
23
using System.Threading.Tasks;
34
using Xunit;
@@ -52,7 +53,8 @@ public async Task Should_ResolvePreviewProjectInfoAsync_App_References_Avalonia_
5253
public async Task Should_ResolvePreviewProjectInfoAsync_TaskDebug_Not_References_Avalonia()
5354
{
5455
var projectInfoResolver = new ProjectInfoResolver();
55-
var projPath = "../../../../../AvaloniaProjectInfoResolver/AvaloniaProjectInfoResolver.csproj";
56+
var projPath = "./data/ConsoleApp1/ConsoleApp1.fsproj";
57+
projPath = new FileInfo(projPath).FullName;
5658

5759
var result = await projectInfoResolver.ResolvePreviewInfoAsync(projPath);
5860

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp3.1</TargetFramework>
6+
<LangVersion>latest</LangVersion>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<Compile Include="Program.fs" />
11+
</ItemGroup>
12+
13+
</Project>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Learn more about F# at http://docs.microsoft.com/dotnet/fsharp
2+
3+
open System
4+
5+
// Define a function to construct a message to print
6+
let from whom =
7+
sprintf "from %s" whom
8+
9+
[<EntryPoint>]
10+
let main argv =
11+
let message = from "F#" // Call the function
12+
printfn "Hello world %s" message
13+
0 // return an integer exit code

src/AvaloniaProjectInfoResolver.PreviewTask/PreviewInfoResolverTask.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,10 @@ protected override bool ExecuteInner()
9797
return false;
9898

9999
if (outputType == "Library")
100+
{
101+
LogProjectNotExe();
100102
return false;
103+
}
101104

102105
if (!TryResolvePreviewInfoTfms(ProjectFile, out var targetFrameworks))
103106
return false;
@@ -269,7 +272,7 @@ private static bool IsReferencesAvalonia(PreviewInfo previewInfo) =>
269272
private void LogProjectNotAvalonia() =>
270273
BuildEngine.LogErrorEvent(new BuildErrorEventArgs(
271274
"APIR",
272-
string.Empty,
275+
"001",
273276
ProjectFile,
274277
0,
275278
0,
@@ -279,6 +282,19 @@ private void LogProjectNotAvalonia() =>
279282
string.Empty,
280283
string.Empty));
281284

285+
private void LogProjectNotExe() =>
286+
BuildEngine.LogErrorEvent(new BuildErrorEventArgs(
287+
"APIR",
288+
"002",
289+
ProjectFile,
290+
0,
291+
0,
292+
0,
293+
0,
294+
"MSBuild project file does not Exe (WinExe) OutputType",
295+
string.Empty,
296+
string.Empty));
297+
282298
private Dictionary<string, string> GetGlobalProperties(string targetFramework) =>
283299
string.IsNullOrEmpty(targetFramework)
284300
? _globalPropertiesCommon

0 commit comments

Comments
 (0)