Malleswar

Hi,

I have prepared installer for Excel Ad-in. I have installed manually VSTO and PIA, Coz target machine was giving problem to install them thru installer.

Atleast it didnot work in this way. It copy the dlls from my setup and does nothing else.

When I run from IDE it works fine and also the same setup working on when I run on the same machine where I developed.

I have given the code. Can any one plz guide or help me

Thanks In advance


This from my thisaddin.cs:

private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
#region VSTO generated code

this.Application = (Excel.Application)Microsoft.Office.Tools.Excel.ExcelLocale1033Proxy.Wrap(typeof(Excel.Application), this.Application);

#endregion

MessageBox.Show("Excel Opened11111");

}

private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
MessageBox.Show("Excel Closed");
}

#region VSTO generated code

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InternalStartup()
{
this.Startup += new System.EventHandler(ThisAddIn_Startup);
this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
}

I used code for Installer.cs from this link :

http://weblogs.asp.net/mnissen/articles/427490.aspx



Re: Visual Studio Tools for Office Problem with Installer

Ji Zhou ¨C MSFT

Hi

Have you installed the VSTO SE Runtime The runtime is a prerequisite that must be installed on each end user's computer before a Visual Studio Tools for Office solution will run.

There are also two articles about VSTO solutions deployment on MSDN. For your information:

http://msdn2.microsoft.com/en-us/library/bb332051.aspx

http://msdn2.microsoft.com/en-us/library/bb332052.aspx

Thanks

Ji






Re: Visual Studio Tools for Office Problem with Installer

Malleswar

Hi ji,

Thank you very much for ur reply. I followed that links also which u have mentioned. Actually My setup was giving the following errors.

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=1985355&SiteID=1

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=1075209&SiteID=1

Then I just installed both VSTO, PIA manually by using indivdual setup. Then I tried my setup file. Then it just copies the files but does nothing.

Can you please guide me or give me one set up which is already prepared with that I can check my mistake.


Thanks in Advance







Re: Visual Studio Tools for Office Problem with Installer

Ji Zhou ¨C MSFT

Hi Malleswar,

It seems there is something wrong when using custom action to grant full trust to your assembly. Have you tried to use caspol to set security to your add in manually. I mean after installing VSTO runtime, PIAs and your add-in, use caspol.exe to grant full trust to addin¡¯s assembly. By this means, at last you should check the add-in in Com Add-in Dialog.

Thanks

Ji






Re: Visual Studio Tools for Office Problem with Installer

Malleswar

Hi Ji,

Thank you very much for ur reply. I copied Caspol.exe to C:\ and then performed Caspol -m addpset newfile.xml on the targeted machine.

Runtime error: Could not load file or assembly 'customPerm, Version=0.0.0.0, Culture=neutral, publikeytoken=64a8517d791b1a32' or one of its dependencies. The system cannot find the file specified.

I tried in many ways. but no use.

I could do it on my machine by using .net framework configuration tool.

Ji, Is there any link which provides the sample along with the setup file which may make my work easy. I want to check that setup on targeting device and compare with my setup file.

Can you please provide one sample proj with setup which will be useful for me and for many more people

Thanks in advance






Re: Visual Studio Tools for Office Problem with Installer

Malleswar

Hi ji,

I could install PIA and VSTOR through installer but I am getting small exception.

"cannot set the security policy.The specified solution code group name is not valid"

I copied the part of code setsecurity.cs where the exception is coming.


Code Snippet

string allUsersString = this.Context.Parameters["allUsers"];
string solutionCodeGroupName = this.Context.Parameters["ExcelAddin3"];
string solutionCodeGroupDescription = this.Context.Parameters["solutionCodeGroupDescription"];
string targetDir = this.Context.Parameters["targetDir"];
string assemblyName = this.Context.Parameters["assemblyName"];
string assemblyCodeGroupName = this.Context.Parameters["assemblyCodeGroupName"];
string assemblyCodeGroupDescription = this.Context.Parameters["assemblyCodeGroupDescription"];

// Note that a code group with solutionCodeGroupName name is created in the
// Install method and removed in the Rollback and Uninstall methods.
// The solutionCodeGroupName must be a unique name to ensure that the
// correct code group is removed during Rollback and Uninstall.

if (String.IsNullOrEmpty(solutionCodeGroupName))
throw new InstallException("Cannot set the security policy. The specified solution code group name is not valid.");


Can you please guide me

Thanks in Advance.





Re: Visual Studio Tools for Office Problem with Installer

X4U

Hello Malleswar,

this line string solutionCodeGroupName = this.Context.Parameters["ExcelAddin3"];
is wrong.

must be something like string solutionCodeGroupName = this.Context.Parameters["solutionCodeGroupName"];

Then, in your setupsolution go to your custom installaction where you call this dll..

Then give this dll a parameter like this:

solutionCodeGroupName=ExcelAddin3

If you want to see what's happen in the installer dll, you can use a Debugger.Launch command in the sourcecode.

This will try to attach a debugger and attch it to the setup process.

From then you can step through the code.

Hope this helps,

greets, Helmut






Re: Visual Studio Tools for Office Problem with Installer

Malleswar

Hi Helmut,

Thank you very much for reply. My setup moved from that all.

I am getting File not found I think its coming from rencaspolcommand method. when I use Debugger.Lanunch() to trace out, it gave me the error( Register JIT debugger is not available....... please computer settings).

Code Snippet

private static void RunCaspolCommand(string frameworkFolder, string arguments)
{
ProcessStartInfo processStartInfo = new ProcessStartInfo(Path.Combine(frameworkFolder, "caspol.exe"));
processStartInfo.CreateNoWindow = true;
processStartInfo.WindowStyle = ProcessWindowStyle.Hidden;
processStartInfo.WorkingDirectory = frameworkFolder;
processStartInfo.Arguments = arguments;
processStartInfo.RedirectStandardError = true;
processStartInfo.RedirectStandardOutput = true;
processStartInfo.UseShellExecute = false;

Process process = Process.Start(processStartInfo);
string caspolOutputMessage = process.StandardOutput.ReadToEnd();
process.WaitForExit();

int exitCode = 0;
if (process.HasExited)
exitCode = process.ExitCode;

if (exitCode != 0)
{
string message = null;
if (!String.IsNullOrEmpty(caspolOutputMessage))
{
String[] outputMessageLines = caspolOutputMessage.Split('\n');
for (int i = 2; i < outputMessageLines.Length; i++)
{
string line = outputMessageLines[i].Trim();
if (!String.IsNullOrEmpty(line))
{
message = line;
break;
}
}
}
if (String.IsNullOrEmpty(message))
message = "Cannot run the Code Access Security Policy tool (caspol.exe).";

throw new ApplicationException(message);
}
}



Can you please guide me where the wrong the above code

Thanks in advance.






Re: Visual Studio Tools for Office Problem with Installer

X4U

Hello Malleswar,

for me it seems that you have a wrong backslash in this line:

/targetDir="[TARGETDIR]" /solutionCodeGroupName="ExcelAddIn3" /solutionCodeGroupDescription

also make sure you have a space before every /

hope this helps,

greets, Helmut






Re: Visual Studio Tools for Office Problem with Installer

Malleswar

Helmut,

Thank you very much for your support. I could cross all the things. I think this is last one.

In updatemanifest.cs and in UpdateApplicationManifest()

// Get the application manifest from the document.
string documentPath = Path.Combine(targetDir, documentName);

System.Windows.Forms.MessageBox.Show(documentPath);

ServerDocument serverDocument = new ServerDocument(documentPath, FileAccess.ReadWrite);

at this point its giving the exception "File not found"

actuallly documentpath is

C:\Program Files\asa\ExcelApplicationSetup\ExcelApplication.xls

but I dint find
ExcelApplication.xls in that folder. Thats why its giving file not found. But do I need to add any code before this to create ExcelApplication.xls

Thanks in Advance,