<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>moopoo.net &#187; Visual Studio</title>
	<atom:link href="http://moopoo.net/tag/visual-studio/feed/" rel="self" type="application/rss+xml" />
	<link>http://moopoo.net</link>
	<description>Fishing, technology and anything else</description>
	<lastBuildDate>Fri, 09 Dec 2011 11:04:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Package class library as wsp for SharePoint Deployment</title>
		<link>http://moopoo.net/sharepoint/package-class-library-as-wsp-for-sharepoint-deployment/</link>
		<comments>http://moopoo.net/sharepoint/package-class-library-as-wsp-for-sharepoint-deployment/#comments</comments>
		<pubDate>Wed, 15 Dec 2010 12:30:57 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[visual]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://moopoo.net/?p=133</guid>
		<description><![CDATA[Some Visual Studio solutions I&#8217;ve come across have class library projects in them. These assemblies have to subsequently be manually copied into the GAC of each SharePoint server. This goes against the standard of using wsp files to deploy assemblies and files into a SharePoint environment. Single servers are easier to manage manually copying assemblies [...]]]></description>
			<content:encoded><![CDATA[<p>Some Visual Studio solutions I&#8217;ve come across have class library projects in them. These assemblies have to subsequently be manually copied into the GAC of each SharePoint server. This goes against the standard of using wsp files to deploy assemblies and files into a SharePoint environment. Single servers are easier to manage manually copying assemblies but it&#8217;s not a very pleasant way of doing things, move into a multi server environment and you&#8217;re in a minefield.<br />
Fortunately there is an easy way to get these assemblies, plus any others you may wish to deploy at the same time, into a wsp. It takes two files and a post build event. Read on..</p>
<p>First up, we need a manifest file. This tells the environment what we would like it to do with the assembly.<br />
Create a new xml file in the root of your project called manifest.xml and add the following code:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008000;">&lt;?</span>xml version<span style="color: #008000;">=</span><span style="color: #666666;">&quot;1.0&quot;</span> encoding<span style="color: #008000;">=</span><span style="color: #666666;">&quot;utf-8&quot;</span> <span style="color: #008000;">?&gt;</span>
<span style="color: #008000;">&lt;</span>Solution xmlns<span style="color: #008000;">=</span><span style="color: #666666;">&quot;http://schemas.microsoft.com/sharepoint/&quot;</span>
  SolutionId<span style="color: #008000;">=</span><span style="color: #666666;">&quot;&lt;new guid&gt;&quot;</span><span style="color: #008000;">&gt;</span>
  <span style="color: #008000;">&lt;</span>Assemblies<span style="color: #008000;">&gt;</span>
    <span style="color: #008000;">&lt;</span>Assembly Location<span style="color: #008000;">=</span><span style="color: #666666;">&quot;&lt;assembly&gt;.dll&quot;</span> DeploymentTarget<span style="color: #008000;">=</span><span style="color: #666666;">&quot;GlobalAssemblyCache&quot;</span><span style="color: #008000;">&gt;&lt;/</span>Assembly<span style="color: #008000;">&gt;</span>
  <span style="color: #008000;">&lt;/</span>Assemblies<span style="color: #008000;">&gt;</span>
<span style="color: #008000;">&lt;/</span>Solution<span style="color: #008000;">&gt;</span></pre></div></div>

<p>Replace &lt;new guid&gt; with a generated GUID and &lt;assembly&gt; with the name of your dll file.<br />
The DeploymentTarget attribute above specifies that it will be deployed to the GAC, you can use WebApplication if you want it to be deployed to the bin directory of your Webb Application.</p>
<p>You can also specify that the relevant line can be added to the SafeControls section of your web.config file by adding the following inside the Assembly tag above.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008000;">&lt;</span>SafeControls<span style="color: #008000;">&gt;</span>
        <span style="color: #008000;">&lt;</span>SafeControl Assembly<span style="color: #008000;">=</span><span style="color: #666666;">&quot;&lt;assembly&gt;, Version=1.0.0.0, Culture=neutral, PublicKeyToken=&lt;public key token&gt;&quot;</span> <span style="color: #0600FF;">Namespace</span><span style="color: #008000;">=</span><span style="color: #666666;">&quot;&lt;namespace&gt;&quot;</span> TypeName<span style="color: #008000;">=</span><span style="color: #666666;">&quot;*&quot;</span> Safe<span style="color: #008000;">=</span><span style="color: #666666;">&quot;True&quot;</span> <span style="color: #008000;">/&gt;</span>
      <span style="color: #008000;">&lt;/</span>SafeControls<span style="color: #008000;">&gt;</span></pre></div></div>

<p>Next up, create a ddf file in the root of your project. I tend to name mine wsp.ddf for consistency. This will contain the instructions on what to package into the wsp file. This file should look like the following.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008000;">;</span>Define the output directory and CAB file name <span style="color: #000000;">&#40;</span>with a wsp extension<span style="color: #000000;">&#41;</span>
.<span style="color: #0000FF;">Set</span> DiskDirectory1<span style="color: #008000;">=</span><span style="color: #666666;">&quot;bin<span style="color: #008080; font-weight: bold;">\D</span>ebug&quot;</span>
.<span style="color: #0000FF;">Set</span> CabinetNameTemplate<span style="color: #008000;">=</span><span style="color: #666666;">&quot;MySolutionName.wsp&quot;</span>
&nbsp;
<span style="color: #008000;">;</span>Include the following files <span style="color: #0600FF;">in</span> the CAB Root
manifest.<span style="color: #0000FF;">xml</span>
bin\Debug\<span style="color: #008000;">&lt;</span>assembly<span style="color: #008000;">&gt;</span>.<span style="color: #0000FF;">dll</span></pre></div></div>

<p>Now all we have left to do is add a post build event to build the wsp for us.<br />
Go to you project properties (right click project)<br />
Under the Build Events tab under Post-build event command line, enter the following:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008000;">::</span> <span style="color: #0000FF;">Change</span> directory to the root of the project
cd <span style="color: #666666;">&quot;$(ProjectDir)&quot;</span>
&nbsp;
<span style="color: #008000;">::</span> <span style="color: #0000FF;">Create</span> a WSP CAB
MakeCAB <span style="color: #008000;">/</span>f <span style="color: #666666;">&quot;WSP.DDF&quot;</span></pre></div></div>

<p>You can change when the post build event runs, to your liking; normally &#8216;On successful build&#8217;.</p>
<p>That&#8217;s it when you have a successful build the wsp file will be generated ready for you to deploy, no more manual copying or editing web.config.</p>
]]></content:encoded>
			<wfw:commentRss>http://moopoo.net/sharepoint/package-class-library-as-wsp-for-sharepoint-deployment/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Displaying Crystal Reports in a Web Browser</title>
		<link>http://moopoo.net/web-development/displaying-crystal-reports-in-a-web-browser/</link>
		<comments>http://moopoo.net/web-development/displaying-crystal-reports-in-a-web-browser/#comments</comments>
		<pubDate>Tue, 23 Oct 2007 08:07:26 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[business objects]]></category>
		<category><![CDATA[crystal reports]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://moopoo.net/blog/2007/10/23/displaying-crystal-reports-in-a-web-browser/</guid>
		<description><![CDATA[Having tried for a while to find the right information for displaying Crystal Reports properly inside a web page using Crystal Report Viewer I finally managed to pull the information together into a solution that works; well for me anyway. It&#8217;s worth mentioning that I don&#8217;t use the Crystal Reports extensions for Visual Studio, I [...]]]></description>
			<content:encoded><![CDATA[<p>Having tried for a while to find the right information for displaying Crystal Reports properly inside a web page using Crystal Report Viewer I finally managed to pull the information together into a solution that works; well for me anyway.</p>
<p>It&#8217;s worth mentioning that I don&#8217;t use the Crystal Reports extensions for Visual Studio, I have Crystal Server running on the box. I can&#8217;t see how this method wouldn&#8217;t work through the Visual Studio extensions.</p>
<h3>Code Infront</h3>
<p>Register the assembly in the top of your aspx page</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008000;">&lt;%</span>@ Register TagPrefix<span style="color: #008000;">=</span><span style="color: #666666;">&quot;cr&quot;</span> <span style="color: #0600FF;">Namespace</span><span style="color: #008000;">=</span><span style="color: #666666;">&quot;CrystalDecisions.Web&quot;</span> 
Assembly<span style="color: #008000;">=</span><span style="color: #666666;">&quot;CrystalDecisions.Web, Version=11.0.3300.0, Culture=neutral, PublicKeyToken=692fbea5521e1304&quot;</span> <span style="color: #008000;">%&gt;</span></pre></div></div>

<p>Place the control where you want it to appear in the page.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008000;">&lt;</span>cr<span style="color: #008000;">:</span>crystalreportviewer id<span style="color: #008000;">=</span><span style="color: #666666;">&quot;crReport1&quot;</span> runat<span style="color: #008000;">=</span><span style="color: #666666;">&quot;server&quot;</span> hasviewlist<span style="color: #008000;">=</span><span style="color: #666666;">&quot;False&quot;</span>
    hastogglegrouptreebutton<span style="color: #008000;">=</span><span style="color: #666666;">&quot;False&quot;</span> hassearchbutton<span style="color: #008000;">=</span><span style="color: #666666;">&quot;False&quot;</span>
    hasgotopagebutton<span style="color: #008000;">=</span><span style="color: #666666;">&quot;False&quot;</span> hasdrillupbutton<span style="color: #008000;">=</span><span style="color: #666666;">&quot;False&quot;</span> hascrystallogo<span style="color: #008000;">=</span><span style="color: #666666;">&quot;False&quot;</span>
    autodatabind<span style="color: #008000;">=</span><span style="color: #666666;">&quot;true&quot;</span> width<span style="color: #008000;">=</span><span style="color: #666666;">&quot;350px&quot;</span> displaygrouptree<span style="color: #008000;">=</span><span style="color: #666666;">&quot;False&quot;</span>
    height<span style="color: #008000;">=</span><span style="color: #666666;">&quot;50px&quot;</span> hyperlinktarget<span style="color: #008000;">=</span><span style="color: #666666;">&quot;_blank&quot;</span><span style="color: #008000;">&gt;</span></pre></div></div>

<h3>Code Behind</h3>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008080; font-style: italic;">// declare the variables</span>
<span style="color: #0600FF;">protected</span> CrystalReportViewer crReport1<span style="color: #008000;">;</span>
<span style="color: #0600FF;">private</span> ReportDocument document1 <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> ReportDocument<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">private</span> TableLogOnInfos infos1 <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> TableLogOnInfos<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">private</span> TableLogOnInfo info2 <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> TableLogOnInfo<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">private</span> ConnectionInfo info1 <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> ConnectionInfo<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">// load the report</span>
document1.<span style="color: #0000FF;">Load</span><span style="color: #000000;">&#40;</span>Request.<span style="color: #0000FF;">PhysicalApplicationPath</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;myReport.rpt&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">// Add the parameters</span>
document1.<span style="color: #0000FF;">SetParameterValue</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;param1&quot;</span>, <span style="color: #666666;">&quot;value1&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
document1.<span style="color: #0000FF;">SetParameterValue</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;param2&quot;</span>, <span style="color: #666666;">&quot;value2&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">//Set the login info for the database</span>
info1.<span style="color: #0000FF;">ServerName</span> <span style="color: #008000;">=</span> ConfigurationSettings.<span style="color: #0000FF;">AppSettings</span><span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;server_name&quot;</span><span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span>
info1.<span style="color: #0000FF;">DatabaseName</span> <span style="color: #008000;">=</span> ConfigurationSettings.<span style="color: #0000FF;">AppSettings</span><span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;database_name&quot;</span><span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span>
info1.<span style="color: #0000FF;">UserID</span> <span style="color: #008000;">=</span> ConfigurationSettings.<span style="color: #0000FF;">AppSettings</span><span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;user_id&quot;</span><span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span>
info1.<span style="color: #0000FF;">Password</span> <span style="color: #008000;">=</span> ConfigurationSettings.<span style="color: #0000FF;">AppSettings</span><span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;password&quot;</span><span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span>
Tables tables1 <span style="color: #008000;">=</span> document1.<span style="color: #0000FF;">Database</span>.<span style="color: #0000FF;">Tables</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">//Apply login info to the report</span>
<span style="color: #0600FF;">foreach</span> <span style="color: #000000;">&#40;</span>CrystalDecisions.<span style="color: #0000FF;">CrystalReports</span>.<span style="color: #0000FF;">Engine</span>.<span style="color: #0000FF;">Table</span> table1 <span style="color: #0600FF;">in</span> tables1<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    info2 <span style="color: #008000;">=</span> table1.<span style="color: #0000FF;">LogOnInfo</span><span style="color: #008000;">;</span>
    info2.<span style="color: #0000FF;">ConnectionInfo</span> <span style="color: #008000;">=</span> info1<span style="color: #008000;">;</span>
    table1.<span style="color: #0000FF;">ApplyLogOnInfo</span><span style="color: #000000;">&#40;</span>info2<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">// Bind the report</span>
crReport1.<span style="color: #0000FF;">ReportSource</span> <span style="color: #008000;">=</span> document1<span style="color: #008000;">;</span>
crReport1.<span style="color: #0000FF;">DataBind</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>You also need to remember to close the document after it has been rendered to free up memory. This should ideally be done in the Page_Unload method. See <a href="http://msdn2.microsoft.com/en-us/library/ms225490(VS.80).aspx" title="MSDN post on where to close a report (Opens in a new window)" target="_blank">this post</a> on MSDN for more information on why it should be placed in Page_Unload.</p>
]]></content:encoded>
			<wfw:commentRss>http://moopoo.net/web-development/displaying-crystal-reports-in-a-web-browser/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

