Jump to content

VS2022 and pdn 4.3.4 set-up advice please. 21/12/2021


Red ochre
 Share

Recommended Posts

I am trying to make some changes to a plug-in written in an older version VS that targetted an older version of Pdn and I'm having troubles setting up the following:

 

1. Adding Pdn references (PaintDotNet.Base, Core, Data, Effects, .exe).
 In VS2019 I could add the Pdn references in Solution Explorer/Project/References. How do I do this in VS2022?
Do I edit the '.csproj' file directly?... I've just done that ... it now shows errors - mainly conflicts in targetted .net frame work

 

2. Target Framework. This was previously accessed via Project/Properties/Application in VS2019. I believe I will have to change this from 4.1.2.0 to 6.0.0.0 to build in Pdn 4.3.4? - Again I can't even find the damn setting!
Note. Right click/ properties on the project shows the properties window but no info ... or Application tab?... just blank and not like the MS page below.
https://docs.microsoft.com/en-us/visualstudio/ide/visual-studio-multi-targeting-overview?view=vs-2022

 

3. Build Events. In VS2019 these could be accessed via Project/Properties/Build Events. Where do I now find these settings in VS 2022? - I've just edited the paths in .csproj but can't build due to the framework issues.

 

4. How do I change the black backgound? Not keen on the dark theme. Used to be under View/Settings I think.Solved.
Aah - Debug/Options/Theme - that's a strange place to hide it!

 

Any advice would be appreciated. I no longer have Pdn 4.2.16 installed so currently have no way to alter effects built using older versions.

 

I'm sure I'm making this far more complicated than it needs to be.
Does anyone have a successful method (baby steps) of updating their older effects to use VS 2022 and Pdn 4.3.4? - a share would be greatly appreciated and might keep my blood pressure down!

Many thanks

 

Red ochre Plugin pack.............. Diabolical Drawings ................Real Paintings

 

PdnForumSig2.jpg

Link to comment
Share on other sites

Google the try-convert package. It's an official Microsoft open-source effort to help people automatically switch and it worked for Dynamic Draw (aka brush factory), which is a semi-complex plugin. Download it, run it with their instructions. I think you just give the root folder of your project to it via command line and it does the rest. Probably want to make a backup just in case. Then test to see if it still works. Might want to test winforms too because they don't use the same designer, they use a .net core recreation of the winforms designer that is a little bumpier to use.

There's an active bug right now with the EffectConfigDialog soft-crashing with winforms designer; the suggestion is to open it back in VS2019 if you want to make adjustments with the winforms designer (if you can't after converting, I would even go as far as keeping an unconverted version, using the designer, and just copying over the things that changed).

Sidenote, I actually used try-convert to get to version 5.0 so I don't know if it does version 6.0 considering how fresh it is, but it's not too difficult to move from 5 to 6 anyway.
----------------------------------------------------

1. I already had the PDN references still present and working after using the try-convert package. If they don't, just add the same ones you had before.

2. right-click the project in solution explorer -> Properties -> Application, exact same steps, exact same place. Should be done automatically after the try-convert package, (but just in case you need to go to .net 5 before .net 6)

3. Project -> Properties -> Build -> Output. Scroll down to where it says Events

Sidenote, I have a string .resx file and it was weirdly toggled to "no code generation" after using the try-convert package, so I had to manually change it back to Public.
HCF0s.png

Edited by NinthDesertDude
  • Like 1
Link to comment
Share on other sites

@Red ochre Which plugin are you trying to update? Hopefully its a small plugin to get started with. I have a method, but would like to try it before I suggest it. This method doesn't work on all plugins, especially Form based ones. If its an effect plugin the method should work. I have been converting some old plugins to Net 6.0 with some success.

 

The menus in VS2022 will change depending on the Net framework the plugin is based on. No wonder its confusing. VS2022 will not let you upgrade directly any plugin designed with net 4.8 or earlier. Try-convert is designed to update to Net 5.0. I've had it convert some plugins to Core 2.0 which won't work with Paint.net.

  • Like 1

qG3vze.png

 

Link to comment
Share on other sites

@toe_head2001 You have something else to make try-convert show Net 6.0

 

This is what I have installed;

 

image.png.917b58f9dda286d109fd381ceb6a30d2.png

However when I run Try-Convert the highest choice I see is 

 

image.png.547b7fc831d02fc5b66280af209603ae.png

No need to show all the choices, They are listed newest to oldest. I find only 

 

image.png.7299004a73f86c51232be995c7a07727.png

works in all cases.

 

Perhaps its the utility you use to decompile the DLL (I use JetBrainsDotPeek 2021.3.1

 

qG3vze.png

 

Link to comment
Share on other sites

@Red ochre Here's an example script from Codelab as @ReMake suggested.

It's all you need to generate a Net 6.0 Solution. You just need to add your code and correct the mistakes you will find. 

Spoiler

// Name:Table
// Submenu: 
// Author: 
// Title: Table
// Version: 1.0.0.0
// Desc: Render a Table
// Keywords:
// URL:https:
// Help:https://boltbait.com/pdn/codelab/

 

#region UICode
IntSliderControl Amount1 = 5; // [5,3000] Cell Width
IntSliderControl Amount2 = 1; // [1,1000] Horizontal Number of Cells
IntSliderControl Amount3 = 5; // [5,3000] Cell Height (Pixels)
IntSliderControl Amount4 = 5; // [1,1000] Vertical Number of Cells
IntSliderControl Amount5 = 5; // [1,100] Pen Width
ListBoxControl Amount6 = 0; // Line Style|Solid|Dash|Dash-Dot|Dash-Dot_Dot|Dot
ColorWheelControl Amount7 = ColorBgra.FromBgr(0, 0, 0); // Line Color
CheckboxControl Amount8 = false; // Anti-Alias
#endregion


    public enum PropertyNames
    {
      Amount1,
      Amount2,
      Amount3,
      Amount4,
      Amount5,
      Amount6,
      Amount7,
      Amount8,
    }
        public enum Amount6Options
    {
      Amount6Option1,
      Amount6Option2,
      Amount6Option3,
      Amount6Option4,
      Amount6Option5,
    }
    void Render(Surface dst, Surface src, Rectangle rect)
{

    // Step through each row of the current rectangle
    for (int y = rect.Top; y < rect.Bottom; y++)
    {
        if (IsCancelRequested) return;
        // Step through each pixel on the current row of the rectangle
        for (int x = rect.Left; x < rect.Right; x++)
        {
            ColorBgra SrcPixel = src[x,y];
            ColorBgra DstPixel = dst[x,y];

            ColorBgra CurrentPixel = SrcPixel;

            // TODO: Add additional pixel processing code here


            dst[x,y] = CurrentPixel;
        }
    }
}

 

I successfully re-built this plugin in the time it took me from post 2 hours ago.

 

 

qG3vze.png

 

Link to comment
Share on other sites

@NinthDesertDude, @AndrewDavid, @ReMake, @toe_head2001

Thank you all for your useful replies. I think the idea of building a template using codelab is the method I will try first.
Hopefully I can copy and paste the code across from the old files once I've got VS2022 set up to build an initial codelab output.

 

Thanks again and a happy, healthy Christmas to all.

  • Upvote 1

 

Red ochre Plugin pack.............. Diabolical Drawings ................Real Paintings

 

PdnForumSig2.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...