Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Setup / November 2004

Tip: Looking for answers? Try searching our database.

No touch deployment

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steve Bugden - 21 Nov 2004 13:35 GMT
Hi,

I have deployed a .net application of across the web, using standard code
(attached). THis works except that I have to give trust to the 7 dlls in my
application individually using the .Net Framework 'trust an assembly' wizard.
I can't expect my users to do that.

Firstly, I would like to be able to present the user with a messagebox in
which he clicks OK to trust my assemblies.

As a second step, I would like to be able to detect for the presence of the
.Net Framework and allow the user to install it.

Can anyone please point me to a good resource which would explain what I
want to do. I just have't managed to find anything that really explains it
well.

Many Thanks,

Steve Bugden

Imports System.Reflection

Public Class Form1
   Inherits System.Windows.Forms.Form

   Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Try

  strmsg = "http://someurlname/somedllname.dll"
                       

  'Register an event to determine the assembly, if not found ie when using
deep serialisation

  Dim currentdomain As AppDomain = AppDomain.CurrentDomain

  'Event to catch error during deep serialisation
  AddHandler currentdomain.assemblyresolve, AddressOf MyResolveEventHandler

  Dim strFormTOLoad As String
  strFormTOLoad = "Appname.MainFormName"

  Dim objStartAssenbly As [Assembly] = [Assembly].LoadFrom(strMsg)

  Dim FormType As Type = objStartAssenbly.GetType(strFormTOLoad)

  Dim objStartForm As Object

  objStartForm = Activator.CreateInstance(FormType)

  Dim form2 As Form = CType(objStartForm, Form)
  Me.Hide()
  form2.ShowDialog()
  Application.Exit()

  Catch ex As Exception

       MsgBox(ex.Message & ControlChars.CrLf & ControlChars.CrLf &
ex.StackTrace)
   End Try
End Sub

Private Shared Function MyResolveEventHandler(ByVal sender As Object, ByVal
args As ResolveEventArgs) As [Assembly]

'Get a list of all the assemblies loaded in our appdomain
Dim assemblies() As [Assembly] = AppDomain.CurrentDomain.GetAssemblies

'Search the list to find the assembly that was not found
Dim asm As [Assembly]

For Each asm In assemblies
     If asm.FullName = args.Name Then
               Return asm
           End If
       Next
End Function

End Class
ALI-R - 30 Nov 2004 00:05 GMT
You'd better make a batch file like the one below and ask users to run it
before running your application.this is what most of the us do for now.

@rem - polchgprompt - Enables or disables the prompt that is displayed
@rem whenever Caspol.exe is run using an option that would cause policy
changes.
@rem - machine  - specifies adding the new code group at machine policy
level.
@rem - addgroup - Adds a new code group to the code group hierarchy
@rem - url      - Specifies code that originates from the given URL.
@rem - n        - specifies the scripting name for a code group to add.

CD %windir%\microsoft.net\framework\v1.1.4322

caspol.exe -polchgprompt off -machine -addgroup All_Code -url
http://yourserver/yourapp/* FullTrust -n MagNetAlertVanSps02
caspol.exe -polchgprompt on
Pause

I will keep monitoring this thread,let me know if you need more help
Hope this helps.
Reza Alirezaei

> Hi,
>
[quoted text clipped - 77 lines]
>
> End Class
Steve Bugden - 30 Nov 2004 13:09 GMT
Hi Reza ,

Many thanks for the reply.

I couldn't find out what the following mean: -n MagNetAlertVanSps02
The name of the group perhaps?

How can I make it cope with other framework versions, I mean supposing they
don't have v1.1.4322 of the .net framework? Could it be possible there could
be v1.1.****?

Also, I've written the application using 1.0 of the framework so I would
like it to run for that as well.

Is it possible to write something to detect whether the .Net framwork exists
on the users machine, and if not load it from the internet and install it?

Many thanks once again,

Steve.

> You'd better make a batch file like the one below and ask users to run it
> before running your application.this is what most of the us do for now.
[quoted text clipped - 106 lines]
> >
> > End Class
ALI-R - 30 Nov 2004 17:02 GMT
> I couldn't find out what the following mean: -n MagNetAlertVanSps02
> The name of the group perhaps?
**** it is the name of Code group that caspol creates in your Code access
security (ControlPanel->Adminsitrative Tools-> Microsoft .Net Framework
configuration 1.1),you can name it what so ever ,say test1 ,......

> How can I make it cope with other framework versions, I mean supposing they
> don't have v1.1.4322 of the .net framework? Could it be possible there could
> be v1.1.****?

v1.1.**** =v1.1.4322 ,right??:-)

> Also, I've written the application using 1.0 of the framework so I would
> like it to run for that as well.
>
> Is it possible to write something to detect whether the .Net framwork exists
> on the users machine, and if not load it from the internet and install it?

Ofcourse there should be a way to detect wether framwork  exists or not ,but
what I do is that in our corporate interanet I push this batch file and .net
Framework to the clients which desire to work with my applications(think
about it like windows update).anyways your clinets have to install
.Netframework that's a very good time to make them install appropriate
security groups in their machines too.

Good luck
Reza Alirezaei

> Many thanks once again,
>
[quoted text clipped - 110 lines]
> > >
> > > End Class
ALI-R - 30 Nov 2004 23:12 GMT
read this article ,it is very useful and informative.

http://msdn.microsoft.com/vcsharp/using/columns/wonders/default.aspx?pull=/libra
ry/en-us/dnforms/html/winforms11122002.asp


it shows you how to programmatically create code group but still you have to
ask your users to run your programme on their local machine.you know what
I'm meaning.

Good luck
> Hi Reza ,
>
[quoted text clipped - 127 lines]
> > >
> > > End Class

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.