You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is one of the causes of the repeated "Previewer is not available. Build the project first." prompt.
Many of the MSBuild properties evaluated and required by this extension are dependent on the singular TargetFramework property being defined and valid. Properties such as TargetPath and AvaloniaPreviewerNetCoreToolPath.
However, this property and the plural TargetFrameworks are mutually exclusive. Defining both in the same project silently breaks things.
Note: Given <TargetFrameworks>net6.0;net7.0</TargetFrameworks> and dotnet build multiTargeting.csproj, dotnet will build binaries for each target framework i.e. obj/Debug/net6.0, obj/Debug/net7.0, bin/Debug/net6.0, bin/Debug/net7.0.
To Reproduce
dotnet new avalonia.app -n test -av 11.0.6
tfm="<TargetFramework>net8.0<\/TargetFramework>"
tfms="<TargetFrameworks>net6.0;net8.0<\/TargetFrameworks>"
sed -i -e "s/$tfm/$tfms/g" ./test/test.csproj
# Now, you can try generating preview assets
Instead of parsing the project file (which may have its TargetFrameworks property defined in a separate file e.g. targetframeworks.props), I'd recommend
A. Use dotnet-build/MSBuild to evaluate the TargetFrameworks property... dotnet build -getProperty:TargetFrameworks
net6.0;net7.0;net8.0
B. Deserialize/stringify the contents of obj/project.assets.json, access targets or project.frameworks, and parse the names of either one's properties for the target frameworks recently evaluated by dotnet-build/MSBuild. There's a high chance at least assets for at least one of those targets has been built in obj.
Describe the bug
This is one of the causes of the repeated "Previewer is not available. Build the project first." prompt.
Many of the MSBuild properties evaluated and required by this extension are dependent on the singular
TargetFramework
property being defined and valid. Properties such asTargetPath
and AvaloniaPreviewerNetCoreToolPath.However, this property and the plural
TargetFrameworks
are mutually exclusive. Defining both in the same project silently breaks things.Note: Given
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
anddotnet build multiTargeting.csproj
, dotnet will build binaries for each target framework i.e.obj/Debug/net6.0
,obj/Debug/net7.0
,bin/Debug/net6.0
,bin/Debug/net7.0
.To Reproduce
Avalonia for VS Code
v0.0.29
Avalonia version
11.0.6
VS Code version
v1.86.0
Relevant log output
Additional context
No response
The text was updated successfully, but these errors were encountered: