diff --git a/src/AvaloniaProjectInfoResolver.PreviewTask/AvaloniaProjectInfoResolver.PreviewInner.targets b/src/AvaloniaProjectInfoResolver.PreviewTask/AvaloniaProjectInfoResolver.PreviewInner.targets
index e0c3caf..8d990a5 100644
--- a/src/AvaloniaProjectInfoResolver.PreviewTask/AvaloniaProjectInfoResolver.PreviewInner.targets
+++ b/src/AvaloniaProjectInfoResolver.PreviewTask/AvaloniaProjectInfoResolver.PreviewInner.targets
@@ -3,6 +3,7 @@
+
diff --git a/src/AvaloniaProjectInfoResolver.PreviewTask/PreviewInfoResolverTask.cs b/src/AvaloniaProjectInfoResolver.PreviewTask/PreviewInfoResolverTask.cs
index 426e890..eeaeaa2 100644
--- a/src/AvaloniaProjectInfoResolver.PreviewTask/PreviewInfoResolverTask.cs
+++ b/src/AvaloniaProjectInfoResolver.PreviewTask/PreviewInfoResolverTask.cs
@@ -18,6 +18,7 @@ public class PreviewInfoResolverTask : ContextAwareTask
// ReSharper disable InconsistentNaming
private const string SelectInfoProjectReference = nameof(SelectInfoProjectReference);
private const string SelectInfoProjectPath = nameof(SelectInfoProjectPath);
+ private const string SelectInfoOutputType = nameof(SelectInfoOutputType);
private const string SelectInfoAvaloniaResource = nameof(SelectInfoAvaloniaResource);
private const string SelectInfoAvaloniaXaml = nameof(SelectInfoAvaloniaXaml);
private const string SelectInfoAvaloniaPreviewerNetCoreToolPath =
@@ -53,6 +54,8 @@ public class PreviewInfoResolverTask : ContextAwareTask
private static readonly string[] TargetGetProjectReference = {SelectInfoProjectReference};
+ private static readonly string[] TargetGetOutput = {SelectInfoOutputType};
+
private static readonly string[] TargetGetTfms = {SelectInfoTargetFrameworks};
private readonly Dictionary _globalPropertiesCommon;
@@ -90,6 +93,12 @@ public PreviewInfoResolverTask()
protected override bool ExecuteInner()
{
+ if (!TryResolvePreviewInfoOutputType(ProjectFile, out var outputType))
+ return false;
+
+ if (outputType == "Library")
+ return false;
+
if (!TryResolvePreviewInfoTfms(ProjectFile, out var targetFrameworks))
return false;
@@ -109,6 +118,20 @@ protected override bool ExecuteInner()
return true;
}
+ private bool TryResolvePreviewInfoOutputType(string projectFile, out string outputType)
+ {
+ var targetOutputs = new Dictionary();
+
+ if (BuildEngine.BuildProjectFile(projectFile, TargetGetOutput, _globalPropertiesCommon, targetOutputs))
+ {
+ outputType = targetOutputs.ResultFromSingle(SelectInfoOutputType);
+ return true;
+ }
+
+ outputType = default!;
+ return false;
+ }
+
private bool TryResolvePreviewInfoTfms(string projectFile, out string[] targetFrameworks)
{
var targetOutputs = new Dictionary();