Support for Net3.1, Net5, Net6 windows forms apps available when?

When I try to load a newly created netcore winforms app dll an error message is indicating unable to load runtime config.
This happens with blank / new winforms apps created in netcore 3.1/5/6 having no other dependencies than netcore winforms.
Can the runtime config be configured?

example project in netcore 6
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net6.0-windows</TargetFramework>
    <Nullable>enable</Nullable>
    <UseWindowsForms>true</UseWindowsForms>
  </PropertyGroup>

Example assembly attributes for a netcore 3.1 dll
// Assembly WinFormsApp1, Version 1.0.0.0

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows=true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v3.1", FrameworkDisplayName="")]
[assembly: AssemblyCompany("WinFormsApp1")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("WinFormsApp1")]
[assembly: AssemblyTitle("WinFormsApp1")]

Example assembly attributes for a Net6 dll
// Assembly WinFormsApp1, Version 1.0.0.0

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows=true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName="")]
[assembly: AssemblyCompany("WinFormsApp1")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("WinFormsApp1")]
[assembly: AssemblyTitle("WinFormsApp1")]
[assembly: TargetPlatform("Windows7.0")]
[assembly: SupportedOSPlatform("Windows7.0")]




Am I missing something?
Is this a feature that will be added to smartassembly 
my current version is 8.0.4.4860



Best Answer

  • ak98ak98 Posts: 8 Bronze 2
    OK. hacking in to this

    Pointed the UI at dll in the obj folder not bin folder
    SA UI then complained about not able to find dependencies

    added these dll search paths (dont point to individual files)
    C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\6.0.0-rc.1.21451.3
    C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.0-rc.1.21451.13

    can now obfuscate a basic forms app with smartassembly

    note that the SA Configuration for search paths is kept in
    "C:\ProgramData\Red Gate\SmartAssembly 8\SmartAssembly.settings"

Answers

  • ak98ak98 Posts: 8 Bronze 2
    Followup :   I found this file 'WinFormsApp1.runtimeconfig.json' in the output folder along with the dll



     ?? may be of use 

    contents


    {
      "runtimeOptions": {
        "tfm": "net6.0",
        "frameworks": [
          {
            "name": "Microsoft.NETCore.App",
            "version": "6.0.0-rc.1.21451.13"
          },
          {
            "name": "Microsoft.WindowsDesktop.App",
            "version": "6.0.0-rc.1.21451.3"
          }
        ],
        "configProperties": {
          "System.Reflection.Metadata.MetadataUpdater.IsSupported": false
        }
      }
    }
  • ak98ak98 Posts: 8 Bronze 2
    WARNING  WARNING  WARNING 
    Although this works , having the core framework paths in the search path will screw up subsequent DotNet Framwwork builds in a BAD way.
    DNF builds complete without warnings but the application will not run and will crash silently on startup due to missing references to version 6 DLL's on client machines.
    Needless to say,  this will really ruin your day if you deploy both Net6 and DNF applications and you must manually alter the reference paths -- ie remove NET6 reference paths from smartassembly before obfuscating Ditnet framwork applications.
    note that the SA Configuration for search paths is kept in
    "C:\ProgramData\Red Gate\SmartAssembly 8\SmartAssembly.settings"
  • orudgeorudge Posts: 1 New member
    With the release of .NET 6 this week, it would be great if this could be resolved. It seems that if you publish your app as self-contained, SmartAssembly works with a WinForms application, but it fails as described above when publishing as framework-dependent.
  • @orudge An answer from a person from RedGate saying that there is no information at the moment on .net6 support :(
    https://forum.red-gate.com/discussion/comment/166808/#Comment_166808

  • philippe_altusgroupphilippe_altusgroup Posts: 8 New member
    edited November 15, 2021 10:38PM
    ak98 said:
    OK. hacking in to this

    Pointed the UI at dll in the obj folder not bin folder
    SA UI then complained about not able to find dependencies

    added these dll search paths (dont point to individual files)
    C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\6.0.0-rc.1.21451.3
    C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.0-rc.1.21451.13

    can now obfuscate a basic forms app with smartassembly

    note that the SA Configuration for search paths is kept in
    "C:\ProgramData\Red Gate\SmartAssembly 8\SmartAssembly.settings"


    Not working for me with RTM .net6 on a WPF application with the paths:

            <SearchPath>C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.0</SearchPath>
            <SearchPath>C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\6.0.0</SearchPath>

    Workaround is working. See my next message below...

  • philippe_altusgroupphilippe_altusgroup Posts: 8 New member
    edited November 15, 2021 10:39PM
    Finally the workaround described above is working.
    In my case, I had to reorder the paths because it contains a file with a same name but one was good and not the other. So, for me, the good order is:

           <SearchPath>C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\6.0.0</SearchPath>
           <SearchPath>C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.0</SearchPath>

    And I also had to add the full `\bin\Release` path so that it could find the missing dlls....

Sign In or Register to comment.