Skip to content

Commit ab6fcc5

Browse files
committed
Initial Commit
0 parents  commit ab6fcc5

17 files changed

Lines changed: 1941 additions & 0 deletions

.gitignore

Lines changed: 560 additions & 0 deletions
Large diffs are not rendered by default.

CSExeCOMServer.sln

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.31321.278
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSExeCOMServer", "CSExeCOMServer\CSExeCOMServer.csproj", "{7B4FB722-905A-4851-8399-1E0F3361CCD8}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|x64 = Debug|x64
11+
Debug|x86 = Debug|x86
12+
Release|x64 = Release|x64
13+
Release|x86 = Release|x86
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{7B4FB722-905A-4851-8399-1E0F3361CCD8}.Debug|x64.ActiveCfg = Debug|x64
17+
{7B4FB722-905A-4851-8399-1E0F3361CCD8}.Debug|x64.Build.0 = Debug|x64
18+
{7B4FB722-905A-4851-8399-1E0F3361CCD8}.Debug|x86.ActiveCfg = Debug|x86
19+
{7B4FB722-905A-4851-8399-1E0F3361CCD8}.Debug|x86.Build.0 = Debug|x86
20+
{7B4FB722-905A-4851-8399-1E0F3361CCD8}.Release|x64.ActiveCfg = Release|x64
21+
{7B4FB722-905A-4851-8399-1E0F3361CCD8}.Release|x64.Build.0 = Release|x64
22+
{7B4FB722-905A-4851-8399-1E0F3361CCD8}.Release|x86.ActiveCfg = Release|x86
23+
{7B4FB722-905A-4851-8399-1E0F3361CCD8}.Release|x86.Build.0 = Release|x86
24+
EndGlobalSection
25+
GlobalSection(SolutionProperties) = preSolution
26+
HideSolutionNode = FALSE
27+
EndGlobalSection
28+
GlobalSection(ExtensibilityGlobals) = postSolution
29+
SolutionGuid = {B874538F-C563-496E-9ACE-48AD62843E8D}
30+
EndGlobalSection
31+
EndGlobal

CSExeCOMServer/CSExeCOMClient.ps1

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
$obj = New-Object -ComObject 'CSExeCOMServer.SimpleObject'
2+
3+
Write-Output 'A CSExeCOMServer.SimpleObject object is created'
4+
5+
# call the HelloWorld method that returns a string
6+
Write-Output "The HelloWorld method returns $($obj.HelloWorld())"
7+
8+
# Set the FloatProperty property
9+
Write-Output 'Set the FloatProperty property to 1.2'
10+
$obj.FloatProperty = [float]1.2
11+
12+
# Get the FloatProperty property
13+
Write-Output "The FloatProperty property returns $($obj.FloatProperty())"
14+
15+
# Get Process Id
16+
$processId = 0
17+
$threadId = 0
18+
$obj.GetProcessThreadId([ref] $processId, [ref] $threadId)
19+
Write-Output "Out-of-process COM Server - Process ID: #$processId, Thread ID: #$threadId"
20+
21+
$obj = $null
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="Current" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProductVersion>9.0.30729</ProductVersion>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>{7B4FB722-905A-4851-8399-1E0F3361CCD8}</ProjectGuid>
9+
<OutputType>Exe</OutputType>
10+
<AppDesignerFolder>Properties</AppDesignerFolder>
11+
<RootNamespace>CSExeCOMServer</RootNamespace>
12+
<AssemblyName>CSExeCOMServer</AssemblyName>
13+
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
14+
<FileAlignment>512</FileAlignment>
15+
<StartupObject>CSExeCOMServer.Program</StartupObject>
16+
<SignAssembly>false</SignAssembly>
17+
<AssemblyOriginatorKeyFile>
18+
</AssemblyOriginatorKeyFile>
19+
<FileUpgradeFlags>
20+
</FileUpgradeFlags>
21+
<UpgradeBackupLocation>
22+
</UpgradeBackupLocation>
23+
<OldToolsVersion>3.5</OldToolsVersion>
24+
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
27+
<DebugSymbols>true</DebugSymbols>
28+
<DebugType>full</DebugType>
29+
<Optimize>false</Optimize>
30+
<OutputPath>Debug\</OutputPath>
31+
<DefineConstants>DEBUG;TRACE</DefineConstants>
32+
<ErrorReport>prompt</ErrorReport>
33+
<WarningLevel>4</WarningLevel>
34+
<PlatformTarget>AnyCPU</PlatformTarget>
35+
</PropertyGroup>
36+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
37+
<DebugType>pdbonly</DebugType>
38+
<Optimize>true</Optimize>
39+
<OutputPath>Release\</OutputPath>
40+
<DefineConstants>TRACE</DefineConstants>
41+
<ErrorReport>prompt</ErrorReport>
42+
<WarningLevel>4</WarningLevel>
43+
<PlatformTarget>AnyCPU</PlatformTarget>
44+
</PropertyGroup>
45+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
46+
<DebugSymbols>true</DebugSymbols>
47+
<OutputPath>bin\x64\Debug\</OutputPath>
48+
<DefineConstants>DEBUG;TRACE</DefineConstants>
49+
<DebugType>full</DebugType>
50+
<PlatformTarget>x64</PlatformTarget>
51+
<LangVersion>7.3</LangVersion>
52+
<ErrorReport>prompt</ErrorReport>
53+
</PropertyGroup>
54+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
55+
<OutputPath>bin\x64\Release\</OutputPath>
56+
<DefineConstants>TRACE</DefineConstants>
57+
<Optimize>true</Optimize>
58+
<DebugType>pdbonly</DebugType>
59+
<PlatformTarget>x64</PlatformTarget>
60+
<LangVersion>7.3</LangVersion>
61+
<ErrorReport>prompt</ErrorReport>
62+
</PropertyGroup>
63+
<PropertyGroup>
64+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
65+
</PropertyGroup>
66+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
67+
<DebugSymbols>true</DebugSymbols>
68+
<OutputPath>bin\x86\Debug\</OutputPath>
69+
<DefineConstants>DEBUG;TRACE</DefineConstants>
70+
<DebugType>full</DebugType>
71+
<PlatformTarget>x86</PlatformTarget>
72+
<LangVersion>7.3</LangVersion>
73+
<ErrorReport>prompt</ErrorReport>
74+
</PropertyGroup>
75+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
76+
<OutputPath>bin\x86\Release\</OutputPath>
77+
<DefineConstants>TRACE</DefineConstants>
78+
<Optimize>true</Optimize>
79+
<DebugType>pdbonly</DebugType>
80+
<PlatformTarget>x86</PlatformTarget>
81+
<LangVersion>7.3</LangVersion>
82+
<ErrorReport>prompt</ErrorReport>
83+
</PropertyGroup>
84+
<ItemGroup>
85+
<Reference Include="System" />
86+
</ItemGroup>
87+
<ItemGroup>
88+
<Compile Include="HelperMethods.cs" />
89+
<Compile Include="IClassFactory.cs" />
90+
<Compile Include="ISimpleObject.cs" />
91+
<Compile Include="ISimpleObjectEvents.cs" />
92+
<Compile Include="ReferenceCountedObject.cs" />
93+
<Compile Include="SimpleObject.cs" />
94+
<Compile Include="ExecutableComServer.cs" />
95+
<Compile Include="NativeMethods.cs" />
96+
<Compile Include="Program.cs" />
97+
<Compile Include="Properties\AssemblyInfo.cs" />
98+
<Compile Include="SimpleObjectClassFactory.cs" />
99+
</ItemGroup>
100+
<ItemGroup>
101+
<None Include="app.config" />
102+
<Content Include="CSExeCOMClient.ps1">
103+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
104+
</Content>
105+
</ItemGroup>
106+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
107+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
108+
Other similar extension points exist, see Microsoft.Common.targets.
109+
<Target Name="BeforeBuild">
110+
</Target>
111+
<Target Name="AfterBuild">
112+
</Target>
113+
-->
114+
<PropertyGroup>
115+
<PostBuildEvent>%25windir%25\system32\net.exe session &gt;nul 2&gt;&amp;1
116+
if not %25errorLevel%25 == 0 (
117+
echo Failure: Current permissions inadequate
118+
exit 1
119+
)
120+
if "$(PlatformName)"=="x64" (
121+
set regasm=%25windir%25\Microsoft.NET\Framework64\v4.0.30319\regasm.exe
122+
) else if "$(PlatformName)"=="x86" (
123+
set regasm=%25windir%25\Microsoft.NET\Framework\v4.0.30319\regasm.exe
124+
) else (
125+
echo Failure: Cannot determine platform
126+
exit 2
127+
)
128+
echo Generate and register type library.
129+
%25regasm%25 /tlb "$(TargetPath)"
130+
echo Register the component.
131+
%25regasm%25 "$(TargetPath)"</PostBuildEvent>
132+
</PropertyGroup>
133+
</Project>

0 commit comments

Comments
 (0)