Skip to content

Commit 21422e1

Browse files
authored
Fixes: dotnet restore fails on Linux/macOS for projects targeting Windows (#34)
Fixes #4
1 parent f7b2643 commit 21422e1

File tree

12 files changed

+132
-1
lines changed

12 files changed

+132
-1
lines changed

ScipDotnet.Tests/SnapshotTests.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,12 @@ private static string DiffStrings(string obtained, string expected)
130130
private static string[] ListSnapshotInputDirectories()
131131
{
132132
var inputs = Path.Join(RootDirectory(), "snapshots", "input");
133+
134+
#if NET7_0
135+
return Directory.GetDirectories(inputs).Where(x => !x.Contains("WpfApplication")).ToArray();
136+
#else
133137
return Directory.GetDirectories(inputs);
138+
#endif
134139
}
135140

136141
private static string IndexDirectory(string directory)

ScipDotnet/ScipProjectIndexer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public ScipProjectIndexer(ILogger<ScipProjectIndexer> logger) =>
2020

2121
private void Restore(IndexCommandOptions options, FileInfo project)
2222
{
23-
var arguments = project.Extension.Equals(".sln") ? $"restore {project.FullName}" : "restore";
23+
var arguments = project.Extension.Equals(".sln") ? $"restore {project.FullName} /p:EnableWindowsTargeting=true" : "restore /p:EnableWindowsTargeting=true";
2424
var process = new Process()
2525
{
2626
StartInfo = new ProcessStartInfo()
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.5.33627.172
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfApplication", "WpfApplication\WpfApplication.csproj", "{4C330E46-3054-4DCC-8125-EA43E3AFD3A6}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{4C330E46-3054-4DCC-8125-EA43E3AFD3A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{4C330E46-3054-4DCC-8125-EA43E3AFD3A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{4C330E46-3054-4DCC-8125-EA43E3AFD3A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{4C330E46-3054-4DCC-8125-EA43E3AFD3A6}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {A6448A53-F47B-486E-AE3C-4EDCEF811F35}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Application x:Class="WpfApplication.App"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:local="clr-namespace:WpfApplication"
5+
StartupUri="MainWindow.xaml">
6+
<Application.Resources>
7+
8+
</Application.Resources>
9+
</Application>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using System.Windows;
2+
3+
namespace WpfApplication
4+
{
5+
public partial class App : Application
6+
{
7+
}
8+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System.Windows;
2+
3+
[assembly: ThemeInfo(
4+
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5+
//(used if a resource is not found in the page,
6+
// or application resource dictionaries)
7+
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8+
//(used if a resource is not found in the page,
9+
// app, or any theme specific resource dictionaries)
10+
)]
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Window x:Class="WpfApplication.MainWindow"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
xmlns:local="clr-namespace:WpfApplication"
7+
mc:Ignorable="d"
8+
Title="MainWindow" Height="450" Width="800">
9+
<Grid>
10+
11+
</Grid>
12+
</Window>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System.Windows;
2+
3+
namespace WpfApplication
4+
{
5+
public partial class MainWindow : Window
6+
{
7+
public MainWindow()
8+
{
9+
InitializeComponent();
10+
}
11+
}
12+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>WinExe</OutputType>
5+
<TargetFramework>net7.0-windows</TargetFramework>
6+
<Nullable>enable</Nullable>
7+
<UseWPF>true</UseWPF>
8+
</PropertyGroup>
9+
10+
</Project>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System.Windows;
2+
3+
namespace WpfApplication
4+
// ^^^^^^^^^^^^^^ reference scip-dotnet nuget . . WpfApplication/
5+
{
6+
public partial class App : Application
7+
// ^^^ definition scip-dotnet nuget . . WpfApplication/App#
8+
// documentation ```cs\nclass App\n```
9+
// relationship implementation scip-dotnet nuget . . ``/Application#
10+
{
11+
}
12+
}

0 commit comments

Comments
 (0)