Jump to content

Project Templates for Visual Studio


Recommended Posts

Note: These templates are ancient and no longer available.

 

 

These are Project Templates for Visual Studio.

 

Note: Most plugin development can be done with CodeLab, and it remains the recommend solution.  These templates are for people that know they need them.

 

 

The templates allow for these six Paint.NET plugin types.

  • PropertyBasedEffect
  • Effect<TToken>
  • Effect
  • PropertyBasedFileType
  • FileType<TToken, TWidget>
  • FileType

 

 

You can install them with this VSIX package:

https://marketplace.visualstudio.com/items?itemName=toehead2001.PdnVsTemples

 

 

pdnTemplates.png

 

 

Contributions are welcomed. The source code is here:

https://github.com/toehead2001/pdn-project-templates-for-vs

 

Edited by toe_head2001
  • Upvote 4

(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

Should the FileType templates provide a working example?

 

The PropertyBasedFileType template currently has OnLoad return null, which will cause paint.net to show an error dialog.

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

Awesome idea!  I remember trying to work with EER via PM to get the template to work in VS and had heck of a time doing that.  Hopefully this will overcome the issue beginner and experienced coders may have with utilizing VS to code effects or file plug-ins for PDN.

Link to comment
Share on other sites

I found the motivation to work on this again tonight.

null54 extended the PropertyBasedFileType into a working file type, and I implemented FileType<TTokin, TWidget> & FileType based on his work.

 

See the first post for an updated VSIX package.

I really need some plugin authors to test these out.

 

Once they're polished up, I'd like to publish the package on the Visual Studio Marketplace.  The Marketplace makes it easy to find, install, and update VSIX packages.

(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

You just double click on the .vsix file, and it will install the templates into Visual Studio.

 

I don't think I bothered with marking it as compatibility with VS 2017, but support can easily be added. Why are you not using 2019?

 

Surely the screenshot in the first post is sufficient. There's not much else to show. Although, yes, it does look different in 2017 compared to 2019. Just create a new project in VS, and select one of the listed Paint.NET templates.

(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

Spoiler

22.12.2019 21:01:06 - -------------------------------------------
22.12.2019 21:01:06 - Microsoft VSIX Installer
22.12.2019 21:01:06 - -------------------------------------------
22.12.2019 21:01:06 - Initializing Install...
22.12.2019 21:01:06 - Extension Details...
22.12.2019 21:01:06 -     Identifier         : PaintDotNETPluginTemplates.b60ff1b7-9432-4d62-b199-6bf5e2914636
22.12.2019 21:01:06 -     Name               : Paint.NET Plugin Templates
22.12.2019 21:01:06 -     Author             : toe_head2001
22.12.2019 21:01:06 -     Version            : 0.0.3
22.12.2019 21:01:06 -     Description        : Project Templates for creating Paint.NET plugins.
22.12.2019 21:01:06 -     Locale             : en-US
22.12.2019 21:01:06 -     MoreInfoURL        : 
22.12.2019 21:01:06 -     InstalledByMSI     : False
22.12.2019 21:01:06 -     SupportedFrameworkVersionRange : [4.5,)
22.12.2019 21:01:06 - 
22.12.2019 21:01:06 -     SignatureState     : Unsigned
22.12.2019 21:01:06 -     Supported Products : 
22.12.2019 21:01:06 -         Microsoft.VisualStudio.Community
22.12.2019 21:01:06 -             Version : [16.0,17.0)
22.12.2019 21:01:06 - 
22.12.2019 21:01:06 -     References         : 
22.12.2019 21:01:06 -     Prerequisites      : 
22.12.2019 21:01:06 -         -------------------------------------------------------
22.12.2019 21:01:06 -         Identifier   : Microsoft.VisualStudio.Component.CoreEditor
22.12.2019 21:01:06 -         Name         : Visual Studio core editor
22.12.2019 21:01:06 -         Version      : [16.0,17.0)
22.12.2019 21:01:06 - 
22.12.2019 21:01:06 -         -------------------------------------------------------
22.12.2019 21:01:06 -         Identifier   : Microsoft.Net.Component.4.7.2.SDK
22.12.2019 21:01:06 -         Name         : .NET Framework 4.7.2 SDK
22.12.2019 21:01:06 -         Version      : [16.3.29230.54,17.0)
22.12.2019 21:01:06 - 
22.12.2019 21:01:06 - Signature Details...
22.12.2019 21:01:06 -     Extension is not signed.
22.12.2019 21:01:06 - 
22.12.2019 21:01:06 - Searching for applicable products...
22.12.2019 21:01:06 - Found installed product - Global Location
22.12.2019 21:01:06 - Found installed product - Visual Studio Community 2017
22.12.2019 21:01:06 - VSIXInstaller.NoApplicableSKUsException: This extension is not installable on any currently installed products.
   at VSIXInstaller.ExtensionService.GetInstallableData(String vsixPath, String extensionPackParentName, Boolean isRepairSupported, IStateData stateData, IEnumerable`1& skuData)
   at VSIXInstaller.ExtensionPackService.IsExtensionPack(IStateData stateData, Boolean isRepairSupported)
   at VSIXInstaller.ExtensionPackService.ExpandExtensionPackToInstall(IStateData stateData, Boolean isRepairSupported)
   at VSIXInstaller.App.Initialize(Boolean isRepairSupported)
   at VSIXInstaller.App.Initialize()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)

 

Link to comment
Share on other sites

@NSD , I've updated the VSIX package, so you should now be able to install it into VS 2017.

Since you're one of the few people using 2017, let me know if you have any issues. I have done almost zero testing with 2017.

(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

Thanks @toe_head2001. The installation was successful.
I was curious to see if the issue by resizing the Form was fixed, but unfortunately it is the same as the template provided by EER. Only manual input of width and height works.
If you try to drag the corner of the Form to resize using the mouse, it flew off into outer space. Same discussion here:
 

 

Link to comment
Share on other sites

34 minutes ago, NSD said:

I was curious to see if the issue by resizing the Form was fixed, but unfortunately it is the same as the template provided by EER

 

That's not a template bug, but rather a bug with the Windows Forms Designer within Visual Studio.

 

Future versions of the WinForms Designer will be (technically, already are) open source with .NET Core, so hopefully that bug can be fixed.

(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

That just means something in EffectConfigDialog exposes the bug in the WinForms Designer.

 

Feel free to investigate a work around, and let us know if you find something.

(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

  • 4 months later...

What's the trick in getting it to install to VS 2019? I'm only getting an option for 2017...

 

image.png

 

EDIT: Nevermind. I went ahead with the 2017 install and the templates appear in 2019 too.

 

Cheers Toe_Head!

Link to comment
Share on other sites

  • 3 months later...

Hello toe_head2001,

 

I have installed these templates into VS19 successfully (thank you).


However I've run into a problem after creating a project using the Effect<TToken> template.
My copy of Pdn is in C:\Program Files\NEWpdn\ so I had to add missing references.
I built the project successfully, opened Pdn and found the new effect (custom U.I. with slider), however when selecting "ConfigDialog.cs[Design]" in VS19 it shows this error:

 

"The designer must create an instance of type 'PaintDotNet.Effects.EffectConfigDialog`2[[MyCustomUIEffect1.MyCustomUIEffect1Plugin, MyCustomUIEffect1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[MyCustomUIEffect1.MyCustomUIEffect1ConfigToken, MyCustomUIEffect1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' but it cannot because the type is declared as abstract."    
 


 I'm lost! Any ideas on how to correct this would be appreciated.
-----------------------------------------------------------------

 

Suggestion:
Can Build Events be added to the template? (from Null54's example in the old template thread). Great time saver if you remember to close Pdn before building.

 

 Pre-build [del "C:\Program Files\NEWpdn\Effects\$(TargetName).pdb"]
 Post-build
[copy "$(TargetPath)" "C:\Program Files\NEWpdn\Effects" /y
if "$(ConfigurationName)" == "Debug" copy "$(TargetDir)$(TargetName).pdb" "C:\Program Files\NEWpdn\Effects" /y]
 
(NB. 'NEWpdn' would be replaced with the default location of Paint.net for the template.)

 

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

 

PdnForumSig2.jpg

Link to comment
Share on other sites

9 minutes ago, Red ochre said:

However I've run into a problem after creating a project using the Effect<TToken> template  ...  when selecting "ConfigDialog.cs[Design]" in VS19 it shows this error:

 

The WinForms designer doesn't work with Generic types. There are a few explanations for this on stackoverflow, if you're inclined to look them up.

 

You have to derive from the non-generic Effect type, if you want to use the WinForms designer.

(you can technically have multiple levels of derivation to work around the issue, but that's a bit of a kludge)

 

16 minutes ago, Red ochre said:

Can Build Events be added to the template?

 

I thought I had added that to the templates... guess not.

Feel free to submit a pull request on GitHub.

  • Like 1

(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

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...