Showing posts with label Visual Studio. Show all posts
Showing posts with label Visual Studio. Show all posts

Wednesday, 4 August 2010

Installing the Crystal Reports Runtime on a Web Server when trying to deploy Crystal Reports Developed in Visual Studio 2008

My preference is to use SQL Server Reporting Services (SSRS) as an application reporting engine where possible - but one of my clients had a requirement to create reports in Crystal Reports. The reports were designed in Visual Studio 2008 and consequently use the Crystal Reports 2008 Basic engine. When you deploy an application onto a server, you will get an error in the event log and an image placeholder where the report should be.

If you want to deploy your app on a server, you'll also need to deploy the CR runtime for your reports to render correctly. The official way to do this (rather than trying to install all the DLLs you can find to the gac) is to use the installer. The easiest way to get this is from your local drive (where you installed visual studio). It is typically located here:

%Program Files%Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\CrystalReports10_5


DDK

Monday, 21 June 2010

How to change the Read Only Attribute of Files in Powershell using a Visual Studio Pre-Build command (ie not using the DOS attrib command)

When using Microsoft PowerShell 2.0, you can just put this in your Visual Studio project pre-build event to remove the read-only attribute on binary files:

$(ProjectDir)FixTemplateFolderAttributes.cmd $(ProjectDir)
This points to a command file in your project directory called "FixTemplateFolderAttributes.cmd" like so:

:: Changes file attributes as needed.
cd %1
powershell Set-ExecutionPolicy RemoteSigned
powershell ../Build/Scripts/FixTemplateFolderAttributes.ps1

This calls the following powershell commands to make files writable:

$computer = gc env:computername

$fileList = Get-ChildItem ".\InfoPath Form Template" | Where-Object {$_.name -like "*.dll" -or $_.name -like "*.pdb" -or $_.name -like "*.xsf"  }

foreach ($fileItem in $fileList) 
{
 $fileItem.set_IsReadOnly($false) # Remove readonly flag
}

$fileList = Get-ChildItem ".\obj\Debug\" | Where-Object {$_.name -like "*.dll" -or $_.name -like "*.pdb" -or $_.name -like "*.txt"}

foreach ($fileItem in $fileList) 
{
 $fileItem.set_IsReadOnly($false) # Remove readonly flag
}

$fileList = Get-ChildItem ".\bin\Debug\" | Where-Object {$_.name -like "*.dll" -or $_.name -like "*.pdb" -or $_.name -like "*.txt"}

foreach ($fileItem in $fileList) 
{
 $fileItem.set_IsReadOnly($false) # Remove readonly flag
}


DDK

Tuesday, 7 October 2008

How to do remote debugging with the Visual Studio 2008 Remote Debugger Service (Msvsmon.exe)

There is always a problem that will crop up on one of your servers that you just CANNOT reproduce at all. To solve pesky problems like this, you can make use of the remote debugger service of Visual Studio. What's more, you can debug without running a setup package at all on dev or production servers. Instead, you can just run msvsmon.exe from a file share without even installing anything. This will definitely keep the network guys happy!

Typically, you can get msvsmon.exe file from the following path on your development machines that already have Visual Studio 2008 installed:
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\Remote Debugger\x86\msvsmon.exe

When you run Msvsmon.exe, it just shows up on the server as a windows application on your server (See screenshot). You can also run it as a Windows Service so you don't need to log onto the server to start it up.




In Visual Studio on your local machine, you then just put in a fully qualified remote server name in "Attach to Process" dialog. Now you can debug the remote machine to your hearts content (make sure you're a debugger user or remote admin otherwise you will get access denied errors).

Just a reminder - if you are debugging ASP.NET on a 2003 server and above, there will be 1 w3wp.exe process for each of your application pools. It may be hard to find out which w3wp.exe process you want to debug as there may be many application pools. You can find out which w3wp.exe process is running your pool by a process of deduction (ie just by stopping the application pools you are not using. The one left is yours).

For the full goss, see http://support.microsoft.com/default.aspx/kb/910448. There is even a 17 minute tutorial on setting it up. See http://www.microsoft.com/uk/msdn/screencasts/screencast/313/visual-studio-2008-remote-debugging-with-msvsmonexe.aspx

Just keep in mind - you may be up for a long wait if the connection to your server is slow - especially if attaching a process in Atlanta! :o). There is a timeout option if you get timeout errors (you only get timeout errors in "No Authentication" mode as the "Windows Authentication" mode has an infinite timeout.)


Saturday, 1 March 2008

"Open Command Here" for VS 2005 and VS 2008


Scott has inf files which allow you to add the "Open Cmd Here" prompt to your windows explorer context menu. You just have to save the text below as an .inf file, right click and select "install".



One of my colleagues Andrew Weaver (aka Reddog) has updated this .inf file slightly to point to default 2008 file paths :




;

; "CMD Prompt Here" PowerToy

;

; Copyright 1996 Microsoft Corporation

;

; Modified to launch VS.NET 2005 command prompt 5/6/03 MG

; Modified to launch VS.NET 2008 command prompt 22/11/07 AW

 

[version]

signature="$CHICAGO$"

 

[VSNet2008CmdHereInstall]

CopyFiles = VSNet2008CmdHere.Files.Inf

AddReg    = VSNet2008CmdHere.Reg

 

[DefaultInstall]

CopyFiles = VSNet2008CmdHere.Files.Inf

AddReg    = VSNet2008CmdHere.Reg

 

[DefaultUnInstall]

DelFiles  = VSNet2008CmdHere.Files.Inf

DelReg    = VSNet2008CmdHere.Reg

 

[SourceDisksNames]

55="VS .NET 2008 CMD Prompt Here","",1

 

[SourceDisksFiles]

VSNet2008CmdHere.INF=55

 

[DestinationDirs]

VSNet2008CmdHere.Files.Inf = 17

 

[VSNet2008CmdHere.Files.Inf]

VSNet2008CmdHere.INF

 

[VSNet2008CmdHere.Reg]

HKLM,%UDHERE%,DisplayName,,"%VSNet2008CmdHereName%"

HKLM,%UDHERE%,UninstallString,,"rundll32.exe syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %17%\VSNet2008CmdHere.inf"

HKCR,Directory\Shell\VSNet2008CmdHere,,,"%VSNet2008CmdHereAccel%"

HKCR,Directory\Shell\VSNet2008CmdHere\command,,,"%11%\cmd.exe /k cd ""%1"" && ""C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat"""

HKCR,Drive\Shell\VSNet2008CmdHere,,,"%VSNet2008CmdHereAccel%"

HKCR,Drive\Shell\VSNet2008CmdHere\command,,,"%11%\cmd.exe /k cd ""%1"""

 

[Strings]

VSNet2008CmdHereName="VS.NET 2008 Command Prompt Here PowerToy"

VSNet2008CmdHereAccel="VS.NET &2008 CMD Prompt Here"

UDHERE="Software\Microsoft\Windows\CurrentVersion\Uninstall\VSNet2008CmdHere"