Denis Pitcher

Ok, final piece to my project. I need to be able to set the CasPol settings as part of a script run in my setup project.

The wonderfully clear MS documentation sugggests that it should be easy to create a custom action to do so, yet all the wizard allows you to do is add files, not add a custom script to run the caspol settings.

Can someone point me to a good resource for doing this I need to set caspol for a network share so I don't think the typical setsecurity or mad's security class will work.

Thanks




Re: Visual Studio Tools for Office Setup Project Custom Action to set CasPol

Denis BDA

Found it. I was trying to include a batch file that would run the caspol settings for me. The custom actions don't appear to support batch files. They do support vb script files however, the following file is a good example of how to write a Custom Action Script

http://msdn2.microsoft.com/en-us/library/ms932843.aspx#RBPIG_Ch45_WindowsInstaller90936






Re: Visual Studio Tools for Office Setup Project Custom Action to set CasPol

Douglas H. Troy

Denis,

There are a couple ways to do this, I created an external DLL that essentially executes CasPol, passing it the necessary parameters (after all, CasPol is nothing more than a command-line utility) I then added that DLL as a Custom Action under "Install" ... you can do this also via a VB Script, etc...

Here's a blog that discusses using CasPol to trust a network share (just in case you haven't read this one) .Net Security Blog

Also, here's the MSDN write-up on creating and using Custom Actions (includes a few examples; look at the left-hand "side bar", and you'll see the various Custom Action things you can read)

Creating and Using Custom Actions

Not sure this really answers your question ... just trying to help steer you in a direction that might be useful.





Re: Visual Studio Tools for Office Setup Project Custom Action to set CasPol

Misha Shneerson - MSFT

I wonder whether you have seen this article and the second part as well.

There is a tutorial on authoring VSTO deployment thing which includes authoring a custom action that invokes CasPol.






Re: Visual Studio Tools for Office Setup Project Custom Action to set CasPol

Denis BDA

Misha,

The MS documentation on deployment is tremendous overkill and in many cases doesn't answer basic questions.   It has taken me since early december to figure out how to get a auto updating setup project deployed add-in.  I wish my job let me write about it but unfortunately they have requested that I don't, otherwise I'd put together a walkthrough of how to do it.

I already knew how to set CasPol, all I needed was how to do it as part of a setup project which I figured out via the how to write a custom action script link I posted above.

For those who run into a similar scenario, the easiest way to set CasPol for a network share (not ingrained trust within the application, for which I recommend Mad's blog post on it)

It was pretty simple.  Write this in a text file and save it as a .vbs file

Set sh = Createobject("WScript.Shell")

sh.Run "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\caspol.exe -m -q -ag 1.2 -url file://share/location/* FullTrust"

Then add that .vbs file to the setup project and add it under custom actions in the install folder.  It will then set the caspol setting when you install the setup project.






Re: Visual Studio Tools for Office Setup Project Custom Action to set CasPol

Malleswar

Hi Denis,

Can you guide me I am frustrated to develop a setup for Excel Addin with VSTOR, PIA.
These are issues which I posted.

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

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

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

can you plz give me the setup which u have developed with VSTOR, PIA. With that I can find where the problem is in my setup

Regards,
Malleswar








Re: Visual Studio Tools for Office Setup Project Custom Action to set CasPol

Bhupathi Venkatesh

Hi Denis,

We could use your sample script, but, the installation location for the application is dynamic like it can be installed in multiple places. So we need to know the directory where the application installed and then append that path ot sh.Run command. Can you or anyone who are experience in deployment script let me know how can we get the installer path in the following VB script that is added as Custom Action,

Set sh = Createobject("WScript.Shell")

sh.Run "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\caspol.exe -m -q -ag 1.2 -url InstallerPath FullTrust"

Any help would be greatly appreciated.

Thanks,

Venkatesh