none
TargetFramework changed after installing VS2010

    Question

  •  

    Hi everyone,

    Using mage to create the application manifest after installing VS2010 creates a dependency on .net 4, but none of the assemblies are actually higher than 3.5 compatible.

    I dont want to force my customer base to update the framework to 4.0 yet, but the app would not update showing that 4.0 is required.

    The ClickOnce app manifest states:

      <dependency>
        <dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
          <assemblyIdentity name="Microsoft.Windows.CommonLanguageRuntime" version="4.0.30319.0" />
        </dependentAssembly>
      </dependency>

    (before, using SDK 3.5 it said version="2.0.50727.0")

    And the deploy manifest states:

      <compatibleFrameworks xmlns="urn:schemas-microsoft-com:clickonce.v2">
        <framework targetVersion="4.0" profile="Client" supportedRuntime="4.0.30319" />
        <framework targetVersion="4.0" profile="Full" supportedRuntime="4.0.30319" />
      </compatibleFrameworks>

    (before "compatibleFrameworks" didnt appear at the deploy manifest)

     

    Is there any command line parameter or way to tell mage to emit a manifest targeting 3.5?

    or should i have to reinstall the 3.5 SDK to make it work? or worse, manually correct the manifest before signing.

    thanks in advance

    dan

     

    Friday, June 04, 2010 8:05 PM

Answers

  • Hi d.firka,

    I met the same issue when creating manifest files via the neweast version of Mage tool in the Visual Studio tools. Based on my understanding, this is because this version of Mage tools will assume your application is based on .Net framework4 and add the related dependencies automatically.

    To workaround this, you can modify the generated files manually or use another version of mage tool. I used the mage tools in the windows 7 SDK tools and it works fine. Please let me know if my reply does not solve your issue.

    Regards,
    Aland Li


    Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
    • Marked as answer by d.firka Tuesday, June 08, 2010 11:26 AM
    Tuesday, June 08, 2010 8:32 AM
    Moderator

All replies

  • Hi,

    When you opened the solution in VS2010, you must have agreed to updating the solution to 4.0. You need to set it back.

    Assuming your app is in C#, go to the Application tab in the project properties for each project and set the target framework back to .NET 3.5.

    Then go to Publish tab and click the Prerequisites button, and select .NET 3.5 SP-1 and uncheck .NET 4.0.

    I would do a build to make sure it's okay. This should set you back to .NET 3.5.

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    • Proposed as answer by Aland LiModerator Monday, June 07, 2010 9:22 AM
    • Unproposed as answer by d.firka Monday, June 07, 2010 6:21 PM
    Friday, June 04, 2010 9:51 PM
    Moderator
  • Hi d.firka,

    How is your issue now? I think RobinDotNet already indicated the key note.

    Regards,
    Aland Li


    Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
    Monday, June 07, 2010 9:06 AM
    Moderator
  • Hi Robin,

    I rechecked all the solutions involved, and they are pointing to 3.5. Most of our work is done calling csc and msbuild, to point to the right framework we had to change the following:

    - in MSBuild,adding  ToolsVersion="3.5" to the <project/> element

    - in CSC, calling "C:\Windows\Microsoft.NET\Framework\v3.5\csc.exe" and referencing assemblies in the "Referenced Assemblies", for example: /r "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\System.Runtime.Serialization.dll"

    To verify that all of the deployed assemblies were pointing correctly, I used the following small (quick and dirty) app:

     static void Main(string[] args)
        {
    
          foreach (string livstrFile in Directory.GetFiles(args[0], "*.deploy"))
          {
            string absPath = Path.GetFullPath(livstrFile);
            try
            {
              Assembly asmbly = Assembly.LoadFile(absPath);
              Console.WriteLine("File: " + livstrFile);
              Console.WriteLine(" RT: " + asmbly.ImageRuntimeVersion);
              AssemblyName[] an =
                asmbly.GetReferencedAssemblies();
              foreach (AssemblyName name in an)
              {
                asmbly = Assembly.LoadFile(absPath);
                Console.WriteLine(string.Format(" > Ref: V: {1} ({0})", name.Name, name.Version));
              }
            }
            catch (Exception )
            {
              // could not get info, not interested
            }
          }
        }

     

    The resulting list is very long, but none of the assemblies point specifically to 4.0, the typical entry in the output is ;

    File: .\DruidaToolsGraph.dll.deploy
      RT: v2.0.50727
     > Ref: V: 2.0.0.0 (mscorlib)
     > Ref: V: 3.0.0.0 (PresentationFramework)
     > Ref: V: 2.0.0.0 (System)
     > Ref: V: 3.0.0.0 (WindowsBase)
     > Ref: V: 3.0.0.0 (PresentationCore)
     > Ref: V: 1.0.0.0 (DruidaToolsStat)
     > Ref: V: 0.0.0.0 (DruidaTools)
     > Ref: V: 2.0.0.0 (System.Drawing)

     

    Apparently mage.exe is deciding on the target framework based on other factors, not just the RunTime of the assemblies involved. Could that be?

    If this is by design we'll have to postprocess the manifest (xslt) to remove and modify the entries.

    thanks

    df

     

     
    Monday, June 07, 2010 1:01 PM
  • Hi d.firka,

    I met the same issue when creating manifest files via the neweast version of Mage tool in the Visual Studio tools. Based on my understanding, this is because this version of Mage tools will assume your application is based on .Net framework4 and add the related dependencies automatically.

    To workaround this, you can modify the generated files manually or use another version of mage tool. I used the mage tools in the windows 7 SDK tools and it works fine. Please let me know if my reply does not solve your issue.

    Regards,
    Aland Li


    Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
    • Marked as answer by d.firka Tuesday, June 08, 2010 11:26 AM
    Tuesday, June 08, 2010 8:32 AM
    Moderator
  • hi Aland,

    Yes here I post the xslt used to remove / modify the entries to preserve dependencies on 3.5 :

     

    App.manifest.xslt:

    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2">
      <xsl:template match ="/">
        <xsl:apply-templates mode ="copy"/>
      </xsl:template>
      <xsl:template match ="@*|node()" mode ="copy">
        <xsl:copy>
          <xsl:choose>
            <xsl:when test ="local-name()='assemblyIdentity' and ./@name='Microsoft.Windows.CommonLanguageRuntime'">
              <xsl:for-each select ="@*">
                <xsl:choose>
                  <xsl:when test ="local-name()='version'">
                    <xsl:attribute name ="version">
                      <!-- change dependency from 4.0)-->
                      <xsl:value-of select="'2.0.50727.0'"/>
                    </xsl:attribute>
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:apply-templates select="."  mode="copy" />
                  </xsl:otherwise>
                </xsl:choose>
              </xsl:for-each>
            </xsl:when>
            <xsl:otherwise>
              <xsl:apply-templates select="@*"  mode="copy" />
            </xsl:otherwise>
          </xsl:choose>
          <xsl:apply-templates mode="copy" />
        </xsl:copy>
      </xsl:template>
    </xsl:stylesheet>

     

    Deploy.manifest.xslt:

    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2">
      <xsl:template match ="/">
        <xsl:apply-templates mode ="copy"/>
      </xsl:template>
      <xsl:template match ="@*|node()" mode ="copy">
        <xsl:choose>
          <xsl:when test ="local-name()='compatibleFrameworks'">
            <!-- Not copied-->
          </xsl:when>
          <xsl:otherwise>
            <xsl:copy>
              <xsl:apply-templates mode="copy" />
            </xsl:copy>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:template>
    </xsl:stylesheet>

     

    thxs

    df

     

    Tuesday, June 08, 2010 11:26 AM
  • Did you use the version of Mage that came with VS2010, or the version that came with VS2008? 

    If you use the version that came with VS2010, it assumes you are targeting .NET 4.0. For 3.5, use the version that came with VS2008. Unfortunately, there's no way to modify the new version of Mage to let you specify that target.

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    Tuesday, June 15, 2010 10:31 PM
    Moderator
  • The only thing that worked for me was to convert the project file to VS 2010 format. I was not going to do anything drastic like modifying the manifest. What a pain in the butt this is.

     

     

    Thursday, September 09, 2010 12:27 AM
  • Hi,

    I've also run into this issue - now that I've upgrade my work tools to VS2010 and to the new mage tool.

    I have no problem that mage assume my app will use .NET 4 - the problem is that when client try to run my ClickOnce deployment on machine without .NET 4 framework they get the following message:

    Title: System Update Required

    Content: Unable to install or run this application. This application required your system to be updated to Microsoft Common Language Runtime Version 4.0.30319.0

     

    I pretty sure that previously ClickOnce used to download the .NET framework on its own. How can I restore this functionallity that ClickOnce will grab and install .NET framework 4.0?

     

    Thank you,

    Ido.

    p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica} p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
    Saturday, March 05, 2011 6:52 PM
  • Hi Ido

    I am getting exactly the same error. Older versions of VS used to correctly install the correct .Net Framework for example version 2.0. VS2010 projects targetting the .Net framework 4.0 however fail presumably because it was never tested before release and I also read elsewhere that it is not fixed in VS2010 SP1 either.

    I set my project prerequisites to "Create setup program to install prerequisite components", selected Microsoft .NET Framework 4 (x86 and x64) and chose the "Download prerequsites from the same location as my application". My generated application folders where SETUP.EXE lives also contains a DOTNETFX40 folder with the dotNetFx40_Full_x86_x64.exe.

    When I test my app from the URL, it starts fine but after clicking through the security warning, I get an error:

    System Update Required

    Unable to install or run this application. This application requires your system to be updated to Microsoft Common Language Runtime Version 4.0.30319.0

    Does anyone have a fix for this rather fundamental problem?

     


    TriSys Business Software
    Monday, July 11, 2011 11:04 AM
  • ClickOnce does not update the prerequisites. If you want to upgrade to .NET 4, you have to install .NET 4 on the user computers.

    We handled this by doing a programmatic uninstall/reinstall. So we published a new version of the application that targeted .NET 4 and had .NET 4 selected as a prerequisite to a new URL.

    Then we added code to the old version that would uninstall itself and then invoke the link (start.process) on the link to the setup.exe of the new application.

    So what the user would see is this: They would run the app, it would update, then we showed a message telling them what it was about to do and they hit OK. Then it uninstalled the ClickOnce app and invoked the new installation. If the user has .NET 4 installed (Microsoft is pushing the CF in Windows Updates, so if you're targeting that, you might be okay), it would just install the new application. Otherwise it would install .NET 4 and THEN install the new application version.

    The code for the uninstall/reinstall is in this article about certificate expiration. It worked great. We have thousands of customers, and it went very smoothly.

    http://msdn.microsoft.com/en-us/library/ff369721.aspx

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    Thursday, July 14, 2011 2:37 AM
    Moderator