diff --git a/README.md b/README.md index 7e14cae..aad0454 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,9 @@ A Visual Studio extension that assist in development and debugging of Starcounte # Build Build `src\Starcounter.VisualStudio.sln`. +# Install / uninstall locally +After building, go to `bin\[Configuration]\`. Double-click `Starcounter.VS.vsix`. + # Pack The package version is maintained in `build\version.txt`. @@ -15,8 +18,8 @@ cd pack A new package will be created in `artifacts\`. -# Pushing to nuget.org -The package version is maintained in `build\version.txt`. Make sure to increase that (and commit) before publishing a new version upstream. +# Publishing to nuget.org +The package version is maintained in `build\version.txt`. Make sure to increase that (and commit) before publishing a new version upstream. Also keep that version in sync with the VS package version in `src\Starcounter.VS.VSIX\source.extension.vsixmanifest`. The version is on the `PackageManifest\Metadata\Identity` element. ``` cd build @@ -25,10 +28,13 @@ cd pack_and_push You will need to make sure the Starcounter API key with proper access rights is available through `%StarcounterNuGetKeyFull%`, or pushing will fail. -# Install / uninstall locally -After building, go to `bin\[Configuration]\`. Double-click `Starcounter.VS.vsix`. +# Publishing on Visual Studio marketplace +1. Go to https://marketplace.visualstudio.com/items?itemName=Starcounter.StarcounterforVisualStudio +2. Choose `Edit extension` +3. Use `Upload | Change` to upload a new version. # Resources -* Home on [Visual Studio marketplace]( https://marketplace.visualstudio.com/items?itemName=Starcounter.StarcounterforVisualStudio). +* Home on [Visual Studio marketplace](https://marketplace.visualstudio.com/items?itemName=Starcounter.StarcounterforVisualStudio). * Home for package on [nuget.org](https://www.nuget.org/packages/Starcounter.VisualStudio/). - +* [Version compatibility](https://github.com/Starcounter/Starcounter.VisualStudio/wiki/Version-compatibility) +* [Development cheat sheet](https://github.com/Starcounter/Starcounter.VisualStudio/wiki/Development-cheat-sheet) diff --git a/build/Starcounter.VisualStudio.nuspec b/build/Starcounter.VisualStudio.nuspec index 96aab88..e5dba36 100644 --- a/build/Starcounter.VisualStudio.nuspec +++ b/build/Starcounter.VisualStudio.nuspec @@ -7,7 +7,7 @@ Starcounter https://github.com/Starcounter/Starcounter.VisualStudio false - Starcounter Visual Studio extension wrapped up in a NuGet package. Use this version for Starcounter versions up until, and including, 2.3.x. + Starcounter Visual Studio extension wrapped up in a NuGet package. Use this version for Starcounter versions 2.4.x and higher. Starcounter VisualStudio diff --git a/build/version.txt b/build/version.txt index a6a3a43..ee90284 100644 --- a/build/version.txt +++ b/build/version.txt @@ -1 +1 @@ -1.0.4 \ No newline at end of file +1.0.4 diff --git a/src/Starcounter.VS.CSApplicationProjectTemplate/ApplicationProjectTemplate.csproj b/src/Starcounter.VS.CSApplicationProjectTemplate/ApplicationProjectTemplate.csproj index 9a5389c..01d6757 100644 --- a/src/Starcounter.VS.CSApplicationProjectTemplate/ApplicationProjectTemplate.csproj +++ b/src/Starcounter.VS.CSApplicationProjectTemplate/ApplicationProjectTemplate.csproj @@ -48,18 +48,18 @@ 4.0 - - False - + + True + + + True + - False - - - False - + True + - False - + True + @@ -74,4 +74,4 @@ --> - + \ No newline at end of file diff --git a/src/Starcounter.VS.CSBasicApplicationProjectTemplate/Api/CommitHooks.cs b/src/Starcounter.VS.CSBasicApplicationProjectTemplate/Api/CommitHooks.cs new file mode 100644 index 0000000..f7c76d0 --- /dev/null +++ b/src/Starcounter.VS.CSBasicApplicationProjectTemplate/Api/CommitHooks.cs @@ -0,0 +1,10 @@ +namespace $safeprojectname$.Api +{ + internal static class CommitHooks + { + public static void Register() + { + + } + } +} \ No newline at end of file diff --git a/src/Starcounter.VS.CSBasicApplicationProjectTemplate/Api/MainHandlers.cs b/src/Starcounter.VS.CSBasicApplicationProjectTemplate/Api/MainHandlers.cs new file mode 100644 index 0000000..8129e47 --- /dev/null +++ b/src/Starcounter.VS.CSBasicApplicationProjectTemplate/Api/MainHandlers.cs @@ -0,0 +1,34 @@ +using $safeprojectname$.ViewModels; +using Starcounter; + +namespace $safeprojectname$.Api +{ + internal static class MainHandlers + { + public static void Register() + { + Application.Current.Use(new HtmlFromJsonProvider()); + Application.Current.Use(new PartialToStandaloneHtmlProvider()); + + Handle.GET("/$safeprojectname$", () => + { + var page = new MainPage() + { + Visitors = + { + Data = Db.SQL("SELECT g FROM GuestBookEntry g") + } + }; + + if (Session.Current == null) + { + Session.Current = new Session(SessionOptions.PatchVersioning); + } + + page.Session = Session.Current; + + return page; + }); + } + } +} \ No newline at end of file diff --git a/src/Starcounter.VS.CSBasicApplicationProjectTemplate/Api/PartialHandlers.cs b/src/Starcounter.VS.CSBasicApplicationProjectTemplate/Api/PartialHandlers.cs new file mode 100644 index 0000000..fb6afbf --- /dev/null +++ b/src/Starcounter.VS.CSBasicApplicationProjectTemplate/Api/PartialHandlers.cs @@ -0,0 +1,10 @@ +namespace $safeprojectname$.Api +{ + internal static class PartialHandlers + { + public static void Register() + { + + } + } +} \ No newline at end of file diff --git a/src/Starcounter.VS.CSBasicApplicationProjectTemplate/Database/GuestBookEntry.cs b/src/Starcounter.VS.CSBasicApplicationProjectTemplate/Database/GuestBookEntry.cs new file mode 100644 index 0000000..d97b86c --- /dev/null +++ b/src/Starcounter.VS.CSBasicApplicationProjectTemplate/Database/GuestBookEntry.cs @@ -0,0 +1,12 @@ +using System; +using Starcounter; + +namespace $safeprojectname$ +{ + [Database] + public class GuestBookEntry + { + public string VisitorName { get; set; } + public string DateVisited { get; set; } + } +} diff --git a/src/Starcounter.VS.CSBasicApplicationProjectTemplate/HelloStarcounter.csproj b/src/Starcounter.VS.CSBasicApplicationProjectTemplate/HelloStarcounter.csproj new file mode 100644 index 0000000..703cbb3 --- /dev/null +++ b/src/Starcounter.VS.CSBasicApplicationProjectTemplate/HelloStarcounter.csproj @@ -0,0 +1,97 @@ + + + + Debug + x64 + 9.0.20706 + 2.0 + {C86118D7-451E-4933-BFEE-A1EFDB162FD7};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {$guid1$} + Exe + Properties + $safeprojectname$ + $safeprojectname$ + v4.5 + 512 + false + $(MSBuildProjectDirectory) + 2.3 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + false + true + x64 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + false + false + true + x64 + + + + + 4.0 + + + + False + + + False + + + False + + + False + + + + + + + + + + + MainPage.json + + + + + + + + + + MsBuild:Compile + + + + + + + + + \ No newline at end of file diff --git a/src/Starcounter.VS.CSBasicApplicationProjectTemplate/MyTemplate.vstemplate b/src/Starcounter.VS.CSBasicApplicationProjectTemplate/MyTemplate.vstemplate new file mode 100644 index 0000000..a0777cc --- /dev/null +++ b/src/Starcounter.VS.CSBasicApplicationProjectTemplate/MyTemplate.vstemplate @@ -0,0 +1,46 @@ + + + Basic Starcounter Application + A basic Starcounter project for creating a C# application that executes inside Starcounter + CSharp + + + 1000 + true + StarcounterApplication + true + Enabled + true + __TemplateIcon.ico + + + + + CommitHooks.cs + MainHandlers.cs + PartialHandlers.cs + + + GuestBookEntry.cs + + + Program.cs + + AssemblyInfo.cs + + + MainPage.json + MainPage.json.cs + + + + + + + MainPage.html + + + + + + \ No newline at end of file diff --git a/src/Starcounter.VS.CSBasicApplicationProjectTemplate/Program.cs b/src/Starcounter.VS.CSBasicApplicationProjectTemplate/Program.cs new file mode 100644 index 0000000..17cac60 --- /dev/null +++ b/src/Starcounter.VS.CSBasicApplicationProjectTemplate/Program.cs @@ -0,0 +1,16 @@ +using System; +using $safeprojectname$.Api; +using Starcounter; + +namespace $safeprojectname$ +{ + internal class Program + { + private static void Main() + { + MainHandlers.Register(); + CommitHooks.Register(); + PartialHandlers.Register(); + } + } +} \ No newline at end of file diff --git a/src/Starcounter.VS.CSBasicApplicationProjectTemplate/Properties/AssemblyInfo.cs b/src/Starcounter.VS.CSBasicApplicationProjectTemplate/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..9fce633 --- /dev/null +++ b/src/Starcounter.VS.CSBasicApplicationProjectTemplate/Properties/AssemblyInfo.cs @@ -0,0 +1,42 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Starcounter.Internal; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("$safeprojectname$")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("$safeprojectname$")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("526edd06-b4f0-469f-a4d4-e95b3c94f5ac")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] + +// Assures the current assembly has a reference to the Starcounter +// assembly. A reference to Starcounter is currently required for +// Starcounter to detect that an assembly should be hosted. +[assembly: StarcounterAssembly()] diff --git a/src/Starcounter.VS.CSBasicApplicationProjectTemplate/ViewModels/MainPage.json b/src/Starcounter.VS.CSBasicApplicationProjectTemplate/ViewModels/MainPage.json new file mode 100644 index 0000000..96453b7 --- /dev/null +++ b/src/Starcounter.VS.CSBasicApplicationProjectTemplate/ViewModels/MainPage.json @@ -0,0 +1,11 @@ +{ + "Html": "/$safeprojectname$/viewmodels/MainPage.html", + "Visitors": [ + { + "VisitorName": "", + "DateVisited": "" + } + ], + "NewName$": "", + "AddVisitorTrigger$": 0 +} diff --git a/src/Starcounter.VS.CSBasicApplicationProjectTemplate/ViewModels/MainPage.json.cs b/src/Starcounter.VS.CSBasicApplicationProjectTemplate/ViewModels/MainPage.json.cs new file mode 100644 index 0000000..b4f9f41 --- /dev/null +++ b/src/Starcounter.VS.CSBasicApplicationProjectTemplate/ViewModels/MainPage.json.cs @@ -0,0 +1,31 @@ +using System; +using Starcounter; + +namespace $safeprojectname$.ViewModels +{ + partial class MainPage : Json + { + void Handle(Input.AddVisitorTrigger action) + { + if (string.IsNullOrEmpty(this.NewName)) + return; + + Db.Transact(() => + { + new GuestBookEntry + { + VisitorName = this.NewName, + DateVisited = DateTime.Now.ToString("yyyy-MM-dd HH:mm") + }; + }); + + this.Visitors.Add(new VisitorsElementJson + { + VisitorName = this.NewName, + DateVisited = DateTime.Now.ToString("yyyy-MM-dd HH:mm") + }); + + this.NewName = ""; + } + } +} diff --git a/src/Starcounter.VS.CSBasicApplicationProjectTemplate/__TemplateIcon.ico b/src/Starcounter.VS.CSBasicApplicationProjectTemplate/__TemplateIcon.ico new file mode 100644 index 0000000..15e90c1 Binary files /dev/null and b/src/Starcounter.VS.CSBasicApplicationProjectTemplate/__TemplateIcon.ico differ diff --git a/src/Starcounter.VS.CSBasicApplicationProjectTemplate/wwwroot/HelloStarcounter/viewmodels/MainPage.html b/src/Starcounter.VS.CSBasicApplicationProjectTemplate/wwwroot/HelloStarcounter/viewmodels/MainPage.html new file mode 100644 index 0000000..c92f7d2 --- /dev/null +++ b/src/Starcounter.VS.CSBasicApplicationProjectTemplate/wwwroot/HelloStarcounter/viewmodels/MainPage.html @@ -0,0 +1,28 @@ + + + \ No newline at end of file diff --git a/src/Starcounter.VS.CSClassLibraryProjectTemplate/ClassLibraryProjectTemplate.csproj b/src/Starcounter.VS.CSClassLibraryProjectTemplate/ClassLibraryProjectTemplate.csproj index fe5adea..86a0864 100644 --- a/src/Starcounter.VS.CSClassLibraryProjectTemplate/ClassLibraryProjectTemplate.csproj +++ b/src/Starcounter.VS.CSClassLibraryProjectTemplate/ClassLibraryProjectTemplate.csproj @@ -44,17 +44,17 @@ - False - + True + + + True + - False - - - False - + True + - False - + True + @@ -69,4 +69,4 @@ --> - + \ No newline at end of file diff --git a/src/Starcounter.VS.VSIX/source.extension.vsixmanifest b/src/Starcounter.VS.VSIX/source.extension.vsixmanifest index fa1da0b..1d07191 100644 --- a/src/Starcounter.VS.VSIX/source.extension.vsixmanifest +++ b/src/Starcounter.VS.VSIX/source.extension.vsixmanifest @@ -3,7 +3,7 @@ Starcounter for Visual Studio - A Visual Studio extension aiding developers of Starcounter applications to easily build and debug their projects. Use version 1.x of the extension for Starcounter versions up until, and including, 2.3.x. + A Visual Studio extension aiding developers of Starcounter applications to easily build and debug their projects. Use version 2.x of the extension for Starcounter versions 2.4.x and higher. https://docs.starcounter.io/guides/working-with-starcounter/visual-studio-extension/ https://docs.starcounter.io/tutorial StarcounterIcon.png