Jump to content

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


Red ochre

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

PaintNetSignature.png.6bca4e07f5d738b2436f83d0ce1b876f.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

 

PaintNetSignature.png.6bca4e07f5d738b2436f83d0ce1b876f.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.

 

 

PaintNetSignature.png.6bca4e07f5d738b2436f83d0ce1b876f.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

  • 1 month later...

When using codelab (version 6.4.7995.19949) to create a project then opening it with VS22 I keep seeing this warning when building the .dll.(see below)

 

Is this a problem? (When the .dll is copied into Effects there are no loads errors and it seems to function ok.)
Any advice appreciated. I have briefly read the link for Warning MSB3277 but it is WAY over my head!
Should I be manually editing something in
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets ? (The warning mentions line 2304)

 

Many thanks for any feedback.

 

Spoiler

Severity    Code    Description    Project    File    Line    Suppression State
Warning    MSB3277    Found conflicts between different versions of "WindowsBase" that could not be resolved.
There was a conflict between "WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" and "WindowsBase, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35".
    "WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" was chosen because it was primary and "WindowsBase, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" was not.
    References which depend on "WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" [C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\6.0.1\ref\net6.0\WindowsBase.dll].
        C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\6.0.1\ref\net6.0\WindowsBase.dll
          Project file item includes which caused reference "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\6.0.1\ref\net6.0\WindowsBase.dll".
            C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\6.0.1\ref/net6.0/WindowsBase.dll
    References which depend on "WindowsBase, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" [].
        C:\Program Files\paint.net\PaintDotNet.Base.dll
          Project file item includes which caused reference "C:\Program Files\paint.net\PaintDotNet.Base.dll".
            PaintDotNet.Base
            PaintDotNet.Core
            PaintDotNet.Data
            PaintDotNet.Effects
        C:\Program Files\paint.net\PaintDotNet.Core.dll
          Project file item includes which caused reference "C:\Program Files\paint.net\PaintDotNet.Core.dll".
            PaintDotNet.Core
            PaintDotNet.Data
            PaintDotNet.Effects
        C:\Program Files\paint.net\PaintDotNet.SystemLayer.dll
          Project file item includes which caused reference "C:\Program Files\paint.net\PaintDotNet.SystemLayer.dll".
            PaintDotNet.Core
            PaintDotNet.Data
            PaintDotNet.Effects
        C:\Program Files\paint.net\PaintDotNet.Framework.dll
          Project file item includes which caused reference "C:\Program Files\paint.net\PaintDotNet.Framework.dll".
            PaintDotNet.Data
            PaintDotNet.Effects
        C:\Program Files\paint.net\PaintDotNet.SystemLayer.Native.x64.dll
          Project file item includes which caused reference "C:\Program Files\paint.net\PaintDotNet.SystemLayer.Native.x64.dll".
            PaintDotNet.Core
            PaintDotNet.Data
            PaintDotNet.Effects    myVS22TemplateEffect    C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets    2304    
Warning    MSB3277    Found conflicts between different versions of "WindowsBase" that could not be resolved.
There was a conflict between "WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" and "WindowsBase, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35".
    "WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" was chosen because it was primary and "WindowsBase, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" was not.
    References which depend on "WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" [C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\6.0.1\ref\net6.0\WindowsBase.dll].
        C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\6.0.1\ref\net6.0\WindowsBase.dll
          Project file item includes which caused reference "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\6.0.1\ref\net6.0\WindowsBase.dll".
            C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\6.0.1\ref/net6.0/WindowsBase.dll
    References which depend on "WindowsBase, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" [].
        C:\Program Files\paint.net\PaintDotNet.Base.dll
          Project file item includes which caused reference "C:\Program Files\paint.net\PaintDotNet.Base.dll".
            PaintDotNet.Base
            PaintDotNet.Core
            PaintDotNet.Data
            PaintDotNet.Effects
        C:\Program Files\paint.net\PaintDotNet.Core.dll
          Project file item includes which caused reference "C:\Program Files\paint.net\PaintDotNet.Core.dll".
            PaintDotNet.Core
            PaintDotNet.Data
            PaintDotNet.Effects
        C:\Program Files\paint.net\PaintDotNet.SystemLayer.dll
          Project file item includes which caused reference "C:\Program Files\paint.net\PaintDotNet.SystemLayer.dll".
            PaintDotNet.Core
            PaintDotNet.Data
            PaintDotNet.Effects
        C:\Program Files\paint.net\PaintDotNet.Framework.dll
          Project file item includes which caused reference "C:\Program Files\paint.net\PaintDotNet.Framework.dll".
            PaintDotNet.Data
            PaintDotNet.Effects
        C:\Program Files\paint.net\PaintDotNet.SystemLayer.Native.x64.dll
          Project file item includes which caused reference "C:\Program Files\paint.net\PaintDotNet.SystemLayer.Native.x64.dll".
            PaintDotNet.Core
            PaintDotNet.Data
            PaintDotNet.Effects    myVS22TemplateEffect    C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets    2304    
Warning    MSB3277    Found conflicts between different versions of "WindowsBase" that could not be resolved.
There was a conflict between "WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" and "WindowsBase, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35".
    "WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" was chosen because it was primary and "WindowsBase, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" was not.
    References which depend on "WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" [C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\6.0.1\ref\net6.0\WindowsBase.dll].
        C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\6.0.1\ref\net6.0\WindowsBase.dll
          Project file item includes which caused reference "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\6.0.1\ref\net6.0\WindowsBase.dll".
            C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\6.0.1\ref/net6.0/WindowsBase.dll
    References which depend on "WindowsBase, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" [].
        C:\Program Files\paint.net\PaintDotNet.Base.dll
          Project file item includes which caused reference "C:\Program Files\paint.net\PaintDotNet.Base.dll".
            PaintDotNet.Base
            PaintDotNet.Core
            PaintDotNet.Data
            PaintDotNet.Effects
        C:\Program Files\paint.net\PaintDotNet.Core.dll
          Project file item includes which caused reference "C:\Program Files\paint.net\PaintDotNet.Core.dll".
            PaintDotNet.Core
            PaintDotNet.Data
            PaintDotNet.Effects
        C:\Program Files\paint.net\PaintDotNet.SystemLayer.dll
          Project file item includes which caused reference "C:\Program Files\paint.net\PaintDotNet.SystemLayer.dll".
            PaintDotNet.Core
            PaintDotNet.Data
            PaintDotNet.Effects
        C:\Program Files\paint.net\PaintDotNet.Framework.dll
          Project file item includes which caused reference "C:\Program Files\paint.net\PaintDotNet.Framework.dll".
            PaintDotNet.Data
            PaintDotNet.Effects
        C:\Program Files\paint.net\PaintDotNet.SystemLayer.Native.x64.dll
          Project file item includes which caused reference "C:\Program Files\paint.net\PaintDotNet.SystemLayer.Native.x64.dll".
            PaintDotNet.Core
            PaintDotNet.Data
            PaintDotNet.Effects    myVS22TemplateEffect    C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets    2304    

 

 

 

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

 

PdnForumSig2.jpg

Link to comment
Share on other sites

I think I've solved that by closing Visual Studio, nuking the bin and obj folders, and then reopening VS.

 

It initially gets very confused when you migrate from .NET Framework to .NET 5/6.

  • You're a Smart Cookie! 1

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

Many thanks for your input Rick, unfortunately that didn't work for me.☹️

 

With VS22 closed I deleted the 'bin' and 'obj' folders, then restarted VS22 via the .sln file. Saved all, tried 'clean solution' then selected 'build'. It builds but I'm still getting the same error warning?

 

Please excuse my ignorance:
1. What actually is "WindowsBase"? - does it convert C# to IL or IL to machine code or both or neither?
2. C:\Program Files\dotnet\packs\MicrosoftNETcore.App.Ref\6.0.1\ref\net6.0\WindowsBase.dll is there.
Where is it getting "WindowsBase, Version=4.0.0.0" from? Is this part of the O.S. as I cannot see it as an installed package?
I'm running windows 10 Home 21H2 (OS build 19044.1469) (originally windows 8.1) and cannot update to windows 11.
3. Is there something in the Codelab generated project that references version 4 that can be edited?
4. Would it be practical to somehow unistall WindowsBase, version=4.0.0.0, if I can find it? (screenshot below)
5. What are the consequences of ignoring the warning? - will effects always be built with an obsolete version of dotnet?

 

Sorry for being a 'pain' but I really don't want to search for some dodgy version of Pdn 4.2.16 just to alter some of my effects using VS19!🙄
... Or is the warning irrelevant for me as I'm unlikely to need the latest dotnet C# features?

 

Would uninstalling any of these help?

DotNetStuffInstalled26_01_22.png

 

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

 

PdnForumSig2.jpg

Link to comment
Share on other sites

These are harmless warnings. VS 2022 shows WindowsBase's Assembly Version as 4.0.0.0 while all others are 6.0.0.0 for some reason.

 

1PlKZaR.png

Do not edit any .targets file manually. Also it won't help uninstalling any of these SDK's for this situation, but you can certainly remove the ones that you don't use.

 

There are a few methods I could find that works if you don't want to see the warning.

 

Method 1:  Suppressing (I prefer this method, but it'll suppress all MSB3277 warnings, not just for the WindowsBase one.)

Project Properties->Build->Error and warnings->Suppress specific warnings

Enter MSB3277 in text field and done.

 

Method 2: Reference Path Hinting

Edit .csproj file manually and add this reference next to others. This just hints the path to compiler to help resolving them correctly. This DOES NOT make your plugin dependant on WindowsBase. Maybe CodeLab could add this to generated project file? Not sure if this would have unwanted side effects because it's hinting path for non-ref version of WindowsBase assembly @toe_head2001

<Reference Include="WindowsBase">
    <HintPath>C:\Program Files\paint.net\WindowsBase.dll</HintPath>
</Reference>

 

Edited by otuncelli
  • Thanks 1
Link to comment
Share on other sites

You definitely shouldn't use Method 2 for WindowsBase, and Method 1 is just a band-aid that you really shouldn't use either.

 

WindowsBase is part of WPF. You should look at your csproj to see if you have any references to it. You can remove them -- it's already included if you have <UseWPF>true</UseWPF>, e.g.

 

image.png

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

16 minutes ago, Rick Brewster said:

You definitely shouldn't use Method 2 for WindowsBase, and Method 1 is just a band-aid that you really shouldn't use either.

 

WindowsBase is part of WPF. You should look at your csproj to see if you have any references to it. You can remove them -- it's already included if you have <UseWPF>true</UseWPF>, e.g.

 

image.png

 

<Reference Include="WindowsBase" Condition="'$(UseWPF)' != 'true'">
	<HintPath>C:\Program Files\paint.net\WindowsBase.dll</HintPath>
</Reference>

This is just a hint for resolving WindowsBase at compile-time, doesn't make plugin dependant on WindowsBase if it doesn't use WPF e.g.

Edited by otuncelli
Link to comment
Share on other sites

2 hours ago, otuncelli said:

These are harmless warnings. VS 2022 shows WindowsBase's Assembly Version as 4.0.0.0 while all others are 6.0.0.0 for some reason.

 

Thank you! - I'll just ignore the warning.

 

@Rick BrewsterI assume the .csproj file is created by codelab and I don't see any reference to WPF or WindowsBase ?

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net6.0-windows</TargetFramework>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
    <UseWindowsForms>true</UseWindowsForms>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
    <RootNamespace>myVS22TemplateEffect</RootNamespace>
    <AssemblyName>myVS22Template</AssemblyName>
    <Deterministic>false</Deterministic>
  </PropertyGroup>

  <ItemGroup>
    <EmbeddedResource Include="myVS22Template.png" />
    <EmbeddedResource Include="myVS22Template.sample.png" />
  </ItemGroup>

  <ItemGroup>
    <Reference Include="PaintDotNet.Base">
      <HintPath>C:\Program Files\paint.net\PaintDotNet.Base.dll</HintPath>
    </Reference>
    <Reference Include="PaintDotNet.Core">
      <HintPath>C:\Program Files\paint.net\PaintDotNet.Core.dll</HintPath>
    </Reference>
    <Reference Include="PaintDotNet.Data">
      <HintPath>C:\Program Files\paint.net\PaintDotNet.Data.dll</HintPath>
    </Reference>
    <Reference Include="PaintDotNet.Effects">
      <HintPath>C:\Program Files\paint.net\PaintDotNet.Effects.dll</HintPath>
    </Reference>
  </ItemGroup>

  <Target Name="PostBuild" AfterTargets="PostBuildEvent">
    <Exec Command="cmd /c explorer &quot;$(TargetDir)&quot;&#xD;&#xA;exit 0" />
  </Target>
</Project>

Thank you both for your help!

 

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

 

PdnForumSig2.jpg

Link to comment
Share on other sites

20 hours ago, Red ochre said:

References which depend on "WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" [C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\6.0.1\ref\net6.0\WindowsBase.dll].

 

I blame Microsoft for this.

Why does WindowsBase v6.0 have a dependency on WindowsBase v4.0 ?

¯\_(ツ)_/¯

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

1 hour ago, toe_head2001 said:

Why does WindowsBase v6.0 have a dependency on WindowsBase v4.0 ?

¯\_(ツ)_/¯

 

It doesn't ... something else in the assembly binding or build system is confused

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

6 minutes ago, Rick Brewster said:

Try adding ImportWindowsDesktopTargets and UseWPF (see my screenshot above) and see if that helps

 

That fixed the issue for me.

PdnSig.png

Plugin Pack | PSFilterPdn | Content Aware Fill | G'MICPaint Shop Pro Filetype | RAW Filetype | WebP Filetype

The small increase in performance you get coding in C++ over C# is hardly enough to offset the headache of coding in the C++ language. ~BoltBait

 

Link to comment
Share on other sites

41 minutes ago, Rick Brewster said:

Try adding ImportWindowsDesktopTargets and UseWPF (see my screenshot above) and see if that helps

 

This solves, yes. But it sounds a bit misleading to me since it tells me the project is actually using WPF with all of its glory (Presentation*.dlls, e.g.). Not exactly true, and seems a bit overkill for suppressing a warning. But Method #3 it is :) 

Edited by otuncelli
Link to comment
Share on other sites

  • 2 weeks later...

Pre and post-build events

 

In VS 2019 I could set these using the project's properties to use @null54's code to copy the newly built .dll into the Effects folder (provided VS was run as Admin).

 

I notice the VS 2019 ".csproj" shows this as

 <PropertyGroup>
    <PostBuildEvent>copy "$(TargetPath)" "C:\Program Files\paint.net\Effects" /y
if "$(ConfigurationName)" == "Debug" copy "$(TargetDir)$(TargetName).pdb" "C:\Program Files\paint.net\Effects" /y</PostBuildEvent>
  </PropertyGroup>
  <PropertyGroup>
    <PreBuildEvent>del "C:\Program Files\paint.net\Effects\$(TargetName).pdb"</PreBuildEvent>
  </PropertyGroup>

But the VS2022 ".csproj" already contains

 <Target Name="PostBuild" AfterTargets="PostBuildEvent">
    <Exec Command="cmd /c explorer &quot;$(TargetDir)&quot;&#xD;&#xA;exit 0" />
  </Target>

Simply adding the VS19 code to the VS22 .cspoj fails to build. (paint.net was not running and VS22 was at Admin level)

 

Does anyone know the correct way to add these commands in VS22 ? - Should it be incorporated into the <Target.../Target> block.
If so how exactly?... I can be very dense sometimes!🙄

 

Many thanks in advance.
(I can manually copy over the .dll from debug to Effects but found the previous VS19 way very convenient for quickly testing effects.)

 

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

 

PdnForumSig2.jpg

Link to comment
Share on other sites

3 minutes ago, Red ochre said:

Does anyone know the correct way to add these commands in VS22 ?

 

The equivalent post-build commands in VS22 are:

 

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
  <Exec Command="copy &quot;$(TargetPath)&quot; &quot;C:\Program Files\Paint.NET\Effects&quot; /y" />
  <Exec Condition="$(ConfigurationName) == Debug" Command="copy &quot;$(TargetDir)$(TargetName).pdb&quot; &quot;C:\Program Files\Paint.NET\Effects&quot; /y" />
</Target>

 

  • Like 1
  • Thanks 1
  • Upvote 1

PdnSig.png

Plugin Pack | PSFilterPdn | Content Aware Fill | G'MICPaint Shop Pro Filetype | RAW Filetype | WebP Filetype

The small increase in performance you get coding in C++ over C# is hardly enough to offset the headache of coding in the C++ language. ~BoltBait

 

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.

×
×
  • Create New...