I am trying to fold all XAML dependents files.
<None Include=".\**\*.xaml.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<DependentUpon>.\%(RecursiveDir)%(FileName)</DependentUpon>
</None>
<None Include=".\**\*.xaml.d.ts">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<DependentUpon>.\%(RecursiveDir)%(FileName)</DependentUpon>
</None>
I was able to fold JSs but TS definitions fail
I tried to create a "temp" items collection and tried to iterate and parse paths ... no success VS didn't load the project anymore
<ToFold Include=".\**\*.xaml" />
<None Include="#(ToFold->%(RecursiveDir)%(FileName).js')" DependentUpon="#(ToFold)">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
I tried the same way in "another way" ... same way :(
<ToFold Include=".\**\*.xaml" />
<None Include="#(ToFold->%(ToFold).js')" DependentUpon="#(ToFold)">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Question
Is it possible to parse path in another way than x->%(RecursiveDir)%(FileName ?
Is it possible to fold items like *.dash.ext ? How ?
Or someone could help me achieving this ?!
NOTE
xaml.ts are auto generated and somehow auto folded
I think the issue is that:
For KYCHome.xaml.d.ts file, the value of %(FileName) is KYCHome.xaml.d rather than KYCHome.xaml. So when you use it, it will not find the KYCHome.xaml file.
So the method I can think of is to intercept the FileName, remove the .d, and then the changed value is what we need.
Solution
This is what I used:
<ItemGroup>
<None Include=".\**\*.xaml.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<DependentUpon>%(RecursiveDir)%(FileName)</DependentUpon>
</None>
<None Include=".\**\*.xaml.d.ts">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<File>$([System.String]::Copy('%(Filename)').Replace('.d', ''))</File>
<DependentUpon>%(RecursiveDir)%(File)</DependentUpon>
</None>
</ItemGroup>
Note: you should remove the .\ under DependentUpon node. Otherwise, sometimes, the DependentUpon will not work when you restart your project or unload the project.
I'm first French and I think it was a barrier for me to achieve what I wanted to do. I was saying folding items but if instead I had said nesting items I would quickly get my answer from google.
Visual Studio has a nesting items feature
I got the answer from here Path segment pattern and here is the node I added in the .filenesting.json solution file
"dependentFileProviders": {
"add": {
"addedExtension": {},
"pathSegment": {},
"fileSuffixToExtension": {
"add": {
".xaml.d.ts": [".xaml"]
}
}
}
}
Related
I would like to move this to my App.Xaml.cs. Can someone give me some suggestion how I can do this?
<Application
x:Class="Test.App"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:converters="clr-namespace:Test">
<Application.Resources>
<converters:InverseBool x:Key="InverseBool" />
<converters:ToUpper x:Key="ToUpper" />
<converters:BoolToStringStateConverter x:Key="BoolToStringStateConverter" />
<converters:AddHashToNumberConverter x:Key="AddHashToNumberConverter" />
<converters:BoolToIntRowSpanConverter x:Key="BoolToIntRowSpanConverter" />
<converters:StringToTextAligmentConverter x:Key="StringToTextAligmentConverter" />
<converters:BoolToStringTextConverter x:Key="BoolToStringTextConverter" />
<converters:BoolToStringTextForDeckSourcesConverter x:Key="BoolToStringTextForDeckSourcesConverter" />
<converters:EpochSecondsToDateStringConverter x:Key="EpochSecondsToDateStringConverter" />
<converters:IntervalToDaysConverter x:Key="IntervalToDaysConverter" />
<converters:BoolToBackgroundColorConverter x:Key="BoolToBackgroundColorConverter" />
</Application.Resources>
</Application>
Is there a way that I can add this to App.xaml.cs instead of having this in a XAML file?
Here's the steps to delete App.xaml, replace it with App.cs and add your converter resources to Application.Resources.
The resource dictionary, Application.Resources, is just a Dictionary<string, object> into which we can pass any key-value pair. So we'll pass in each IValueConverter using the name of the class and an instance of the class, e.g. Application.Current.Resources.Add(nameof(InverseBool), new InverseBool());
1. Delete App.xaml
In the Solution Explorer, right click on App.xaml
In the right-click drop-down menu, click Delete
2. Add App.cs
In the Solution Explorer, right-click on the .NET Standard Project containing your Xamarin.Forms UI
In the right-click drop-down menu, select Add > New File
In the New File window, on the left-hand pane, select General
In the New File window, in the center pane, select Empty Class
In the New File window, in the bottom Name text box, enter App
In the New File window, click New
3. Add Resources to App.cs
In the Solution Explorer, open App.cs
In App.cs, add your converter resources by entering the following code:
public class App : Application
{
public App()
{
Resources.Add(nameof(InverseBool), new InverseBool());
Resources.Add(nameof(ToUpper), new ToUpper());
Resources.Add(nameof(BoolToStringStateConverter), new BoolToStringStateConverter());
Resources.Add(nameof(AddHashToNumberConverter), new AddHashToNumberConverter());
Resources.Add(nameof(BoolToIntRowSpanConverter), new BoolToIntRowSpanConverter());
Resources.Add(nameof(StringToTextAligmentConverter), new StringToTextAligmentConverter());
Resources.Add(nameof(BoolToStringTextConverter), new BoolToStringTextConverter());
Resources.Add(nameof(BoolToStringTextForDeckSourcesConverter), new BoolToStringTextForDeckSourcesConverter());
Resources.Add(nameof(EpochSecondsToDateStringConverter), new EpochSecondsToDateStringConverter());
Resources.Add(nameof(IntervalToDaysConverter), new IntervalToDaysConverter());
Resources.Add(nameof(BoolToBackgroundColorConverter), new BoolToBackgroundColorConverter());
MainPage = ...
}
}
If the goal is to keep App.xaml clean, you can use the merged dictionary (and this is a best practice) and split all your resources into its own dictionary file, then use the merged dictionary to combine them in App.xaml.
If the goal is to define resources in .cs instead of .xaml, then you can access that dictionary right from the App.cs via this.Resources dictionary.
I'm getting the following error when trying to change a custom work item's state through Visual Studio:
The field 'Assigned To' contains the value 'Seth Denburg <Project\SDenburg>' that is not in the list of supported values.
During the state transition the value from another field is copied to the System.AssignedTo field. This error stopping me from resolving a related work item during my check in through Visual Studio.
I've noticed the following alternatives allow me to successfully change the state which could help point to what the issue is:
Changing the work item's state in the web interface. No errors are displayed here.
Reentering the user's name in the field being copied from before the transition in Visual Studio.
Reentering the user's name in the System.AssignedTo field after the transition in Visual Studio.
Here is a subset of states, transitions, and fields from the custom work item type definition that I think are related to this issue:
<FIELD name="Assigned To" refname="System.AssignedTo" type="String" syncnamechanges="true" reportable="dimension">
<ALLOWEXISTINGVALUE />
<VALIDUSER group="Project\Users" />
</FIELD>
<FIELD name="Lead" refname="Project.Tfs.Lead" type="String" reportable="dimension">
<ALLOWEXISTINGVALUE />
<DEFAULT from="value" value="Seth Denburg" />
<REQUIRED />
<VALIDUSER group="Project\TechnicalLeads" />
</FIELD>
<STATE value="Pending">
<FIELDS>
<FIELD refname="System.AssignedTo">
<VALIDUSER />
</FIELD>
</FIELDS>
</STATE>
<TRANSITION from="Active" to="Pending">
<REASONS>
<DEFAULTREASON value="Completed" />
</REASONS>
<FIELDS>
<FIELD refname="System.AssignedTo">
<COPY from="field" field="Project.Tfs.Lead" />
</FIELD>
<ACTIONS>
<ACTION value="Microsoft.VSTS.Actions.Checkin" />
</ACTIONS>
</TRANSITION>
The issue ended up being that the field Project.Tfs.Lead didn't have syncnamechanges="true". Here is what the field looked like after the change was made:
<FIELD name="Lead" refname="Project.Tfs.Lead" type="String" syncnamechanges="true" reportable="dimension">
<ALLOWEXISTINGVALUE />
<DEFAULT from="value" value="Seth Denburg" />
<REQUIRED />
<VALIDUSER group="Project\TechnicalLeads" />
</FIELD>
When making the change ensure that you use witadmin changefield like the following command because the field needs to be updated across work item type definitions. Importing an xml change won't work and will give you warning TF248017.
witadmin changefield /collection:https://project.com/tfs/projectCollection/ /n:Project.Tfs.Lead /syncnamechanges:true
Here's why this change was necessary from MSDN:
You must manually enable synchronization of any custom work item
fields that you have created in previous releases of Visual Studio
Team Foundation Server and that are used to assign person names that
reference Active Directory. You must enable synchronization for each
field for each team project collection that contains the custom
fields.
https://msdn.microsoft.com/en-us/library/dd286562(v=vs.100).aspx
Have created a test in myside, works well. The code of the custom work item type definition above seems missing a </FIELDS> of TRANSITION part.
Make sure the user Seth Denburg is in both group Project\TechnicalLeads and Project\Users.
You could also create a new team project in TFS2015 and use this custom work item type definition to see if the issue still exists. If not, the issue should related to the upgrade from TFS 2012 to 2015. Make sure you have Configure features after an upgrade.
I have been using Mendeley's Microsoft Word plugin to easily reference papers in my Mendeley Desktop library.
However, I've noticed that the IEEE format for the bibliography/citation is incorrect with regards to referencing conference proceedings and theses.
On the IEEE citation guide: http://www.ieee.org/documents/ieeecitationref.pdf
It shows that the city of the conference should be included in the citation of a conference paper. However, Mendeley's IEEE CSL file does not include this detail.
<macro name="event">
<choose>
<if type="paper-conference speech" match="any">
<choose>
<!-- Published Conference Paper -->
<if variable="container-title">
<group delimiter=", ">
<group delimiter=" ">
<text term="in"/>
<text variable="container-title" font-style="italic"/>
</group>
<text variable="event-place"/>
</group>
Should be changed to:
<macro name="event">
<choose>
<if type="paper-conference speech" match="any">
<choose>
<!-- Published Conference Paper -->
<if variable="container-title">
<group delimiter=", ">
<group delimiter=" ">
<text term="in"/>
<text variable="container-title" font-style="italic"/>
</group>
<text variable="publisher-place"/>
</group>
Since event-place is not a keyword that maps to the "city" field in Mendeley; the correct variable is "publisher-place".
Two options, use this formatted one that I just made, or follow the steps I did to make this change in the CSL Visual Editor.
Just use the corrected file
While in Mendeley Desktop, go to View menu, "Citation Style ->" and click "More Styles..."
Click on the tab "Get More Styles", and enter the following link into the "Download Style:" text box, then click Download
http://csl.mendeley.com/styles/451326401/ieee-CS-edited
Done!
Make your own corrections
While in Mendeley Desktop, go to View menu, "Citation Style ->" and click "More Styles..."
Right Click on IEEE and choose "Copy Style Link"
Open up a web browser, and paste the link and hit enter, it should download a file called "ieee.csl"
Open up a web browser that isn't Chrome, as this doesn't work in Chrome, and go to the page http://csl.mendeley.com/visualEditor/
Login using your Mendeley credentials
Click on the "Visual editor" tab at the top if it's not already selected.
Hover over "Style" and choose "Load Style..."
Browse and select the "ieee.csl" file that was downloaded earlier.
Under "STYLE INFO" and "Info", rename the Title to something new.
Navigate to the following
BIBLIOGRAPHY
->Layout
-->Conditional
--->Else-of paper-conference OR...
---->Group
----->event (macro)
------>Conditional
------->If paper-conference OR speech
-------->Conditional
--------->If container-title
--------->Group
----------->event-place (variable)
Click on event-place (variable) and in the editable section to the right, change the variable from "event-place" to "publisher-place"
Then go back to the Style menu and choose "Save Style As..."
Save this style, and it should automatically add it to your Mendeley Desktop
Done!
Mendeley does not show the thesis citations correctly in IEEE format. It should be like this:
[1] J. K. Author, “Title of thesis,” M.S. thesis, Abbrev. Dept., Abbrev. Univ., City of Univ., Abbrev. State, year.
[2] J. K. Author, “Title of dissertation,” Ph.D. dissertation, Abbrev. Dept., Abbrev. Univ., City of Univ., Abbrev. State,
year.
However, the thesis type and department name are not showing!!
Is is possible to slice an element by ordinal position (rank)? For instance, to profile the first given element in HumanName differently than the second (and subsequent) instances:
... snip ...
<element>
<path value="Patient.name.given" />
<slicing>
<discriminator value="???" />
<ordered value="true" />
</slicing>
</element>
<element>
<path value="Patient.name.given" />
<name value="First Name" />
<fixed?? value="0" />
</element>
I don't see any facility for this? This was the easiest example, but there are many situations where we'd like to differentiate between the first element ("primary") and others.
well, you can say that the slicing is ordered, and set constraints on the first element. This makes everything else ordered too. This is not the same as 'slicing by order' but it does make the first element special
Note that, unless the base resource assigns a meaning to order, enforcing order in a profile will impede interoperability. Only systems specifically configured for the profile will be able to conform to it.
I have a custom item template that I am adding to a Sharepoint project. I need to ensure that my modules are only associated with my feature, even if the project already contains other features.
Replacing IDs in projectItemReference elements within .feature files is trivial to do by modifying the replacementsDictionary in the RunStarted method.
For example, I have the following SampleModule_WebParts.feature file:
<?xml version="1.0" encoding="utf-8"?>
<feature xmlns:dm0="http://schemas.microsoft.com/VisualStudio/2008/DslTools/Core" dslVersion="1.0.0.0" Id="$SampleFeatureID$" activateOnDefault="false" description="Sample Web Part" featureId="$SampleFeatureID$" scope="Site" solutionId="00000000-0000-0000-0000-000000000000" title="Contoso Intranet Sample Module Web Parts" version="" deploymentPath="$SharePoint.Project.FileNameWithoutExtension$_$SharePoint.Feature.FileNameWithoutExtension$" xmlns="http://schemas.microsoft.com/VisualStudio/2008/SharePointTools/FeatureModel">
<projectItems>
<projectItemReference itemId="$SampleModuleID$" />
</projectItems>
</feature>
Replacing $SampleModuleID$ and $SampleFeatureID$ by modifying the replacementsDictionary in the IWizard.RunStarted method is trivial. But how can I modify the generated .csproj file snippet?
<None Include="Features\SampleModule_WebParts\SampleModule_WebParts.feature">
<FeatureId>{78185D58-6398-4ED2-B0D0-3DC20946FF8F}</FeatureId>
</None>
<Compile Include="SPItems\SampleModule\SampleWebPart\SampleWebPart.cs" />
<Compile Include="SPItems\SampleModule\SampleWebPart\SampleWebPartUserControl.ascx.cs">
<DependentUpon>SampleWebPartUserControl.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="SPItems\SampleModule\SampleWebPart\SampleWebPartUserControl.ascx.designer.cs">
<DependentUpon>SampleWebPartUserControl.ascx.cs</DependentUpon>
</Compile>
<None Include="SPItems\SampleModule\SampleWebPart\SampleWebPart.webpart" />
<None Include="SPItems\SampleModule\SampleWebPart\SharePointProjectItem.spdata">
<SharePointProjectItemId>{D982D304-E7FB-4E8C-899B-7D4096A55892}</SharePointProjectItemId>
</None>
In this case, I'd need to set the FeatureId and SharePointProjectItemId properties for the .feature and .spdata items. If I don't do anything, Visual Studio will autogenerate those GUIDs, but they won't match what I have in my replacementsDictionary. And that in turn leads to a broken reference in my .feature file and my module may get associated with the wrong feature.
How can I set those custom properties so that they are persisted into the .csproj file when the user saves it? IWizard.ProjectItemFinishedGenerating seems like the correct method to implement and I can inspect the ProjectItem parameter to figure out when the .spdata and .feature files have been generated, but what should I do there to set the FeatureId and SharePointProjectItemId properties?
The solution was to convert the Project reference into an ISharePointProject and calling
ISharepointProject.Synchronize(). After that I could traverse the SharePoint project's object model.
var sp = project.DTE as Microsoft.VisualStudio.OLE.Interop.IServiceProvider;
var projectService = new ServiceProvider(sp).GetService(typeof(ISharePointProjectService)) as ISharePointProjectService;
var sharepointProject = projectService.Convert<Project, ISharePointProject>(project);
sharepointProject.Synchronize();
After finding the my module and my feature from the collections returned by the ProjectItems and Features properties, I could simply associate the module with the feature:
sampleFeature.ProjectItems.Add(sampleModule);
Because I can fix the references programmatically, I can leave the old module GUID in the .feature file and clean up the invalid association by modifying the sampleFeature.Model.ProjectItems collection.
var invalidSampleModuleAssociation = (from projectItem in sampleFeature.Model.ProjectItems
where projectItem.ItemId == originalSampleModuleID
select projectItem).First();
sampleFeature.Model.ProjectItems.Remove(invalidSampleModuleAssociation);
Finally, I need to remove my module from any other features that the project might have, because Visual Studio automatically associates a new module with the first feature with an appropriate scope.
var unneededAssociations = (from otherFeature in sharepointProject.Features
where otherFeature.Name != sampleFeature.Name
from projectItem in otherFeature.ProjectItems
where projectItem.Name == sampleModule.Name
select new
{
Feature = otherFeature,
ModuleToRemove = projectItem
}).ToArray();
foreach (var moduleAssociation in unneededAssociations)
{
moduleAssociation.Feature.ProjectItems.Remove(moduleAssociation.ModuleToRemove);
}
AFAIK, you can make replacements also in any file, including the .csproj (in both filename and content)
If you have the Guids you wanna replace in the replacementDictionary, simply check the .vstemplate in order to be sure that file replacement is true:
<Project
File="MyProject.proj"
TargetFileName="$safeprojectname$.csproj"
ReplaceParameters="true">
</Project>
And edit the .csproj properly, replacing the Guids:
<None Include="Features\SampleModule_WebParts\SampleModule_WebParts.feature">
<FeatureId>{$SampleFeatureID$}</FeatureId>
</None>
<Compile Include="SPItems\SampleModule\SampleWebPart\SampleWebPart.cs" />
<Compile Include="SPItems\SampleModule\SampleWebPart\SampleWebPartUserControl.ascx.cs">
<DependentUpon>SampleWebPartUserControl.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="SPItems\SampleModule\SampleWebPart\SampleWebPartUserControl.ascx.designer.cs">
<DependentUpon>SampleWebPartUserControl.ascx.cs</DependentUpon>
</Compile>
<None Include="SPItems\SampleModule\SampleWebPart\SampleWebPart.webpart" />
<None Include="SPItems\SampleModule\SampleWebPart\SharePointProjectItem.spdata">
<SharePointProjectItemId>{$SampleModuleID$}</SharePointProjectItemId>
</None>
Important! replacementDictionary, as IDictionaryl is case sensitive!!