How to include templates into VSIX package - visual-studio-2012

I am developing a package for VS2012 and what I have there is:
A custom project template and a set of custom item templates:
Templates\Items\MyFirstItem (and more items there), Templates\Projects\MyProject
Each template item contains .vstemplate file which is set to VSTemplate build action.
A Package which registers a ProjectFactory in a way:
[ProvideProjectFactory(
typeof(MyProjectFactory),
null,
"My Project Files (*.myproj);*.myproj",
"myproj", "myproj",
#".\\NullPath",
LanguageVsTemplate = "MyProject")]
A "Create VSIX Container during the build" option is set for the project.
When I build the project I see that my templates are zipped correctly and are copied into the output folder as expected such as bin\Debug\ItemTemplates\... and bin\Debug\ProjectTemplates.
They are also installed properly into the experimental instance.
However, these templates are NOT getting included into .vsix file.
And there is the question: how do I make them included without zipping them manually and including these zip files as assets into the source.extension.vsixmanifest?

You have to add those to the source.extension.vsixmanifest designer in your VSIX project. There is an Assets section and you basically just click New, select ItemTemplate from the type dropdown, select Current solution or project, then choose your item template. Repeat for every item template.

Related

WinUI Using Merged Dictionary from a DLL

I have this requirement where I need to access a resource dictionary defined in a DLL in my project as a merged dictionary. The whole project is setup as a C++/WinRT xaml hosted MFC application. And the required ResourceDictionary is a part of another dll.
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="PathToDict/CommonDictionary.xaml"/>
</ResourceDictionary.MergedDictionaries>
As shown here in the Source property, CommonDictionary.xaml exists as part of another projects binary(dll) and I need to merge that file to my project by specifying the a path to it.
I've already tried something like this although this works only for WPF;
<ResourceDictionary Source="pack://application:,,,/myNameSpace;component/CommonDictionary.xaml"/>
And also tried this after adding a reference to the project;
<ResourceDictionary Source="ms-appx:///MyNamespace/CommonDictionary.xaml"/>
None of these seem to work.
if your file in project directory, try to use
<ResourceDictionary Source="ms-appx:///CommonDictionary.xaml"/>
Generally, you can open any Page.g.i.cs file and see any string with Uri define. For example:
global::System.Uri resourceLocator = new global::System.Uri("ms-appx:///View/Page.xaml");

Image Asset NOT generating ic_launcher_foreground.xml file

I have created all my adaptive icons in the Image Asset tool but its not creating the ic_launcher_foreground.xml file - which in turn is causing my build to fail because the foreground.xml file is being referenced in the ic_launcher.xml and ic_launcher_round.xml files.
I have read many threads on how to resolve this but none of them are working.
As well, both ic_launcher.xml and ic_launcher_round.xml files are specifically referencing these two files:
<background android:drawable="#drawable/ic_launcher_background" />
<foreground android:drawable="#mipmap/ic_launcher_foreground" />
The /drawable folder is being created with the ic_launcher_background.xml file, but the Image Asset tool is not creating a /mipmap folder - it looks to be creating all the other /mipmap-XYZdpi folders and icons.
I bring this up because alot of other threads show the ic_launcher.xml and ic_launcher_round.xml files reference both background.xml and foreground.xml files in the same /drawable folder, unlike mine above.
In Image Asset:
Foreground Tab:
Layer Name: ic_launcher_foreground
Asset Type: image
Path: /dev/myApp/resources/myCustomIcon.png
Background Tab:
Layer Name: ic_launcher_background
Asset Type: image
Path: res/drawable/ic_launcher_background.xml
The only time I can get the ic_launcher_foreground.xml file to appear in the "Output Files" screen is if on the foreground tab I select Asset Type: Clip Art
UPDATE:
I found a ic_launcher_foreground.xml file in a drawable (v24) folder deep in an Android Studio folder related to my project. I copied that file to my projects res/drawable folder - and now I get the Android half robot Icon for my app when it compiles to my test device.
Well, I figured this out - finally. Posting my answer for anyone else that has the same issues.
Using Image Asset tool - ic_launcher_foreground.xml and ic_launcher_background.xml will ONLY be generated if each type (foreground tab/background tab) Asset Type is defined as anything BUT an image type. PNG/JPG asset types do not generate these xml files.
Regardless of Asset Types, both ic_launcher.xml and ic_launcher_round.xml WILL be generated. Both of these xml files simply reference other files, if Asset type is color/art/text - the reference will be to other XML files that will either be in the #drawable/ folder or the #values/ folder.
<background android:drawable="#drawable/ic_launcher_background" /> OR
<background android:drawable="#values/ic_launcher_background" />
//#drawable - is the root of all your drawables folders
// - and references only XML, ie: ie_launcher_background.xml
If the Asset Type is an image (png/jpg) then the reference will be to the newly created png/jpg files that exist in any of the #mipmap folders.
<foreground android:drawable="#mipmap/ic_launcher_foreground" />
// #mipmap is simply root of all your mipmap folders
// references actual png files, ie: ic_launcher_foreground.png
And finally, if you are using Cordova, you need to modify your config.xml to reflect the icon FILES to use:
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
<application android:icon="#mipmap/ic_launcher" android:roundIcon="#mipmap/ic_launcher_round" />
</edit-config>
// this telling the app to find those two XML files in the mipmap-anydpi-v26 folder
// and those files in turn tell the app to find all the png files in the other "mipmap" folders
// if it were this:
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
<application android:icon="#drawable/ic_launcher" android:roundIcon="#drawable/ic_launcher_round" />
</edit-config>
// this telling the app to use the XML files sourced in the drawable folders
// if you used png as foreground and color as background
// ic_launcher.xml/ic_launcher_round.xml would both point to:
// #mipmap/ic_launcher_foreground (ie: png images)
// #drawable/ic_launcher_background (ie: xml files)
I hope this helps others as I feel all of the above is poorly explained in other documentation.
It is very simple now: start "Image Asset Studio" by Right clicking on the "res" or "mipmap" folder and select "New > Image Asset" from the pop-up menu. Image Asset Studio will now open. Now you can create an Adaptive Launcher Icon or Legacy Only Launcher Icon as per your requirements.
To update and existing icon just select your existing ic_launcher_foreground.xml file and ic_launcher_background.xml file and hit "Next" to create the new definitions, overwriting the old ones.
With Windows Explorer go to your project "res" folder where all "ic_launcher files" are stored and delete all "ic_launcher files" first
Now in Android Studio "click on mipmap folder"->"Generate image asset".
It solved the issue for me
Well, what I did... (It often happens that others' solutions who say they finally fixed it never work for me, so I thought I would contribute yet another solution that might only work for me :) )
First I generated the image assets file as-is. I right-clicked on the res folder, clicked "New", then "Image asset". I left the "source asset" path as-is (with the path to the launcher_foreground.xml file in place) and created the assets.
Then I went back and generated the image assets again, but this time with my own png image. Seems to have worked so far, at least until the next update makes this solution obsolete.
On the second page of the asset studio wizard, there is a dropdown called "Res Directory".
I had to select debug before clicking finish. I was able to build after that.
Open your Android Studio and go to your project then
go to android-> app -> scr -> main -> res -> mipmap-anydpi-v26 on
Right click -> New -> image Asset -> Configure image asset -> path ->
mipmap-hdpi -> ic_launcher_foreground.png
Following these steps will solve your problem definitely.

How can I get images into my Excel reports with BIRT?

I have some reports that have images that look great as web pages, or PDF, but the images are not coming over when the report is opened in Excel.
What is your birt version? Images are supported in Excel only from birt 4.3, with spudsoft xls & xlsx emitters.
For older versions that's quite more tricky but we can still inlcude these emitters, or the native excel emitter.
Use the Native Excel Emitter for Excel format, instead of default excel emitter.
You can download plugin from here:
Extract the jar using any of any of the archive software(eg. winzip, 7-zip,etc) and keep it separately.
After extracting the jar file, copy the 'jar' files in your own project's folder (webapp/web-inf/lib).
And also add the original downloaded jar (org.eclipse.birt.report.engine.emitter.nativexls.jar) into your project's folder (webapp/web-inf/lib).
And add the class path (Right click Project → Configure Build Path → Add Jar → Select the jar files you have added from the lib folder).
Note: For Maven Projects only
If you are using Maven Projects, then you should add the jar files in your maven repository.
In command prompt, type the following commands:
mvn install:install-file -Dfile=c:\kaptcha.jar -DgroupId=com.google.code
-DartifactId=kaptcha -Dversion={version} -Dpackaging=jar
Instead of follow the step 4, follow the below steps:
Right click Project → Config Build Path → Add Variable.
Select your maven repository variable.
Click 'Extend' button.
Under select your jar and click 'ok' button.
You should also add the jar files which is extracted from the org.eclipse.birt.report.engine.emitter.nativexls.jar (in lib folder)
In java, under the Excel Format option, add the following line also:
ExcelRenderOption option=new ExcelRenderOption();
option.setOption(IRenderOption.EMITTER_ID,"org.eclipse.birt.report.engine.emitter.nativexls");

Path to layout xml files in magento

I have seen that we can place our layout xml files in
app/design/frontend/default/default/layout
or we can place our customization inside
app/design/frontend/base/default/layout/local.xml
file, but I have read at magebase and at magentocommerce that we can place our layout files under
app/design/frontend/your_interface/your_theme/layout/
or
app/design/frontend/[package]/[theme]/layout
So if we I have package like 'Kaushikamdotcom' in 'app/code/local', should I have to create that same package under 'app/design/frontend/' ? I tried many patterns, but nothing worked out for me.
I am quite sorry that I have made such a blunder asking this question, but I am answering this as lots of people will be making the same mistake. Package means; in the admin side of magento open
System->Configuration->Design
Then change the configuration scope to Main website. Then select Package section, uncheck the default check box and use your package name such as "Test". Then create the following folder structure.
app/design/frontend/Test/default/layout
Place your layout xml files here. If you are using your own themes use that name instead of default.
It depends what layout-xml file you have.
If you want to build up your theme, use the local.xml file in your theme dir.
If you write an extension and want to add a block to use inside this new extension, add a layout-xml file via config.xml and add it under base/default/layout/yourname.xml
When you do it this way, your theme-related changes only appear in the theme and your extension-related changes are theme-independent

Include javascript file in sharepoint visual web part

I am using sharepoint 2010 and developing a visual web part. I had javascript functions on the ascx file and they all used to work file.Now I have moved them to a single javascript.js file and deployed it to the _layouts folder on server.
And I have put the below line on the ascx file to reference to that file
<script src="/sites/xxxxx/_layouts/customwebparts/javascript.js" type="text/javascript"> </script>
and then on the ascx.cs file and I am using the methods defined in this file for eg.,
btnCancel.Attributes.Add("onclick", "{return Action(Cancel the form?)};");
But it is not working, it is not displaying the confimration box ...Am I referencing the wrong way. Please help me ....
To reference a javascript file from within a SharePoint Visual Web Part you need to use the SharePoint:ScriptLink tag (example below):
<SharePoint:ScriptLink ID="<someid>" runat="server" Name="/_layouts/...<Path>"></SharePoint:ScriptLink>
I add a layouts mapped folder to my Visual Web Part project and place a scripts folder within the default folder, which I believe is the projects name. Following this model ensures that the javascript file is always kept up-to-date during deployment. The 'Name' property in the above tag is just the path to the javascript file relative to _layouts, so something like "/_layouts/ProjectName/Scripts/myjavascript.js".
As an FYI if you want to use CSS as well there is a SharePoint:CssRegistration tag as well. I find these are the 2 that I use the most.
You should put your javascript file in the Layout mapped folder and use the SharePoint:ScriptLink tag:
<SharePoint:ScriptLink id="ScriptLink1" runat="server" Localizable="false" Name="some-layout-subfolder/file.js" />
If you have a file not found error you should check that the Localizable attribute is set to false and from Visual Studio, in the properties of the js file, Build Action should be set as Content and Deployment Type should be TemplateFile.
Check here for more details:
http://blog.netgloo.com/2014/06/19/include-javascript-and-css-files-in-your-sharepoint-2010-visual-web-part/

Resources