Item Template for VSTemplate file - templates

I'm trying to create VS Item Template that will allow adding .vstemplate files to project.
This is how my vsTemplate.vstemplate file currently looks:
<?xml version="1.0" encoding="utf-8"?>
<VSTemplate
xmlns:sdk="http://schemas.microsoft.com/developer/vstemplate-sdkextension/2010"
xmlns="http://schemas.microsoft.com/developer/vstemplate/2005"
Version="3.0.0"
Type="Item">
<TemplateData>
<Name>VS Item Template</Name>
<Icon>vsTemplate.ico</Icon>
<Description>VS Item Template Files</Description>
<DefaultName>vsTemplate</DefaultName>
<ProjectType>CSharp</ProjectType>
<TemplateID>Microsoft.CSharp.Class</TemplateID>
<CreateInPlace>true</CreateInPlace>
</TemplateData>
<TemplateContent>
<ProjectItem TargetFileName="Template\$fileinputname$.vstemplate" ReplaceParameters="true">vsTemplate.data</ProjectItem>
<ProjectItem TargetFileName="Template\$fileinputname$.$fileinputextension$.data">vsTemplate.empty.data</ProjectItem>
<ProjectItem TargetFileName="Template\$fileinputname$.ico">vsTemplate.ico.data</ProjectItem>
</TemplateContent>
</VSTemplate>
When I am trying to use it (inside vs experimental instance), I am getting this error:
The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
How I understand the problem, I need to specify custom build action for .vstemplate file inside .csproj file, something like this:
<VSTemplate Include"..."/>
But I don't know how to do that.
What I'am already tried:
set ItemType="VSTemplate" for vstemplate ProjectItem
use custom Wizard class
add /log option inside project command line argument window (it does not provide any additional information)

Related

Getting error in ANT regex "Couldn't rename temporary file C:\Users\username\AppData\Local\Temp\replace7877977241325466040.txt"

In ANT, I am trying to replace a file's property using regex by using the below script:
<property file="MyFilePath/MyFileName1.properties" />
<replaceregexp file="MyFilePath/MyFileName2.properties"
match="#{ComparingProperties}=(.*)"
replace="#{ComparingProperties}=${#{ComparingProperties}}" />
Read a content from MyFileName1 and replacing the property in MyFileName2.
While execution I am facing issue as "Couldn't rename temporary file C:\Users\username\AppData\Local\Temp\replace7877977241325466040.txt"
If I remove this regex and try, the build goes fine. In many of my scripts I used replaceregex, but this is the place I get this error newly. Any inputs would be really helpful. Thanks !

VS2017 Solution Template Structure

I have generated a VS (multi-) project template which I am having trouble trying to control the base hierarchy structure when it is used.
The template source folder/full solution has the following projects
MyTemplate.UI
MyTemplate.BusinessLogic
MyTemplate.DataModels
MyTemplate.Helpers
MyTemplate.Interfaces
MyTemplate.Services.APIConnector
MyTemplate.Services.AuthProvider_AAD
The .vstemplate file is
<VSTemplate Version="2.0.0" Type="ProjectGroup" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
<TemplateData>
<Name>IoC Template</Name>
<Description>Template with IoC/project separation</Description>
<Icon>Icon.ico</Icon>
<ProjectType>CSharp</ProjectType>
</TemplateData>
<TemplateContent>
<ProjectCollection>
<ProjectTemplateLink ProjectName="$safeprojectname$.UI" CopyParameters="true">
MyTemplate.UI\MyTemplate.vstemplate
</ProjectTemplateLink>
<ProjectTemplateLink ProjectName="$safeprojectname$.BusinessLogic" CopyParameters="true">
MyTemplate.BusinessLogic\MyTemplate.vstemplate
</ProjectTemplateLink>
<ProjectTemplateLink ProjectName="$safeprojectname$.DataModels" CopyParameters="true">
MyTemplate.DataModels\MyTemplate.vstemplate
</ProjectTemplateLink>
<ProjectTemplateLink ProjectName="$safeprojectname$.Helpers" CopyParameters="true">
MyTemplate.Helpers\MyTemplate.vstemplate
</ProjectTemplateLink>
<ProjectTemplateLink ProjectName="$safeprojectname$.Interfaces" CopyParameters="true">
MyTemplate.Interfaces\MyTemplate.vstemplate
</ProjectTemplateLink>
<SolutionFolder Name="$safeprojectname$.Services" CopyParameters="true">
<ProjectTemplateLink ProjectName="$safeprojectname$.APIConnector" CopyParameters="true">
MyTemplate.Services.APIConnector\MyTemplate.vstemplate
</ProjectTemplateLink>
<ProjectTemplateLink ProjectName="$safeprojectname$.AuthProvider_AAD" CopyParameters="true">
MyTemplate.Services.AuthProvider_AAD\MyTemplate.vstemplate
</ProjectTemplateLink>
</SolutionFolder>
</ProjectCollection>
</TemplateContent>
</VSTemplate>
Now, when then solution/project is created, everything deploys as expected, however, it always seems to insert an additional folder level from the base folder...
So, lets say I want to create a project call WidgetProject, in VS2017, File-> New -> Project, select the template and set the following
Name = WidgetProject
Location = C:\WorkProjects
Solution name = WidgetProject
Create directory for solution = ticked
What this then generates as a folder structure is
C:\MyProjects\WidgetProject\WidgetProject.sln
WidgetProject\WidgetProject.UI
WidgetProject\WidgetProject.BusinessLogic
WidgetProject\WidgetProject.BusinessLogic
WidgetProject\WidgetProject.DataModels
WidgetProject\WidgetProject.Helpers
WidgetProject\WidgetProject.Interfaces
WidgetProject\WidgetProject.Services\APIConnector
WidgetProject\WidgetProject.Services\AuthProvider_AAD
All of the project folders are an extra layer deep... I want to put them at the same folder level as the .sln file.
I am sure it is just a simple setting in the .vstemplate file, but i just cant figure it out.
TYIA
Unfortunate but when you create a new project based on your template, there is a setting "Place solution and project in the same directory" in the dialog screen.
As it looks like there is no way to control this from the template definition.
All you can do: you can write a comment into your description node of project (or project group) definition, that you are preferring that specific setting for your solution...

NoClassDefFoundError: in jenkins-test-harness-htmlunit library

I am developing test cases for one of my plugin. Below is snipped code of test case:
JenkinsRule.WebClient webClient=rule.createWebClient();
FreeStyleProject p = (FreeStyleProject) rule.jenkins.getItem("WebApp");
HtmlPage page= webClient.getPage(p,"configure");
.
I am always getting java.lang.NoClassDefFoundError: Could not initialize class com.gargoylesoftware.htmlunit.util.EncodingSniffer . I have checked dependency jenkins-test-harness-htmlunit and it has same class.
I am having below jenkins and jenkins-test-harness version in my plugin:
<properties>
<jenkins.version>2.7.3</jenkins.version>
<java.level>8</java.level>
<jenkins-test-harness.version>2.27</jenkins-test-harness.version>
</properties>
Please help me if anybody has solution for it

iTunes exported XML playlist refers to files in the wrong music structure

This is a simplified version of a question I asked at the end of last year but could not get to the bottom of it. I hope that somebody can help me with this explanation.
I exported my iTunes playlist as an XML file (songs.xml) onto an external drive. Each song exported appears to have its metadata stored under a node in the XML file. A fragment containing 2 Adele songs is below.
After exporting the playlist, I copied the music files to the /Music folder on the external drive. The issue is that ALL files are now directly in this folder and not within the subfolders. The songs.xml file references each song as being in a subfolder of /Music e.g. /Music/Adele/21 - but that is no longer the case - all files are in /Music. Thus when I attempt to import the songs back in they cannot be found.
Can somebody tell me how I can parse songs.xml and replace the /Music/Artist/Album references with just /Music ? Then I could successfully re-import my tunes with their metadata as described in the file! An added difficulty is that some songs are referenced just under the Music/Artist, and not Music/Artist/Album. e.g. the Artist could be 'Various' or a compilation.
I can get access to a Mac or Linux terminal to run SED or a RegEx or any other command that you can advise. If you can help I'd be very grateful.
Thanks a lot in advance.
Ben
<dict>
<key>Track ID</key><integer>22041</integer>
<key>Name</key><string>Rolling in the Deep</string>
<key>Artist</key><string>Adele</string>
<key>Album Artist</key><string>Adele</string>
<key>Album</key><string>21</string>
<key>Persistent ID</key><string>B123AA625019E726</string>
<key>Track Type</key><string>File</string>
<key>Purchased</key><true/>
<key>Location</key><string>file://localhost/Volumes/External%20Hard%20Drive/Music/Adele/21/RollingInTheDeep.m4a</string>
<key>File Folder Count</key><integer>1</integer>
<key>Library Folder Count</key><integer>1</integer>
</dict>
<dict>
<key>Track ID</key><integer>22042</integer>
<key>Name</key><string>Someone Like You</string>
<key>Artist</key><string>Adele</string>
<key>Album Artist</key><string>Adele</string>
<key>Album</key><string>Someone Like You</string>
<key>Persistent ID</key><string>A274ED723536E610</string>
<key>Track Type</key><string>File</string>
<key>Purchased</key><true/>
<key>Location</key><string>file://localhost/Volumes/External%20Hard%20Drive/Music/Adele/SomeoneLikeYou.mp3</string>
<key>File Folder Count</key><integer>1</integer>
<key>Library Folder Count</key><integer>1</integer>
</dict>
This awk may be what you need.
awk '/Drive\/Music/ {sub(/\/string/,":string");sub(/Music.*\//,"Music/");sub(/:string/,"/string")}1' file
It will change this type of lines:
<key>Location</key><string>file://localhost/Volumes/External%20Hard%20Drive/Music/Adele/21/RollingInTheDeep.m4a</string>
<key>Location</key><string>file://localhost/Volumes/External%20Hard%20Drive/Music/Adele/SomeoneLikeYou.mp3</string>
to
<key>Location</key><string>file://localhost/Volumes/External%20Hard%20Drive/Music/RollingInTheDeep.m4a</string>
<key>Location</key><string>file://localhost/Volumes/External%20Hard%20Drive/Music/SomeoneLikeYou.mp3</string>
How does this work:
awk '
/Drive\/Music/ { # Serch for all lines with Drive/Music lines
sub(/\/string/,":string") # Replace last / to prevent problem with greedy regex in next step
sub(/Music.*\//,"Music/") # Replace from Music to last / with only Music/ (using .* greedy)
sub(/:string/,"/string") # Replace last / back to its original
}
1 # Print all lines, changed and not changed
' file # input file
sed '/Location/ s|\(Drive/Music\)[^<]*\(/[^/<]*<\)|\1\2|' YourFile
use of | instead of traditional / for easier reading and treatment of / in path
you could also use variable instead of Drive/Music to adapt easily to another place (and use double quote around the sed action in this case

Adding Coldfusion10 dictionary to CFEclipse Plugin

I downloaded CfEclipse plugin (http://www.cfeclipse.org/update) for Eclipse 4.2.2. I can't see the support for Coldfusion 10. How to add Coldfusion 10 tags/functions?
Use the CFML 10 and CFML 11 dictionary from a CFBuilder3 install, which uses the same dictionary format. Just take the dictionary from CFBuilder3 and drop it into the CFBuilder2 dictionary folder and add the following to the "dictionaryconfig.xml" file:
<version key="ColdFusion11" label="ColdFusion 11">
<grammar location="cf11.xml" />
</version>
<version key="ColdFusion10" label="ColdFusion 10">
<grammar location="cf10.xml" />
</version>
The dictionary files are located in the "CFBuilder" plugins directory and have the word "dictionary" in the folder nameā€”for example:
E:\cfbuilder\plugins\com.adobe.ide.coldfusion.dictionary_2.0.1.282422\dictionary