Jump to content

Project Templates for Visual Studio


Recommended Posts

When I use the "Effect" template, and I try to edit the ConfigDialog in the Windows Forms Designer, the designer behaves very upsettingly. I'm running Windows 10 and I'm using Visual Studio 2019.

 

Specifically, when I try to drag the resizing handles for the window, besides just resizing, the window jumps to God only knows where. In this screenshot, I began clicking and holding the button:

image.png.05bec0860cd7e44553d6fc49b107ac81.png

and the moment I dragged it a pixel to the right, the dialog widget jumped out of view, and I became unable to scroll the editor window far enough in any direction to see any of it. Then I tried closing and reopening the file, and now all I see is this where the dialog used to be:

image.png.d7b5d2ba7cf5220a104c04581b03c4a9.png

...and so on. In fact, changing many of the properties, through the GUI or through the editor panel in the corner of VS, causes similar distressing behavior. What I've shown you here is actually a lot worse than it was when I first noticed that there were problems: originally, resizing the dialog would only cause it to move rapidly down and to the right, but not so rapidly as to be gone in a single update like it is now.

 

At first I thought this was the fault of the Forms Designer itself, but I don't think so anymore. I started following this official tutorial to see if these problems would occur with a simpler project. When I made a new project using the built-in Windows Forms Control Library template as the tutorial told me, I encountered no such issues. Is there a problem with something in the project files? What gives?

Edited by Modus Ponens
Link to comment
Share on other sites

20 minutes ago, Modus Ponens said:

At first I thought this was the fault of the Forms Designer itself, but I don't think so anymore. I started following this official tutorial to see if these problems would occur with a simpler project. When I made a new project using the built-in Windows Forms Control Library template as the tutorial told me, I encountered no such issues. Is there a problem with something in the project files? What gives?

 

You could have saved yourself a whole lot of time, if you had just read the previous posts in this topic.

(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

On 12/23/2019 at 5:51 PM, NSD said:

I was curious to see if the issue by resizing the Form was fixed

 

On 8/20/2020 at 4:06 AM, Modus Ponens said:

and the moment I dragged it a pixel to the right, the dialog widget jumped out of view

 

This will be fixed in paint.net v4.2.14. You can install an alpha build from here:

https://forums.getpaint.net/topic/116972-paintnet-4214-alpha-build-7542/

  • Like 1
  • 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

  • 3 weeks later...

Great to see that the file types have been updated.

 

I've just been trying to compile the code with VS2017 targetting .NET 4.8. I have a couple of issues with SvgFileType.cs.

 

Firstly, the obsolete constructor. Have I fixed it correctly?

 

    public class SvgFileType : FileType
    {
        //
        // Obsolete.
        //
        //public SvgFileType()
        //    : base(
        //        "Scalable Vector Graphics",       // name
        //        FileTypeFlags.SupportsLoading,    // flags
        //        new[] {".svg", ".svgz"})          // extensions
        //{
        //}

        //
        // New and improved.
        //
        public SvgFileType()
            : base
            (
                "Scalable Vector Graphics",         // name
                new FileTypeOptions                 // options
                {
                    LoadExtensions = new string[] { ".svg", ".svgx" }
                }
            )
        {
            //this.Options.LoadExtensions = new List<string> { ".svg", ".svgx" };
            //this.Options.LoadExtensions = new string[] { ".svg", ".svgx" };
            //FileTypeOptions fto = new FileTypeOptions
            //{
            //    LoadExtensions = new List<string> { ".svg", ".svgx" }
            //};
        }

 

 

Secondly, I get 4 compile errors with SvgVisualElement.Visible being read only, e.g.:

 

Quote

Error    CS0200    Property or indexer 'SvgVisualElement.Visible' cannot be assigned to -- it is read only    SvgFileTypePlugin    C:\Users\me\Dowloads\Scalable-Vector-Graphics-Plugin-for-Paint.NET-0.3-alpha\Scalable-Vector-Graphics-Plugin-for-Paint.NET-0.3-alpha\SvgFileType\SvgFileType.cs

 

Would it be OK to comment these out. or is there a new equivalent?

Link to comment
Share on other sites

3 hours ago, Tim! said:

Firstly, the obsolete constructor. Have I fixed it correctly?

 

That looks okay to me.

 

3 hours ago, Tim! said:

Secondly, I get 4 compile errors with SvgVisualElement.Visible being read only, e.g.:

 

Would it be OK to comment these out. or is there a new equivalent?

 

You have to ask the people developing the SVG plugin.

(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 weeks later...

I just want to mention that in Project Template - Effect the slider has a minimum value equal to 0 which leads to crash due to division by zero in the following line:

CurrentPixel = (y% amount1 == 0)? ...


Also, SubmenuName is Blur although I think it should be null to be easily found by the user.

The plugin below was created just to test some things. It doesn't do anything special, it just draws lines and a circle.

The color control is based on the control in the CodeLab source code and is quite similar.

h0G6rJh.png

Here is the source code:
http://www.mediafire.com/file/9f9gz612mmmlldu/VSpdnProject.zip/file
 

  • Upvote 1
Link to comment
Share on other sites

1 hour ago, NSD said:

I just want to mention that in Project Template - Effect the slider has a minimum value equal to 0 which leads to crash due to division by zero in the following line:


CurrentPixel = (y% amount1 == 0)? ...


Also, SubmenuName is Blur although I think it should be null to be easily found by the user.

 

People aren't meant to run the example code, but if it bothers you, submit a Pull request on the Github project.

(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

  • 9 months later...

Unfortunately, these templates use the .NET Framework. The newest Paint.NET alpha (which I wish to target with my plugin, for reasons of having the newest C# 9 features) uses .NET 5. If I do what these templates do (which is target the Paint.NET DLLs, copy plugin dll to FileTypes/Effects folder at post build, then start Paint.NET as the debug action) with the new SDK csproj format as well as targeting `net5.0-windows`, it'll complain of DLL conflicts due to different versions that the plugin is using compared to Paint.NET. Do you plan on fixing these templates for .NET 5?
EDIT:
After some messing around, I did get it to compile. Although, it would be nice to have these templates updated...


New csproj format properties:

Spoiler

 

  <PropertyGroup>
    <OutputType>Library</OutputType>
    <TargetFramework>net5.0-windows</TargetFramework>
    <UseWindowsForms>true</UseWindowsForms>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
    <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
    <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
  </PropertyGroup>


Paint.NET DLL references:

Spoiler

 

  <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>
  </ItemGroup>


 
PostBuild event (new csproj format):

Spoiler

 

  <Target Name="PostBuild" AfterTargets="PostBuildEvent">
    <Exec Command="if exist &quot;$(TargetPath)&quot; (&#xD;&#xA;  copy &quot;$(TargetPath)&quot; &quot;C:\Program Files\paint.net\FileTypes\&quot;&#xD;&#xA;) else (&#xD;&#xA;  echo ERROR: Failed to copy plugin! Check if the build failed.&#xD;&#xA;  exit(1)&#xD;&#xA;)" />
  </Target>



Then add this to the end of your AssemblyInfo.cs:

Spoiler

 

[assembly: SupportedOSPlatform("windows")]


 

And finally, debugging paint.net at start debug:

Spoiler

 

image.thumb.png.39d37cbb97270a49c5dd86087d84d53c.png

Edited by xchellx
Figured out how to build plugin with .NET 5; explanation
Link to comment
Share on other sites

3 hours ago, xchellx said:

After some messing around, I did get it to compile. Although, it would be nice to have these templates updated...

 

Okay, if you've already made the effort to get it working, then go submit a pull request on Github.

Keep in mind I won't publish an update until Paint.NET v4.3 is released.

 

 

 

Existing plugin codebases can just use the try-convert tool to automatically migrate solutions/projects to .NET 5.

https://github.com/dotnet/try-convert

  • 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

  • 4 weeks later...

Configuration Manager in Visual Studio 2019?

I attempted to make the changes in the previous post to update the template for Core 5.0. No easy task. I tried editing the code with Visual Studio Code but when I opened the Project in Visual Studio it prompted me to open the Configuration Manager. Microsoft Docs describes how to activate Configuration Manager but my installation is missing the described menu entry.  "Show advanced build configurations" does not exist. I did try another approach by building the template from a new project, but when copying the code into the new project, there were too many errors generated (not because of lack of references). Seems Core 5.0 is a whole new language.

PaintNetSignature.png.6bca4e07f5d738b2436f83d0ce1b876f.png

Link to comment
Share on other sites

@AndrewDavid sounds like you keep biting off more than you can chew.

 

If you're trying to compile the template files, that will never work. The templates have a bunch of none-code within them.

What you want to build is the VSIX package.  Hint: You need the 'Visual Studio SDK' installed. You can find an option for it in the Visual Studio Installer.

 

I have no idea what you're talking about with the Configuration Manager.  Sounds like Visual Studio is just confused, because you're missing that SDK.

(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

It does say create addons and extensions (which I have no plans on doing) which is why it wasn't installed. Once installed, still no config manager.  I'll just continue downloading until I get it.

 

40 minutes ago, toe_head2001 said:

sounds like you keep biting off more than you can chew.

I have time to learn.

 

41 minutes ago, toe_head2001 said:

I have no idea what you're talking about with the Configuration Manager.

Do you see it? I may have to build it as a custom tool.

PaintNetSignature.png.6bca4e07f5d738b2436f83d0ce1b876f.png

Link to comment
Share on other sites

  • 11 months later...

@toe_head2001 I'm unable to install the extension. I'm using VS 2022 17.2.6 and have .NET Framework 4.7.2 SDK installed. Any idea if the extension needs to be updated or any components I might be missing? I was unable to find any components related to Microsoft.VisualStudio.Component.CoreEditor, so I'm assuming it's installed by default.

11-08-2022 14:46:50 - Microsoft VSIX Installer
11-08-2022 14:46:50 - -------------------------------------------
11-08-2022 14:46:50 - vsixinstaller.exe version:
11-08-2022 14:46:50 - 17.4.23-preview1
11-08-2022 14:46:50 - -------------------------------------------
11-08-2022 14:46:50 - Command line parameters:
11-08-2022 14:46:50 - C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service\VSIXInstaller.exe,C:\Users\\Downloads\PaintDotNETPluginTemplates.vsix
11-08-2022 14:46:50 - -------------------------------------------
11-08-2022 14:46:50 - Microsoft VSIX Installer
11-08-2022 14:46:50 - -------------------------------------------
11-08-2022 14:46:51 - Initializing Install...
11-08-2022 14:46:51 - Extension Details...
11-08-2022 14:46:51 - 	Identifier         : PaintDotNETPluginTemplates.b60ff1b7-9432-4d62-b199-6bf5e2914636
11-08-2022 14:46:51 - 	Name               : Paint.NET Plugin Templates
11-08-2022 14:46:51 - 	Author             : toe_head2001
11-08-2022 14:46:51 - 	Version            : 0.0.6
11-08-2022 14:46:51 - 	Description        : Project Templates for creating Paint.NET plugins.
11-08-2022 14:46:51 - 	Locale             : en-US
11-08-2022 14:46:51 - 	MoreInfoURL        : https://forums.getpaint.net/topic/115325-project-templates-for-visual-studio/
11-08-2022 14:46:51 - 	InstalledByMSI     : False
11-08-2022 14:46:51 - 	SupportedFrameworkVersionRange : [4.5,)
11-08-2022 14:46:51 - 
11-08-2022 14:46:51 - 	SignatureState     : Unsigned
11-08-2022 14:46:51 - 	Supported Products : 
11-08-2022 14:46:51 - 		Microsoft.VisualStudio.Community
11-08-2022 14:46:51 - 			Version : [15.0,17.0)
11-08-2022 14:46:51 - 			ProductArchitecture : x86
11-08-2022 14:46:51 - 
11-08-2022 14:46:51 - 	References         : 
11-08-2022 14:46:51 - 	Prerequisites      : 
11-08-2022 14:46:51 - 		-------------------------------------------------------
11-08-2022 14:46:51 - 		Identifier   : Microsoft.VisualStudio.Component.CoreEditor
11-08-2022 14:46:51 - 		Name         : Visual Studio core editor
11-08-2022 14:46:51 - 		Version      : [15.0,17.0)
11-08-2022 14:46:51 - 
11-08-2022 14:46:51 - 		-------------------------------------------------------
11-08-2022 14:46:51 - 		Identifier   : Microsoft.Net.Component.4.7.2.SDK
11-08-2022 14:46:51 - 		Name         : .NET Framework 4.7.2 SDK
11-08-2022 14:46:51 - 		Version      : [15.0,17.0)
11-08-2022 14:46:51 - 
11-08-2022 14:46:51 - Signature Details...
11-08-2022 14:46:51 - 	Extension is not signed.
11-08-2022 14:46:51 - 
11-08-2022 14:46:51 - Searching for applicable products...
11-08-2022 14:46:51 - Found installed product - Global Location
11-08-2022 14:46:51 - Found installed product - Visual Studio Community 2022
11-08-2022 14:46:51 - Found installed product - Visual Studio Community 2022 Preview
11-08-2022 14:46:51 - VSIXInstaller.NoApplicableSKUsException: This extension is not installable on any currently installed products.
   ved VSIXInstaller.ExtensionService.GetInstallableDataImpl(IInstallableExtension extension, String extensionPackParentName, Boolean isRepairSupported, IStateData stateData, IEnumerable`1& skuData)
   ved VSIXInstaller.ExtensionService.GetInstallableData(String vsixPath, String extensionPackParentName, Boolean isRepairSupported, IStateData stateData, IEnumerable`1& skuData)
   ved VSIXInstaller.ExtensionPackService.IsExtensionPack(IStateData stateData, Boolean isRepairSupported)
   ved VSIXInstaller.ExtensionPackService.ExpandExtensionPackToInstall(IStateData stateData, Boolean isRepairSupported)
   ved VSIXInstaller.App.Initialize(Boolean isRepairSupported)
   ved VSIXInstaller.App.Initialize()
   ved System.Threading.Tasks.Task`1.InnerInvoke()
   ved System.Threading.Tasks.Task.Execute()

 

Link to comment
Share on other sites

The templates were made for an older version of Paint.NET during the Visual Studio 2019 timeframe.

I would not expect them to work for current versions.

 

Are you sure you need these templates? Plugins can be created in CodeLab most of the time.

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