Skip to content

Commit

Permalink
added multitargeting (#64)
Browse files Browse the repository at this point in the history
* added multitargeting

* fixing .net 3.5

* simplified net45 imports

* migrated SaveFileDialog and OpenFileDialog demos
  • Loading branch information
virzak authored and FantasticFiasco committed Jan 17, 2019
1 parent bb4217d commit d9087bd
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 190 deletions.
76 changes: 17 additions & 59 deletions samples/net/Demo.OpenFileDialog/Demo.OpenFileDialog.csproj
Original file line number Diff line number Diff line change
@@ -1,59 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<LanguageTargets>$(MSBuildExtensionsPath)\$(VisualStudioVersion)\Bin\Microsoft.CSharp.targets</LanguageTargets>
<OutputType>winexe</OutputType>
<TargetFramework>net45</TargetFramework>
<ApplicationIcon />
<OutputTypeEx>winexe</OutputTypeEx>
<StartupObject />
</PropertyGroup>

<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx" Generator="ResXFileCodeGenerator" LastGenOutput="Resources.Designer.cs" />
<Compile Update="Properties\Resources.Designer.cs" DesignTime="True" AutoGen="True" DependentUpon="Resources.resx" />
<Compile Update="Settings.Designer.cs" AutoGen="True" DependentUpon="Settings.settings" />
<None Update="Settings.settings" LastGenOutput="Settings.Designer.cs" Generator="SettingsSingleFileGenerator" />

<Page Include="**\*.xaml" SubType="Designer" Generator="MSBuild:Compile" Exclude="App.xaml" />
<Compile Update="**\*.xaml.cs" SubType="Designer" DependentUpon="%(Filename)" />

<Resource Include="assets\*.*" />

<ApplicationDefinition Include="App.xaml">
<Generator>MsBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
</ItemGroup>

<ItemGroup>
<None Include="OpenMe.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\src\net\MvvmDialogs.csproj" />
</ItemGroup>

<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="MvvmLight" Version="5.4.1.1" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFrameworks>netcoreapp3.0;net45</TargetFrameworks>
<UseWPF>true</UseWPF>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MvvmLightLibsStd10" Version="5.4.1.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\src\net\MvvmDialogs.csproj" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion samples/net/Demo.OpenFileDialog/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<TextBox
AutomationProperties.AutomationId="cqkeItgI3UaZc-mQ6mYPAA"
IsReadOnly="True"
Text="{Binding Path}" />
Text="{Binding Path, Mode=OneWay}" />
<Button
Grid.Column="1"
AutomationProperties.AutomationId="MZ16xHTzYE2UP8S9vd-EGw"
Expand Down
2 changes: 1 addition & 1 deletion samples/net/Demo.OpenFileDialog/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Reflection;
using System.Windows.Input;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.CommandWpf;
using GalaSoft.MvvmLight.Command;
using MvvmDialogs;
using MvvmDialogs.FrameworkDialogs.OpenFile;
using IOPath = System.IO.Path;
Expand Down
5 changes: 1 addition & 4 deletions samples/net/Demo.OpenFileDialog/ViewModelLocator.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using CommonServiceLocator;
using GalaSoft.MvvmLight.Ioc;

namespace Demo.OpenFileDialog
Expand All @@ -11,11 +10,9 @@ public class ViewModelLocator
{
public ViewModelLocator()
{
ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);

SimpleIoc.Default.Register<MainWindowViewModel>();
}

public MainWindowViewModel MainWindow => ServiceLocator.Current.GetInstance<MainWindowViewModel>();
public MainWindowViewModel MainWindow => SimpleIoc.Default.GetInstance<MainWindowViewModel>();
}
}
70 changes: 17 additions & 53 deletions samples/net/Demo.SaveFileDialog/Demo.SaveFileDialog.csproj
Original file line number Diff line number Diff line change
@@ -1,53 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<LanguageTargets>$(MSBuildExtensionsPath)\$(VisualStudioVersion)\Bin\Microsoft.CSharp.targets</LanguageTargets>
<OutputType>winexe</OutputType>
<TargetFramework>net45</TargetFramework>
<ApplicationIcon />
<OutputTypeEx>winexe</OutputTypeEx>
<StartupObject />
</PropertyGroup>

<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx" Generator="ResXFileCodeGenerator" LastGenOutput="Resources.Designer.cs" />
<Compile Update="Properties\Resources.Designer.cs" DesignTime="True" AutoGen="True" DependentUpon="Resources.resx" />
<Compile Update="Settings.Designer.cs" AutoGen="True" DependentUpon="Settings.settings" />
<None Update="Settings.settings" LastGenOutput="Settings.Designer.cs" Generator="SettingsSingleFileGenerator" />

<Page Include="**\*.xaml" SubType="Designer" Generator="MSBuild:Compile" Exclude="App.xaml" />
<Compile Update="**\*.xaml.cs" SubType="Designer" DependentUpon="%(Filename)" />

<Resource Include="assets\*.*" />

<ApplicationDefinition Include="App.xaml">
<Generator>MsBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\src\net\MvvmDialogs.csproj" />
</ItemGroup>

<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="MvvmLight" Version="5.4.1.1" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFrameworks>netcoreapp3.0;net45</TargetFrameworks>
<UseWPF>true</UseWPF>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MvvmLightLibsStd10" Version="5.4.1.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\src\net\MvvmDialogs.csproj" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion samples/net/Demo.SaveFileDialog/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<TextBox
AutomationProperties.AutomationId="-u3vcUdRMUaG4Af_kzSeZQ"
IsReadOnly="True"
Text="{Binding Path}" />
Text="{Binding Path, Mode=OneWay}" />
<Button
Grid.Column="1"
AutomationProperties.AutomationId="HstqC8HI9EOGiTfPA4_xag"
Expand Down
4 changes: 2 additions & 2 deletions samples/net/Demo.SaveFileDialog/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Reflection;
using System.Windows.Input;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.CommandWpf;
using GalaSoft.MvvmLight.Command;
using MvvmDialogs;
using MvvmDialogs.FrameworkDialogs.SaveFile;
using IOPath = System.IO.Path;
Expand Down Expand Up @@ -46,4 +46,4 @@ private void SaveFile()
}
}
}
}
}
5 changes: 1 addition & 4 deletions samples/net/Demo.SaveFileDialog/ViewModelLocator.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using CommonServiceLocator;
using GalaSoft.MvvmLight.Ioc;

namespace Demo.SaveFileDialog
Expand All @@ -11,11 +10,9 @@ public class ViewModelLocator
{
public ViewModelLocator()
{
ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);

SimpleIoc.Default.Register<MainWindowViewModel>();
}

public MainWindowViewModel MainWindow => ServiceLocator.Current.GetInstance<MainWindowViewModel>();
public MainWindowViewModel MainWindow => SimpleIoc.Default.GetInstance<MainWindowViewModel>();
}
}
129 changes: 64 additions & 65 deletions src/net/MvvmDialogs.csproj
Original file line number Diff line number Diff line change
@@ -1,66 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<AssemblyTitle>MVVM Dialogs</AssemblyTitle>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
<RunCodeAnalysis>true</RunCodeAnalysis>
<CodeAnalysisRuleSet>..\..\MvvmDialogs.ruleset</CodeAnalysisRuleSet>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\StrongName.snk</AssemblyOriginatorKeyFile>
<UseWPF>true</UseWPF>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DefineConstants Condition="'$(TargetFramework)' == 'net45'">DEBUG;TRACE</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'net40'">DEBUG;TRACE;PRE_NET45</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'net35'">DEBUG;TRACE;PRE_NET40;PRE_NET45</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<DefineConstants Condition="'$(TargetFramework)' == 'net45'">TRACE</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'net40'">TRACE;PRE_NET45</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'net35'">TRACE;PRE_NET40;PRE_NET45</DefineConstants>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net45'">
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net40'">
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net35'">
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>

<ItemGroup>
<CodeAnalysisDictionary Include="CustomDictionary.xml" />
</ItemGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>net35;net40;net45;netcoreapp3.0</TargetFrameworks>
<AssemblyTitle>MVVM Dialogs</AssemblyTitle>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
<CodeAnalysisRuleSet>..\..\MvvmDialogs.ruleset</CodeAnalysisRuleSet>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\StrongName.snk</AssemblyOriginatorKeyFile>
<UseWPF>true</UseWPF>
</PropertyGroup>

<!-- The following section can be removed penging the bug: https://github.com/dotnet/wpf/issues/255 -->
<PropertyGroup>
<DisableImplicitFrameworkReferences Condition="'$(TargetFramework)' == 'net40' or '$(TargetFramework)' == 'net35'">true</DisableImplicitFrameworkReferences>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DefineConstants Condition="'$(TargetFramework)' == 'net45'">DEBUG;TRACE</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'net40'">DEBUG;TRACE;PRE_NET45</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'net35'">DEBUG;TRACE;PRE_NET40;PRE_NET45</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<DefineConstants Condition="'$(TargetFramework)' == 'net45'">TRACE</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'net40'">TRACE;PRE_NET45</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'net35'">TRACE;PRE_NET40;PRE_NET45</DefineConstants>
</PropertyGroup>

<PropertyGroup>
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net35'">$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client</FrameworkPathOverride>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net45'">
<Reference Include="System.Windows.Forms" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net40'">
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net35'">
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>

<ItemGroup>
<CodeAnalysisDictionary Include="CustomDictionary.xml" />
</ItemGroup>
</Project>

0 comments on commit d9087bd

Please sign in to comment.