Tag: microsoft
VStudio Web.config Transformation for your App.configs
by B.Russell on Jul.01, 2011, under Development, Tips and Tricks
I searched high and low for this tid-bit before finally stumbling upon this great question\answer over at Stack Overflow. I’m going to lay out the steps here for reference but credit goes to Oleg Sych and Dan Abramov.
Original article:
App.Config Transformation for projects which are not Web Projects in Visual Studio 2010?
1.) Add an XML file for each configuration to the project.
Let’s say your project build settings are Debug.Local, Debug.Production, Release.Local, Release.Production. Then your new app.config files should be titled as app.<build title>.config …. or app.Debug.Local.config, app.Debug.Production.config, etc. One file for each build configuration. Once they are added to your project continue to step 2.
2.) Unload project and open *.csproj file for editing
Right-click on the project and select Edit project file from the Solution Explorer.
3.) Bind app.configs created in Step 1 to original app.config
Find the section inside the project file that contains app.config and all the app.<build title>.config files you just manually added. Notice how their build actions are set to None.
- Set all the app config files build action to Content
- Make all the app config files you manually added dependent upon the original app.config file.
When you finished it should look something like this:
<Content Include="App.config" />
<Content Include="App.Debug.config" >
<DependentUpon>App.config</DependentUpon>
</Content>
<Content Include="App.Release.config" >
<DependentUpon>App.config</DependentUpon>
</Content>
4.) Activate transformation magic
In the end of the file after
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
and before final
</Project>
Insert the following XML:
<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.dll" />
<Target Name="AfterCompile" Condition="exists('app.$(Configuration).config')">
<!-- Generate transformed app config in the intermediate directory -->
<TransformXml Source="app.config" Destination="$(IntermediateOutputPath)$(TargetFileName).config" Transform="app.$(Configuration).config" />
<!-- Force build process to use the transformed configuration file from now on. -->
<ItemGroup>
<AppConfigWithTargetPath Remove="app.config" />
<AppConfigWithTargetPath Include="$(IntermediateOutputPath)$(TargetFileName).config">
<TargetPath>$(TargetFileName).config</TargetPath>
</AppConfigWithTargetPath>
</ItemGroup>
</Target>
Now you can reload the project. Make sure that all the manual app.<build settings>.config files you added earlier are now neatly tucked away under the original app.config file.
Build and enjoy!
SSRS Display Report in Landscape
by B.Russell on Aug.13, 2007, under SQL Server
I see a lot of questions asking how to set a report to show in landscape mode verses normal mode. It’s actually easier than you would expect. Simply view the properties of the Report Object, and modify the Page Size setting to read 11 x 8.5 inches as shown below.
Now save and preview in Print Mode. You should notice that your report appears to be in Landscape mode ( wider than higher ) so when a user views the report or hit’s print his default mode is set to Landscape. Easy as pie.
Enjoy !,
Brandon Russell
Email + Reporting Services = Success
by B.Russell on Aug.07, 2007, under SQL Server
We recently released our latest version of our Web software here at work, which meant I’ve had some free time to learn more of the Advance features of Reporting Services 2005. One thing I wanted to check out was the subscription service. While playing with it I noticed that you could setup a schedule to have a report auto generated and then emailed to whom ever you choose.
The options available was a full To:, CC:, BCC:, Subject:, and Message: fields. Immediately I seen one of my most demanding tasks of running a custom monthly report and emailing it to the CEOs become one less thing on my plate. Long story short, the first of August the schedule fired off the auto generated report to the CEOs and CC’d me and my boss. It worked like a champ. I even told it to export it as a Adobe Acrobat format. I immediately received an email from one of the CEOs giving me praise for remembering it on time when he hadn’t and even taking the time to lay it out nice and neat in PDF.
It’s a shame he doesn’t know I let the server do all my work and I took credit, but isn’t that how it’s suppose to be =p ?
So if you haven’t had a chance to explore the capabilities of the Auto scheduler and Email functionality of Reporting Services, maybe you should. It could save some time on your demanding plate and bring a little more praise from your co-workers.