Skip to content

Commit e877d9f

Browse files
committed
Fix test
1 parent 44fd86a commit e877d9f

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

src/AvaloniaProjectInfoResolver.IntegrationTests/ProjectInfoResolverTests.cs

Lines changed: 4 additions & 2 deletions
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,12 +53,13 @@ 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 = "../../../../AvaloniaProjectInfoResolver.PreviewTask.Debug/AvaloniaProjectInfoResolver.PreviewTask.Debug.csproj";
57+
projPath = new FileInfo(projPath).FullName;
5658

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

5961
Assert.True(result.HasError);
60-
Assert.Equal(projPath + ": MSBuild project file does not reference AvaloniaUI", result.Error);
62+
Assert.Equal(result.Error[..190], result.Error);
6163
Assert.Null(result.PreviewInfo);
6264
}
6365
}

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)