Skip to content

Commit a008f34

Browse files
Merge pull request rabbitmq#51 from kspearrin/master
Ported .net examples to a visual studio solution
2 parents bcc1c16 + be8f5dd commit a008f34

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+2256
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This project contains code for [RabbitMQ tutorials](http://www.rabbitmq.com/gets
77
The following ports are available:
88

99
* [C#](./dotnet)
10+
* [C# (with Visual Studio)](./dotnet-visual-studio)
1011
* [Clojure](./clojure)
1112
* [Erlang](./erlang)
1213
* [Go](./go)

dotnet-visual-studio/.gitignore

+199
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
## Ignore Visual Studio temporary files, build results, and
2+
## files generated by popular Visual Studio add-ons.
3+
4+
# User-specific files
5+
*.suo
6+
*.user
7+
*.userosscache
8+
*.sln.docstates
9+
10+
# User-specific files (MonoDevelop/Xamarin Studio)
11+
*.userprefs
12+
13+
# Build results
14+
[Dd]ebug/
15+
[Dd]ebugPublic/
16+
[Rr]elease/
17+
[Rr]eleases/
18+
x64/
19+
x86/
20+
build/
21+
bld/
22+
[Bb]in/
23+
[Oo]bj/
24+
25+
# Visual Studo 2015 cache/options directory
26+
.vs/
27+
28+
# MSTest test Results
29+
[Tt]est[Rr]esult*/
30+
[Bb]uild[Ll]og.*
31+
32+
# NUNIT
33+
*.VisualState.xml
34+
TestResult.xml
35+
36+
# Build Results of an ATL Project
37+
[Dd]ebugPS/
38+
[Rr]eleasePS/
39+
dlldata.c
40+
41+
*_i.c
42+
*_p.c
43+
*_i.h
44+
*.ilk
45+
*.meta
46+
*.obj
47+
*.pch
48+
*.pdb
49+
*.pgc
50+
*.pgd
51+
*.rsp
52+
*.sbr
53+
*.tlb
54+
*.tli
55+
*.tlh
56+
*.tmp
57+
*.tmp_proj
58+
*.log
59+
*.vspscc
60+
*.vssscc
61+
.builds
62+
*.pidb
63+
*.svclog
64+
*.scc
65+
66+
# Chutzpah Test files
67+
_Chutzpah*
68+
69+
# Visual C++ cache files
70+
ipch/
71+
*.aps
72+
*.ncb
73+
*.opensdf
74+
*.sdf
75+
*.cachefile
76+
77+
# Visual Studio profiler
78+
*.psess
79+
*.vsp
80+
*.vspx
81+
82+
# TFS 2012 Local Workspace
83+
$tf/
84+
85+
# Guidance Automation Toolkit
86+
*.gpState
87+
88+
# ReSharper is a .NET coding add-in
89+
_ReSharper*/
90+
*.[Rr]e[Ss]harper
91+
*.DotSettings.user
92+
93+
# JustCode is a .NET coding addin-in
94+
.JustCode
95+
96+
# TeamCity is a build add-in
97+
_TeamCity*
98+
99+
# DotCover is a Code Coverage Tool
100+
*.dotCover
101+
102+
# NCrunch
103+
_NCrunch_*
104+
.*crunch*.local.xml
105+
106+
# MightyMoose
107+
*.mm.*
108+
AutoTest.Net/
109+
110+
# Web workbench (sass)
111+
.sass-cache/
112+
113+
# Installshield output folder
114+
[Ee]xpress/
115+
116+
# DocProject is a documentation generator add-in
117+
DocProject/buildhelp/
118+
DocProject/Help/*.HxT
119+
DocProject/Help/*.HxC
120+
DocProject/Help/*.hhc
121+
DocProject/Help/*.hhk
122+
DocProject/Help/*.hhp
123+
DocProject/Help/Html2
124+
DocProject/Help/html
125+
126+
# Click-Once directory
127+
publish/
128+
129+
# Publish Web Output
130+
*.[Pp]ublish.xml
131+
*.azurePubxml
132+
# TODO: Comment the next line if you want to checkin your web deploy settings
133+
# but database connection strings (with potential passwords) will be unencrypted
134+
*.pubxml
135+
*.publishproj
136+
137+
# NuGet Packages
138+
*.nupkg
139+
# The packages folder can be ignored because of Package Restore
140+
**/packages/*
141+
# except build/, which is used as an MSBuild target.
142+
!**/packages/build/
143+
# Uncomment if necessary however generally it will be regenerated when needed
144+
#!**/packages/repositories.config
145+
146+
# Windows Azure Build Output
147+
csx/
148+
*.build.csdef
149+
150+
# Windows Store app package directory
151+
AppPackages/
152+
153+
# Others
154+
*.[Cc]ache
155+
ClientBin/
156+
[Ss]tyle[Cc]op.*
157+
~$*
158+
*~
159+
*.dbmdl
160+
*.dbproj.schemaview
161+
*.pfx
162+
*.publishsettings
163+
node_modules/
164+
bower_components/
165+
166+
# RIA/Silverlight projects
167+
Generated_Code/
168+
169+
# Backup & report files from converting an old project file
170+
# to a newer Visual Studio version. Backup files are not needed,
171+
# because we have git ;-)
172+
_UpgradeReport_Files/
173+
Backup*/
174+
UpgradeLog*.XML
175+
UpgradeLog*.htm
176+
177+
# SQL Server files
178+
*.mdf
179+
*.ldf
180+
181+
# Business Intelligence projects
182+
*.rdl.data
183+
*.bim.layout
184+
*.bim_*.settings
185+
186+
# Microsoft Fakes
187+
FakesAssemblies/
188+
189+
# Node.js Tools for Visual Studio
190+
.ntvs_analysis.dat
191+
192+
# Visual Studio 6 build log
193+
*.plg
194+
195+
# Visual Studio 6 workspace options file
196+
*.opt
197+
198+
# Nuget
199+
.nuget/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{DABA9504-8375-46DE-8349-A2DFCA9B1F2D}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>_1_Receive</RootNamespace>
11+
<AssemblyName>1_Receive</AssemblyName>
12+
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
15+
<PublishUrl>publish\</PublishUrl>
16+
<Install>true</Install>
17+
<InstallFrom>Disk</InstallFrom>
18+
<UpdateEnabled>false</UpdateEnabled>
19+
<UpdateMode>Foreground</UpdateMode>
20+
<UpdateInterval>7</UpdateInterval>
21+
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
22+
<UpdatePeriodically>false</UpdatePeriodically>
23+
<UpdateRequired>false</UpdateRequired>
24+
<MapFileExtensions>true</MapFileExtensions>
25+
<ApplicationRevision>0</ApplicationRevision>
26+
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
27+
<IsWebBootstrapper>false</IsWebBootstrapper>
28+
<UseApplicationTrust>false</UseApplicationTrust>
29+
<BootstrapperEnabled>true</BootstrapperEnabled>
30+
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
31+
<RestorePackages>true</RestorePackages>
32+
</PropertyGroup>
33+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
34+
<PlatformTarget>AnyCPU</PlatformTarget>
35+
<DebugSymbols>true</DebugSymbols>
36+
<DebugType>full</DebugType>
37+
<Optimize>false</Optimize>
38+
<OutputPath>bin\Debug\</OutputPath>
39+
<DefineConstants>DEBUG;TRACE</DefineConstants>
40+
<ErrorReport>prompt</ErrorReport>
41+
<WarningLevel>4</WarningLevel>
42+
</PropertyGroup>
43+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
44+
<PlatformTarget>AnyCPU</PlatformTarget>
45+
<DebugType>pdbonly</DebugType>
46+
<Optimize>true</Optimize>
47+
<OutputPath>bin\Release\</OutputPath>
48+
<DefineConstants>TRACE</DefineConstants>
49+
<ErrorReport>prompt</ErrorReport>
50+
<WarningLevel>4</WarningLevel>
51+
</PropertyGroup>
52+
<ItemGroup>
53+
<Reference Include="RabbitMQ.Client">
54+
<HintPath>..\packages\RabbitMQ.Client.3.5.1\lib\net40\RabbitMQ.Client.dll</HintPath>
55+
</Reference>
56+
<Reference Include="System" />
57+
<Reference Include="System.Core" />
58+
<Reference Include="System.Xml.Linq" />
59+
<Reference Include="System.Data.DataSetExtensions" />
60+
<Reference Include="Microsoft.CSharp" />
61+
<Reference Include="System.Data" />
62+
<Reference Include="System.Xml" />
63+
</ItemGroup>
64+
<ItemGroup>
65+
<Compile Include="Program.cs" />
66+
<Compile Include="Properties\AssemblyInfo.cs" />
67+
</ItemGroup>
68+
<ItemGroup>
69+
<None Include="App.config" />
70+
<None Include="packages.config" />
71+
</ItemGroup>
72+
<ItemGroup>
73+
<BootstrapperPackage Include=".NETFramework,Version=v4.5.1">
74+
<Visible>False</Visible>
75+
<ProductName>Microsoft .NET Framework 4.5.1 %28x86 and x64%29</ProductName>
76+
<Install>true</Install>
77+
</BootstrapperPackage>
78+
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
79+
<Visible>False</Visible>
80+
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
81+
<Install>false</Install>
82+
</BootstrapperPackage>
83+
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
84+
<Visible>False</Visible>
85+
<ProductName>.NET Framework 3.5 SP1</ProductName>
86+
<Install>false</Install>
87+
</BootstrapperPackage>
88+
</ItemGroup>
89+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
90+
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
91+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
92+
<PropertyGroup>
93+
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
94+
</PropertyGroup>
95+
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
96+
</Target>
97+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
98+
Other similar extension points exist, see Microsoft.Common.targets.
99+
<Target Name="BeforeBuild">
100+
</Target>
101+
<Target Name="AfterBuild">
102+
</Target>
103+
-->
104+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
5+
</startup>
6+
</configuration>
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using RabbitMQ.Client;
2+
using RabbitMQ.Client.Events;
3+
using System;
4+
using System.Text;
5+
6+
class Program
7+
{
8+
public static void Main()
9+
{
10+
var factory = new ConnectionFactory() { HostName = "localhost" };
11+
using( var connection = factory.CreateConnection() )
12+
using( var channel = connection.CreateModel() )
13+
{
14+
channel.QueueDeclare( "hello", false, false, false, null );
15+
16+
var consumer = new QueueingBasicConsumer( channel );
17+
channel.BasicConsume( "hello", true, consumer );
18+
19+
Console.WriteLine( " [*] Waiting for messages. To exit press CTRL+C" );
20+
while( true )
21+
{
22+
var ea = (BasicDeliverEventArgs)consumer.Queue.Dequeue();
23+
24+
var body = ea.Body;
25+
var message = Encoding.UTF8.GetString( body );
26+
Console.WriteLine( " [x] Received {0}", message );
27+
}
28+
}
29+
}
30+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle( "1_Receive" )]
9+
[assembly: AssemblyDescription( "" )]
10+
[assembly: AssemblyConfiguration( "" )]
11+
[assembly: AssemblyCompany( "" )]
12+
[assembly: AssemblyProduct( "1_Receive" )]
13+
[assembly: AssemblyCopyright( "Copyright © 2015" )]
14+
[assembly: AssemblyTrademark( "" )]
15+
[assembly: AssemblyCulture( "" )]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible( false )]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid( "b2273483-b55d-4b82-aa7a-a4a0ba32d3e2" )]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion( "1.0.0.0" )]
36+
[assembly: AssemblyFileVersion( "1.0.0.0" )]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="RabbitMQ.Client" version="3.5.1" targetFramework="net451" />
4+
</packages>

0 commit comments

Comments
 (0)