How do I add a new Razor Page Template to Visual Studio in ASP.NET Core 2.1? - templates

I've got the Templates folder in my project hierarchy, and I've been modifying those pretty heavily to speed up my scaffolding workflow.
However, some of the objects in my database must persist forever. So, since they can't be deleted, they have a boolean activation state.
As such, I'd like to add two new actions to the CRUD workflow, Deactivate and Reactivate. I added the relevant templates to the Project\Templates\RazorPageGenerator folder, but when I click to add a new Razor Page, it still only shows the standard CRUD options.
I'm not sure where I need to register the new templates for them to be usable in the scaffolding operations...?

This is what I normally do and works all the time:
Right click the folder => Select Add > New File => Select Razor Page and modify the "Name" section to match my controller method name.
If it doesn't work for you, how about creating files "Deactivate.cshtml" and "Reactivate.cshtml" using normal means (Finder in MacOS, Window Explorer in Windows, or command prompt), copy them to your Project\Templates\RazorPageGenerator folder, and add them to your project by right click the folder in VS2017 => Select Add > Add Files from Folder

In .csprog change Project Sdk From Microsoft.NET.Sdk To Microsoft.NET.Sdk.Web

Related

Unable to expose existing control on a new project form

TFS 2017 on-premise Version 15.117.27024.0
I have a custom Work Item field which exists as a global field, and has been added to work item templates in other projects on the same instance without issue. I've added the custom field to the User Story template for a new TFS Project (which uses the same TFS project template as other projects), and added it to the layout under the 'Value Area' control. Whatever I try, I cannot get the field to show in the web UI of TFS, but when I preview form using the Visual Studio Process Editor add-in, the field shows.
I've tried moving the control into another group, a different column, re-ordering the controls in the column, cleared cache, tried incognito, tried another users machine who has access to the same project. When the other user edits the template, he can see my new field in the template editor.
Exported the XML for the WIT using witadmin, and the elements are there as expected as a Field and as a control in the correct group & column.
In TFS 2017 and higher versions the fields should be exist also in the <WebLayout> to be displaying in the TFS web interface.
In your case the field exist only in the <Layout> so you can see him only in Visual Studio.

How to add custom menu in Sitecore menu list

i want to add my custom application name in Sitecore Start Menu List, i'm following this article :
Adding Application Shortcut
it saying use Core database i'm using this, i couldn't find Layout studio, can any sitecore developer suggest me how to find this and finish my job. Thanks in advance.
I think the instructions you've linked to there are out of date. I've not seen that bit of UI in recent releases of Sitecore.
Working in Sitecore 6.6 I've successfully made custom applications using these instructions:
http://sdn.sitecore.net/Articles/Customizing%20Sitecore%20Client/Adding%20an%20Application%20Shortcut/Creating%20an%20Application.aspx
But beware the issue that I've blogged about here. The recent revisions of Sitecore subtly break the configuration defined above, and you have to manually edit out a file extension to make everything work:
https://jermdavis.wordpress.com/2014/10/20/a-gotcha-with-custom-applications/
-- Edited to add --
Based on the "it doesn't work in 7.5" comment below, I've tried these instructions on a test instance of Sitecore 7.5 rev 141003. It seems 7.5 behaves slightly differently - but I can still make it work.
Create the item under /sitecore/content/Applications using the external link button for the "Application" field. With raw values displayed, it should look something like:
And then create your application shortcut under /sitecore/content/Documents and settings/All users/Start menu using an internal link for the Application field. I found this still added the '.aspx' extension mentioned in my blog post, but I also found that editing it out again didn't work - it reappeared as soon as I hit save. I needed to edit out the extension from the link data using the Raw Values view in order to get the data shown below:
With those things set up, refreshing the page caused the test item to appear on my start menu:
Hopefully that works for you too?
-- Further edited to add --
New blog post covering this problem in Sitecore 7.5:
https://jermdavis.wordpress.com/2015/01/19/gotchas-with-custom-apps-v2/
Which version of Sitecore are you using? The Layout Studio is probably one of the least features in Sitecore, and personally not something I have ever used.
Instead you should create the the layout in Visual Studio - which then means your layout can be added to your Source Control System. Then follow the instructions in the link in Jeremy's answer.
If you do need to access the Layout Studio for some reason you can find it under: Sitecore menu > Development Tools > Developer Center. From there you can create new files/open existing files.

Is there any way to change Sitecore Rocks Sub layout template structure (VS 2013)?

When I create new item -> sub layout it will create web user control. I need change the template structure of web user control's code behind file (using should come outside of namespace) when it creating.
The default templates for the Sitecore Items is in the following folder:
C:\Users\<username>\AppData\Local\Microsoft\VisualStudio\12.0\Extensions\<install-id>\ItemTemplates\Sitecore
Extract Sublayouts.zip file from Sublayouts folder, move the using statement to outside the namespace in Sublayout.ascx.cs and re-pack the zip file. Restart Visual Studio and the changes should take effect.

Which .XML file are using for Insert Link button of General Link field in Sitecore 7.2

Can anybody tell me which .xml file are using for Insert Link button of General Link field in Sitecore 7.2.
I have tried to update below files but all are not affecting -
Sitecore.Shell.Application.Dialogs.InternalLink-InternalLink.xml
Sitecore.Shell.Application.Dialogs.InsertLink-InsertLink.xml
Sitecore.Shell.Application.Buckets - BucketInternalLink.xml
Sitecore.Shell.Application.Buckets - InsertLink.xml
I think under Buckets folder files are using in case of General Link field with Search
I have tried for all
If I am updating other files like
Sitecore.Shell.Application.Dialogs.ExternalLink - ExternalLink.xml
then it's showing updates in Sitecore but in case of insert link no one files are working.
Thanks in advance
check out my blogpost about fixing the internal link. It might prove difficult to extend but it is possible. At least I have been able to override the class and pass the preLoadPath.
http://reinoudvandalen.nl/blog/fixing-sitecore-7-internal-link-with-speak/
In Sitecore 7.2 the XML Insert Link Dialog is replaced by the new SPEAK UI Dialog. The actual url of the insert link dialog is located on
http://[yourdomain]/sitecore/client/applications/dialogs/InsertLinkViaTreeDialog
The actual file is located in the core database under: /sitecore/client/Applications/Dialogs/InsertLinkViaTreeDialog.
From there you can navigate to the appropriate renderings and modify them (which might affect other windows.
If you want to enable the old style InsertLink that uses the InsertLink.xml you can disable it from /App_Config/Include/Sitecore.Speak.config and remove the following line:
<override dialogUrl="/sitecore/shell/Applications/Dialogs/Internal%20link.aspx" with="/sitecore/client/applications/dialogs/InsertLinkViaTreeDialog" />

Is there a standard directory browser dialogue in MFC that doesn't involve the user creating directories to specify ones that don't yet exist?

I am working on the bootstrap application of an installer, and I have a dialogue that the user can open to select a different target directory from the given default. Currently, I'm using the CFolderDialog for that, but for the user to select a folder that doesn't yet exist, he has to create the folder first. Once the user has specified the directory, I want to be able to delete it so that, when I launch the installer, it can create the folder itself such that it gets flagged for uninstall. Also, if the user cancels out of my bootstrap application at any time, I don't want any unwanted folders lying around from when the user mucked around in the folder browser. The problem that I'm having is that, if I try to remove the folder that the user created while browsing for a new target folder, I get a sharing violation error. (I compare the directory's creation time with what the system time was at the time the dialogue was launched to make sure that it's OK for me to delete the directory.)
What I need is either a way to get around that sharing violation or another standard dialogue that doesn't involve the user having to create a new directory in order to specify it just because it doesn't yet exist.
Edit: When I originally posted this, I forgot that the folder dialogue that I'm using is actually the XFolder Dialog on the Code Project site. While it does let the user browse for a directory, it's not as intuitive as folder browser dialogues that I've seen in installers in the past. What I'd really want is something where the user can browse to the folder in which their new folder is to go and then simply append the new folder to the path in the dialogue's edit box without having to create the new folder.
Update As the XFolder dialogue is a customization of the standard Open File dialogue which uses a template, it does not work on Vista or newer OSs. Because of this, I must abandon use of this for something else. I'm still looking for a solution here. If someone can show me how to set the initial directory (as opposed to the root directory) when using SHBrowseForFolder(), I'd be willing to use that as my solution.
For your purpose, it would probably make sense to let the user select a base directory, e.g. "C:\Program Files" (creating one in the process if so desired) and install into a subdirectory of that (a name which you append to the selected path and let your installer create). Display the combined path after the user has selected the base. This way, the user doesn't feel like he has taken on responsibility for the directory you're creating, but still has a reasonable level of control over the destination.
I have never seen such a dialog window, neither in MFC nor in any other technology. I agree with Shog9, you should provide the user with a way to separate the selection of a base directory and the creation of directories.
You can use SHBrowseForFolder without specifying neither BIF_BROWSEINCLUDEFILES or BIF_NONEWFOLDERBUTTON.