none
Application converted from VS2005/.NET 2.0 to VS2010/.NET 4.0 fails running in ClickOnce mode

    Question

  • We have a solution that worked fine in .NET 2.0. Solution consists of around 20 projetcs and these projects depend on .NET FW assemblies as well as on other projects in the same solution. We migrated the solution to .NET 4.0 & VS 2010 successfully and now the application works fine on developer's machines without any exceptions when run as a normal application.

    Our .NET 2.0 based app was deployed using ClickOnce and used to work fine on client machines. Migrating the deployment to .NET 4.0 ClickOnce was partially successful to the extent that the app downloads to the client machine successfully and starts up as well. During the startup (after passing the logon screen) we see the following exception raised.

    InstantiatePlugin: Instantiate class Ifs.Fnd.Explorer.Extenders.ApplicationSearchManager.FndApplicationSearchManager from assembly Ifs.Fnd.Explorer.Extenders, Version=2.0.0.0, Culture=neutral, PublicKeyToken=ff90f512e10aef0d.

    Reason: Could not load file or assembly 'Ifs.Fnd.Explorer.Extenders.resources, Version=2.0.0.0, Culture=en, PublicKeyToken=ff90f512e10aef0d' or one of its dependencies. The system cannot find the file specified.

    Inner stack:   
    at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
    at System.Reflection.RuntimeAssembly.InternalGetSatelliteAssembly(String name, CultureInfo culture, Version version, Boolean throwOnFileNotFound, StackCrawlMark& stackMark)
    at System.Resources.ManifestBasedResourceGroveler.GetSatelliteAssembly(CultureInfo lookForCulture, StackCrawlMark& stackMark)
    at System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean createIfNotExists, StackCrawlMark& stackMark)
    at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stackMark)
    at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
    at Ifs.Fnd.ResourceManager.FndResourceManager.FndGetResourceSet(CultureInfo culture)
    at Ifs.Fnd.ResourceManager.FndResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
    at System.Resources.ResourceManager.GetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
    at System.ComponentModel.ComponentResourceManager.FillResources(CultureInfo culture, ResourceSet& resourceSet)
    at System.ComponentModel.ComponentResourceManager.FillResources(CultureInfo culture, ResourceSet& resourceSet)
    at System.ComponentModel.ComponentResourceManager.ApplyResources(Object value, String objectName, CultureInfo culture)
    at Ifs.Fnd.ResourceManager.FndResourceManager.ApplyResources(Object value, String objectName, CultureInfo culture)
    at System.ComponentModel.ComponentResourceManager.ApplyResources(Object value, String objectName)
    at Ifs.Fnd.Explorer.Extenders.ApplicationSearchManager.FndApplicationSearchManager.InitializeComponent()
    at Ifs.Fnd.Explorer.Extenders.ApplicationSearchManager.FndApplicationSearchManager..ctor()"

    Steps that I followed when converting the solution to .NET 4.0 (previously we worked with VS 2005, .NET 2.0)

    1. Opened the solution in VS 2010 and converted all projects using the conversion wizard.
    2. in each project set the target platform as .NET 4.0.
    3. In the main project that produced the executable output, turned off manifest generation.
    4. in app.exe.config file added support for .NET 4.0 runtime (<supportedRuntime version="v4.0.30319"/>)
    5. in deployment manifest added <compatibleFrameworks> section.
    6. signed both application, deployment manifests.

    After these steps I would expect the app to work as a normal clickonce app. Anything that I  have missed?
    Specifically, anything that i have missed that would affect resource generation?
    Wednesday, July 28, 2010 4:30 AM

All replies

  • Why do you need to modify the app.exe.config to add support of .NET 4, or the deployment manifest? When you change your target framework, doesn't it do that for you?

    Also, it looks to me like the problem is that you are missing a reference. Check that your new project has the same references that the old one has, and that they are being included in the deployment.

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    Thursday, July 29, 2010 4:36 AM
  • Thank you for the reply.

    1. Our app.exe.config is not part of the project that produce the main exe (i.e. not generated by the VS designer). It's  kept separate (contains many settings) and copied to the folder containing the output of the build process. So we needed to manually change it.

    2. Due to the complex nature of the build process and the many components that we need to add to the final build output, we don't use the publish option in VS2010. Instead we build our projects using MSBuild scripts, generate the manifests (i.e. application and deployment manifests) by MSBuild tasks and sign them. Deployment manifest generated by the MSBuild task GenerateDeploymentManifest doesn't contain the <compatibleFrameworks> section for some reason. So we need to manually modify the manifest to include it.

    3. If it was a case of a missing reference how come I can run the application locally as a normal windows application without any issues?

    Once again thanks for your interest.

    Thursday, July 29, 2010 11:16 AM
  • Hi,

    1. ok.

    2. That's weird, do you have TFS2010?

    3. Maybe because the assembly is installed in the GAC on that computer you're testing on? If the dll is one that is not created when you build the project, make sure the properties on it are right. What I'm trying to impart to you is during the conversion from VS2008 to VS2010 something got changed. There are various reports but no single concensus on exactly what the deal is. The prerequisites on my project got changed when we converted, which is odd."

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    Thursday, July 29, 2010 3:37 PM
  • Hi,

    2. No we don't have TFS2010. We use VS2010 Professional.

    3. I did check on all the projects and didn't find any missing references. The assemblies that are reported in the exception are created from code in the build process and do not exist in GAC.

    This isn't a clickonce issue either since I ran into the same exception after generating the manifests using the mage.exe tool.

    This looks very much like our own problem. What baffles me is that we only experience it in clickonce mode.

    To explain the issue as I see it,

    There's an assembly A that references assembly B.

    When attempting to create a type defined in A (which in turn refers some type in B), an exception is reported 'Could not load file or assembly 'B.resources'......'.

    But there's no separate assembly called B.resources.dll.

    B's Resources.resx has its Build Action property set to 'Embedded Resource'. Could it be that the resources aren't getting embedded in B for some reason?

    What do you make of this?

    Thanks again for your patience.

    Monday, August 02, 2010 9:11 AM
  •  

    What about change the project target CPU to X86? Some dlls may only support x86.

     

    Best regards,

    Ling Wang


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    • Marked as answer by kuwi Friday, August 06, 2010 8:33 AM
    • Unmarked as answer by kuwi Friday, August 06, 2010 8:33 AM
    Wednesday, August 04, 2010 4:28 AM
  • If you don't include it as an embedded resource, but just include it as a dll with hte project, does it work then?

    To try this, add the dll to the project. Set build action to "content" and "copy to output directory" to "copy always". It should then show up in the Application Files dialog, and be deployed with your application and you can load it locally.

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    Friday, August 06, 2010 6:50 PM
  • Thank you. Seems a good idea. Will give it a try and report the result.Changing the target CPU to x86 didn't work.
    Sunday, August 08, 2010 4:26 AM
  • There's an assembly A that references assembly B.

    When attempting to create a type defined in A (which in turn refers some type in B), an exception is reported 'Could not load file or assembly 'B.resources'......'.

    But there's no separate assembly called B.resources.dll.

    B's Resources.resx has its Build Action property set to 'Embedded Resource'. Could it be that the resources aren't getting embedded in B for some reason?

    Check B.dll with Reflector and inspect the resources inside it. Then you can see if the expected resources are present.
    Monday, August 09, 2010 8:12 AM
  • I checked using Reflector. The resources are present in B.
    Monday, August 09, 2010 12:57 PM