Skip to content

Commit

Permalink
start multi-targeting net48 and net8.0-windows
Browse files Browse the repository at this point in the history
  • Loading branch information
awakecoding committed Jan 9, 2024
1 parent 9cddc66 commit f9a0370
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 61 deletions.
20 changes: 3 additions & 17 deletions dotnet/AxInterop.MSTSCLib/AxInterop.MSTSCLib.csproj
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\common.build.pre.props" />

<PropertyGroup>
<AssemblyName>AxInterop.MSTSCLib</AssemblyName>
<OutputType>Library</OutputType>
<Platforms>Win32;x64;ARM64</Platforms>
<PlatformTarget>AnyCPU</PlatformTarget>
<ProcessorArchitecture>MSIL</ProcessorArchitecture>
<TargetFramework>net48</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>disable</ImplicitUsings>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Nullable>disable</Nullable>
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
<OutputPath>$(CMakeOutputPath)</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<Optimize>False</Optimize>
<DebugType>Full</DebugType>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Release'">
<Optimize>True</Optimize>
<DebugType>None</DebugType>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions dotnet/AxInterop.MSTSCLib/RdpAxHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public IntPtr Module
public class AxHostEx : System.Windows.Forms.AxHost
{
public string axName = "mstsc";
public string rdpExDll = null;
public string rdpExDll = string.Empty;
private static object loadLock = new object();

public static string RdpGetAxDllPath(string axName)
Expand Down Expand Up @@ -147,7 +147,7 @@ public static string RdpGetAxDllPath(string axName)

public static object RdpGetClassObject(Guid clsid, string axName, string rdpExDll)
{
object obj = null;
object? obj = null;

lock (loadLock)
{
Expand Down
2 changes: 1 addition & 1 deletion dotnet/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
include_external_msproject(AxInterop.MSTSCLib
"${CMAKE_CURRENT_SOURCE_DIR}/AxInterop.MSTSCLib/AxInterop.MSTSCLib.csproj")

include_external_msproject(Devolutions.MsRdpEx
include_external_msproject(Devolutions.MsRdpEx
"${CMAKE_CURRENT_SOURCE_DIR}/Devolutions.MsRdpEx/Devolutions.MsRdpEx.csproj")

include_external_msproject(MsRdpEx_App
Expand Down
6 changes: 3 additions & 3 deletions dotnet/Devolutions.MsRdpEx/Bindings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,22 +153,22 @@ public static class Bindings

public static IMsRdpExCoreApi GetCoreApi()
{
object instance = null;
object? instance = null;
MsRdpEx_CreateInstance(ref IID_IMsRdpExCoreApi, out instance);
return (IMsRdpExCoreApi)instance;
}

public static IMsRdpExProcess CreateProcess()
{
object instance = null;
object? instance = null;
MsRdpEx_CreateInstance(ref IID_IMsRdpExProcess, out instance);
IMsRdpExProcess process = (IMsRdpExProcess)instance;
return process;
}

public static IMsRdpExProcess StartProcess(string[] args, string appName, string axName)
{
object instance = null;
object? instance = null;
MsRdpEx_CreateInstance(ref IID_IMsRdpExProcess, out instance);

IMsRdpExProcess process = (IMsRdpExProcess) instance;
Expand Down
46 changes: 22 additions & 24 deletions dotnet/Devolutions.MsRdpEx/Devolutions.MsRdpEx.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\common.build.pre.props" />

<PropertyGroup>
<AssemblyName>Devolutions.MsRdpEx</AssemblyName>
Expand All @@ -8,29 +9,11 @@
<Company>Devolutions</Company>
<Description>Microsoft RDP Extensions</Description>
<OutputType>Library</OutputType>
<Platforms>Win32;x64;ARM64</Platforms>
<PlatformTarget>AnyCPU</PlatformTarget>
<ProcessorArchitecture>MSIL</ProcessorArchitecture>
<TargetFramework>netstandard2.0</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>disable</ImplicitUsings>
<LangVersion>8</LangVersion>
<Nullable>enable</Nullable>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<UseWindowsForms>True</UseWindowsForms>
<OutputPath>$(CMakeOutputPath)</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<Optimize>False</Optimize>
<DebugType>Full</DebugType>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Release'">
<Optimize>True</Optimize>
<DebugType>None</DebugType>
<Nullable>enable</Nullable>
<GenerateAssemblyInfo>True</GenerateAssemblyInfo>
<SuppressDependenciesWhenPacking>False</SuppressDependenciesWhenPacking>
</PropertyGroup>

<ItemGroup>
Expand All @@ -46,9 +29,24 @@
<ProjectReference Include="../AxInterop.MSTSCLib/AxInterop.MSTSCLib.csproj" />
</ItemGroup>

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Copy SourceFiles="$(CMakeOutputPath)/MsRdpEx.dll" DestinationFolder="$(OutputPath)"
OverwriteReadOnlyFiles="true" Condition="Exists('$(CMakeOutputPath)/MsRdpEx.dll')" />
<Copy SourceFiles="$(CMakeOutputPath)/MsRdpEx.pdb" DestinationFolder="$(OutputPath)"
OverwriteReadOnlyFiles="true" Condition="Exists('$(CMakeOutputPath)/MsRdpEx.pdb')" />
</Target>

<ItemGroup>
<Content Include="$(OutputPath)/net48/Interop.MSTSCLib.dll" PackagePath="lib/net48/Interop.MSTSCLib.dll" Pack="true" />
<Content Include="$(OutputPath)/net48/AxInterop.MSTSCLib.dll" PackagePath="lib/net48/AxInterop.MSTSCLib.dll" Pack="true" />
</ItemGroup>

<ItemGroup>
<Content Include="$(OutputPath)/net8.0-windows/Interop.MSTSCLib.dll" PackagePath="lib/net8.0-windows7.0/Interop.MSTSCLib.dll" Pack="true" />
<Content Include="$(OutputPath)/net8.0-windows/AxInterop.MSTSCLib.dll" PackagePath="lib/net8.0-windows7.0/AxInterop.MSTSCLib.dll" Pack="true" />
</ItemGroup>

<ItemGroup>
<Content Include="$(OutputPath)/Interop.MSTSCLib.dll" PackagePath="lib/$(TargetFramework)/Interop.MSTSCLib.dll" Pack="true" />
<Content Include="$(OutputPath)/AxInterop.MSTSCLib.dll" PackagePath="lib/$(TargetFramework)/AxInterop.MSTSCLib.dll" Pack="true" />
<Content Include="../../dependencies/MsRdpEx/x86/MsRdpEx.dll" PackagePath="runtimes/win-x86/native/MsRdpEx.dll" Pack="true" />
<Content Include="../../dependencies/MsRdpEx/x64/MsRdpEx.dll" PackagePath="runtimes/win-x64/native/MsRdpEx.dll" Pack="true" />
<Content Include="../../dependencies/MsRdpEx/arm64/MsRdpEx.dll" PackagePath="runtimes/win-arm64/native/MsRdpEx.dll" Pack="true" />
Expand Down
2 changes: 1 addition & 1 deletion dotnet/Directory.Build.props.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<PropertyGroup>
<CMakeSourceDir>@CMAKE_SOURCE_DIR@</CMakeSourceDir>
<CMakeBinaryDir>@CMAKE_BINARY_DIR@</CMakeBinaryDir>
<CMakeOutputPath>$(CMakeBinaryDir)\$(Configuration)</CMakeOutputPath>
<CMakeOutputPath>$(CMakeBinaryDir)/$(Configuration)</CMakeOutputPath>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion dotnet/MsRdpEx_App/MainDlg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ private void btnConnect_Click(object sender, EventArgs e)
args.Add(this.rdpFileName);
}

string arguments = string.Join(' ', args.ToArray());
string arguments = string.Join(" ", args.ToArray());

ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = executableFileName;
Expand Down
16 changes: 4 additions & 12 deletions dotnet/MsRdpEx_App/MsRdpEx_App.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<Platforms>Win32;x64;ARM64</Platforms>
<TargetFramework>net6.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<TargetFrameworks>net48;net8.0-windows</TargetFrameworks>
<UseWindowsForms>True</UseWindowsForms>
<ImplicitUsings>disable</ImplicitUsings>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<GenerateAssemblyInfo>True</GenerateAssemblyInfo>
<OutputPath>$(CMakeOutputPath)</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendTargetFrameworkToOutputPath>True</AppendTargetFrameworkToOutputPath>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -19,14 +19,6 @@
<FileVersion>1.0.0.0</FileVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<Optimize>False</Optimize>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Release'">
<Optimize>True</Optimize>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="../Devolutions.MsRdpEx/Devolutions.MsRdpEx.csproj" IncludeAssets="all" />
</ItemGroup>
Expand Down
24 changes: 24 additions & 0 deletions dotnet/common.build.pre.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<TargetFrameworks>net48;net8.0-windows</TargetFrameworks>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<ImplicitUsings>disable</ImplicitUsings>
<LangVersion>11</LangVersion>
<Platforms>Win32;x64;ARM64</Platforms>
<PlatformTarget>AnyCPU</PlatformTarget>
<ProcessorArchitecture>MSIL</ProcessorArchitecture>
<AppendTargetFrameworkToOutputPath>True</AppendTargetFrameworkToOutputPath>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<Optimize>False</Optimize>
<DebugType>Full</DebugType>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Release'">
<Optimize>True</Optimize>
<DebugType>None</DebugType>
</PropertyGroup>
</Project>

0 comments on commit f9a0370

Please sign in to comment.