none
ManifestUtilities ResolveFiles() vs UpdateFileInfo() RRS feed

  • Question

  • In my deployment every assembly and every additional files are in the same dir, together with application and deployment manifest.

     

    I can update and re-sign my manifests programmatically, did it in my own class.

     

    But obviously it's easier to use two lines of code with the ManifestUtilities class.

     

    Can somebody please explain me, like explaining to a child, what's the difference between ResolveFiles() and UpdateFileInfo(). What do these functions do _exactly_

     

    Main question for me is: Can I somehow add new dependency elements or file elements in the manifest with that framework? doesn't seem so. But I don't really know how to use it.

     

    THXS

    • Moved by Aspen VJ Monday, February 14, 2011 2:25 AM (From:ClickOnce and Setup & Deployment Projects)
    Friday, February 11, 2011 10:05 AM

Answers

  • Hi Foerdi,

    Description about the two methods.

    ResolveFiles Method (String[]) 

    UpdateFileInfo Method


    Cookie Luo[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Cookie Luo Wednesday, February 23, 2011 9:52 AM
    Tuesday, February 15, 2011 2:53 AM
  • Hi Foerdi,

    1. I use reflector tool to find the code about ResolveFiles.

    public void ResolveFiles(string[] searchPaths)
    {
     if (searchPaths == null)
     {
     throw new ArgumentNullException("searchPaths");
     }
     this.CollectionToArray();
     this.ResolveFiles_1(searchPaths);
     this.ResolveFiles_2(searchPaths);
    }
    
     
    private void CollectionToArray()
    {
     if (this.assemblyReferenceList != null)
     {
     this.assemblyReferences = this.assemblyReferenceList.ToArray();
     this.assemblyReferenceList = null;
     }
     if (this.fileReferenceList != null)
     {
     this.fileReferences = this.fileReferenceList.ToArray();
     this.fileReferenceList = null;
     }
    }
    
     
    private void ResolveFiles_1(string[] searchPaths)
    {
     if (this.assemblyReferences != null)
     {
     foreach (AssemblyReference reference in this.assemblyReferences)
     {
      if ((!reference.IsPrerequisite || (reference.AssemblyIdentity == null)) && !this.ResolveAssembly(reference, searchPaths))
      {
      if (this.treatUnfoundNativeAssembliesAsPrerequisites && (reference.ReferenceType == AssemblyReferenceType.NativeAssembly))
      {
       reference.IsPrerequisite = true;
      }
      else if (this.readOnly)
      {
       this.OutputMessages.AddErrorMessage("GenerateManifest.ResolveFailedInReadOnlyMode", new string[] { reference.ToString(), this.ToString() });
      }
      else
      {
       this.OutputMessages.AddErrorMessage("GenerateManifest.ResolveFailedInReadWriteMode", new string[] { reference.ToString() });
      }
      }
     }
     }
    }
     

    At the same time, you can find the code about UpdateFileInfo.

    2. Yes, you are right. From the code, we can not find anything about how to handle the file(such as ".deploy").

    Hope it is helpful for you.

    If you have any other questions, please feel free to let me know.

     

     


    Cookie Luo[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Cookie Luo Wednesday, February 23, 2011 9:52 AM
    Friday, February 18, 2011 8:55 AM

All replies

  • Hi foerdi,

    ·         Base on your description,  I think it is little about winform.

    This forum is dedicated to Windows Forms technology. I'm moving this thread from Base "Windows Forms" to "Common Language Running" forum, since this issue is related to CLR. There are more CLR experts in that forum.

    Thank you for understanding and supporting.

     

    Best Regards,

    Vin Jin


    Vin Jin [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, February 14, 2011 2:25 AM
  • Hi Foerdi,

    Description about the two methods.

    ResolveFiles Method (String[]) 

    UpdateFileInfo Method


    Cookie Luo[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Cookie Luo Wednesday, February 23, 2011 9:52 AM
    Tuesday, February 15, 2011 2:53 AM
  • THXS for the msdn links, but there's not much clear to me what happens.

    ResolveFiles: Locats files and dependencies / assemblies: So what? what happens if it finds them and what happens if it doesn't find them? At this point nothing is written to manifest

    UpdateFileInfo: computes hash and gets file size?

     

    BTW I think the clickonce forums was the right place to ask this, because this both functions are only related to ClickOnce manifests and there should be someone who knows it by heart

     

    Another question: How can I handle ".deploy" extensions with ResolveFiles and UpdateFileInfo

     

    I have all my files in one directory, together with my manifests - all files except CO manifests have ".deploy" extension, like it's intended

     

    But if I now want to update files, calling ResolveFiles and UpdateFileInfo doesn't help - because obviously it looks for the SourcePaths without ".deploy"

    Thursday, February 17, 2011 12:04 PM
  • Hi Foerdi,

    1. I use reflector tool to find the code about ResolveFiles.

    public void ResolveFiles(string[] searchPaths)
    {
     if (searchPaths == null)
     {
     throw new ArgumentNullException("searchPaths");
     }
     this.CollectionToArray();
     this.ResolveFiles_1(searchPaths);
     this.ResolveFiles_2(searchPaths);
    }
    
     
    private void CollectionToArray()
    {
     if (this.assemblyReferenceList != null)
     {
     this.assemblyReferences = this.assemblyReferenceList.ToArray();
     this.assemblyReferenceList = null;
     }
     if (this.fileReferenceList != null)
     {
     this.fileReferences = this.fileReferenceList.ToArray();
     this.fileReferenceList = null;
     }
    }
    
     
    private void ResolveFiles_1(string[] searchPaths)
    {
     if (this.assemblyReferences != null)
     {
     foreach (AssemblyReference reference in this.assemblyReferences)
     {
      if ((!reference.IsPrerequisite || (reference.AssemblyIdentity == null)) && !this.ResolveAssembly(reference, searchPaths))
      {
      if (this.treatUnfoundNativeAssembliesAsPrerequisites && (reference.ReferenceType == AssemblyReferenceType.NativeAssembly))
      {
       reference.IsPrerequisite = true;
      }
      else if (this.readOnly)
      {
       this.OutputMessages.AddErrorMessage("GenerateManifest.ResolveFailedInReadOnlyMode", new string[] { reference.ToString(), this.ToString() });
      }
      else
      {
       this.OutputMessages.AddErrorMessage("GenerateManifest.ResolveFailedInReadWriteMode", new string[] { reference.ToString() });
      }
      }
     }
     }
    }
     

    At the same time, you can find the code about UpdateFileInfo.

    2. Yes, you are right. From the code, we can not find anything about how to handle the file(such as ".deploy").

    Hope it is helpful for you.

    If you have any other questions, please feel free to let me know.

     

     


    Cookie Luo[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Cookie Luo Wednesday, February 23, 2011 9:52 AM
    Friday, February 18, 2011 8:55 AM