<file> element of Clickonce application manifest

K

Ken Lemieux

Hi,

I'm adding an icon file programmaticlly to a Clickonce application manifest.

How do I, or what classes do I use to, generate the SHA1 hash of the file?

I looked into using the SHA1 property of an instantiated Hash class. However
the Hash constructor only accepts an instance of type Assembly.

Thanks,
 
L

Linda Liu[MSFT]

Hi Kenneth,

Firstly, we usually add a file to a ClickOnce application using Mage.exe or
MageUI.exe tool.

In detail, add the file to the application directory with the rest of the
application's files and then update the application manifest to list the
file newly added using Mage.exe. For example:

mage -u v1.0.0.0\Application.manifest -FromDirectory v1.0.0.0

Performing this task re-creates the list of files in your application
manifest and also automatically generates the hash signatures. Then we need
to re-sign the application menifest as well as the deployment manifest. For
more information on how to include a data file in a ClickOnce application,
please refer to the following MSDN document:

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

As for your question, I haven't found out how to compute hash for a file
programmatically. But my thought is that even if we could compute hash for
a file programmatically, we still need to re-sign the application manifest
and deployment manifest using Mage.exe or MageUI.exe tool afterwards.

I will go on the research and as soon as I get an answer, I will get it
back to you.
I appreciate your patience!


Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
K

Ken Lemieux

Thanks Linda,

I understand exactly what you told me. However my needs arise from my desire
to do some post publishing modifications to the generated application and
deployment manifests.

Specifically, I'm creating a usable tool that will allow a software
publisher, deploying their application using Clickonce, to easily create file
associations to their application. You can see my application at Codeplex
here: http://www.codeplex.com/fileasstool.

All the updating and signing of the manifests is currently functioning.
However, the current assumption is the icon file already exists in the
application manifest. I would like to make this a specifiable parameter of my
tool, thereby allowing a publisher to specify there association icon at post
publish time.
--
Kenneth Lemieux
Project Engineer
Whelen Engineering Co., Inc.
 
L

Linda Liu[MSFT]

Hi Kenneth,

Thank you for your reply and detailed explanation! I understand your
scenario better now.

I have consulted this issue to our produce team and got the answer as
follows:

The MSBuild manifest generation code does this:

Dim fi As New FileInfo(filePath)
Dim s As Stream = Nothing
Try
s = fi.OpenRead()
Dim sha As New SHA1Managed()
Dim hashBytes() As Byte = sha.ComputeHash(s)
Dim hash As String = Convert.ToBase64String(hashBytes)
...

hash is a string that will have the hash that you need to put in the
manifest before you re-sign it.

Is that what you were looking for?


Sincerely,
Linda Liu
Microsoft Online Community Support
 
K

Ken Lemieux

Once again I find myself thanking you Linda.
The information you provided is exactly what I needed and woked well for my
application.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top