Multi-device hybrid apps + webessentials: bundling two css files gives error - visual-studio-2013

I use Multi-device hybrid apps CTP 2 with webessentials and try two bundle two css files. It gives the following error:
16-8-2014 22:58:19: System.NullReferenceException: Object reference not set to an instance of an object.
at MadsKristensen.EditorExtensions.FileHelpers.RelativePath(String absolutePath, String relativeTo)
at MadsKristensen.EditorExtensions.BundleDocument.GetRelativePath(String file, String root)
at MadsKristensen.EditorExtensions.BundleDocument.<>c__DisplayClass5.<WriteBundleRecipe>b__2(String file)
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
at System.Xml.Linq.XContainer.AddContentSkipNotify(Object content)
at System.Xml.Linq.XElement..ctor(XName name, Object content)
at MadsKristensen.EditorExtensions.BundleDocument.<WriteBundleRecipe>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MadsKristensen.EditorExtensions.BundleFilesMenu.<MakeBundleAsync>d__27.MoveNext()
The file Mybundle.css.bundle is created but:
Is empty
Is not included in the project
I included the Mybundle.css.bundle in the project, and added the required configurartion as follows:
<?xml version="1.0" encoding="utf-8"?>
<bundle xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://vswebessentials.com/schemas/v1/bundle.xsd">
<settings>
<!--Determines if the bundle file should be automatically optimized after creation/update.-->
<minify>true</minify>
<!--Determin whether to generate/re-generate this bundle on building the solution.-->
<runOnBuild>true</runOnBuild>
<!--Use absolute path in the generated CSS files. By default, the URLs are relative to generated bundled CSS file.-->
<adjustRelativePaths>true</adjustRelativePaths>
<!--Specifies a custom subfolder to save files to. By default, compiled output will be placed in the same folder and nested under the original file.-->
<outputDirectory />
</settings>
<!--The order of the <file> elements determines the order of the files in the bundle.-->
<files>
<file>/css/index.css</file>
<file>/css/stylesheet.css</file>
</files>
</bundle>
Compilation or saving one of the css files does not trigger bundling.
Do Multi-device hybrid apps CTP 2 and WebEssentials work together?

You should report these errors to Mads Kristensen at https://github.com/madskristensen/WebEssentials2013

Opened https://github.com/madskristensen/WebEssentials2013/issues/1429 as I too encountered similar error when bundling css using Web Essentials 2013 on Multi-Device Hybrid Apps for Visual Studio CTP2.0

Please see the answers to this question: Why is Visual Studio 2013 crashing when I try to create/open a Multi-Device Hybrid Apps application?
There are issues when Multi-device hybrid apps CTP2 and WebEssentials are installed together. Either you need to disable WebEssentials or switch to nightly builds of WebEssentials.

Related

Change the order during bundling in web essentials

I am trying to bundle files using web essentials
I installed the web essentials and added it to the extensions
I selected the files to minify as in the below image
http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-15-70/3223.5.JPG
But i couldnt find any option to set the order in which the files should be bundled, for example, in the image, i want to move knockoutvalidation.js to the top and have jQuery.js after that in the bundled file
How can i achieve this?
Well, here goes -- my first post on StackOverflow! Gulp.
Web Essentials should have created a .bundle file containing XML used for configuration. Use the files node to change the order; eg, here foo.js is bundled before bar.js:
<files>
<file>foo.js</file>
<file>bar.js</file>
</files>

How to set package name of Xamarin.Android APK for Google Play submission

I have finished my app after 8 months work and I am attempting to submit to Google Play.
I sign the and align the APK properly and upload the APK to Google Play. Then I get the following message:
Upload failed Your APK's package name must be in the following format "com.example.myapp". It may contain letters (a-z), numbers, and underscores (_). It must start with a lowercase character.
Here is the AndroidManifest.xml file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" package="com.vrocket.launcher" android:versionName="1.30.637" android:versionCode="1">
<uses-sdk android:targetSdkVersion="14" />
<application android:hardwareAccelerated="true" android:label="launchpad">
<provider android:name="com.vrocket.launcher.LocalFileContentProvider" android:authorities="com.vrocket.launcher" />
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
</manifest>
As far as I can tell, the package name I specify here meets the requirements for Google Play submission. I did change my package name in the Android.Manifest since I started the project but I figure this would be pretty normal practice.
Has anyone had similar issues submitting a Xamarin.Android app to Google Play?
EDIT:
I have since figured out that the APK is being compiled with an old package name VRocket.VRocket.
I found this out using the aapt tool in the Android SDK.
Why is it not building with the package name specified in AndroidManifest.xml?
The properties window in Visual Studio (assuming your writing in this) has a couple of settings you can change. These override the manifest when you compile. Perhaps this is where your stray name is coming in from? Same goes for the attributes you place in the class files in your code, Xamarin rewrites all of your manifest on compile. If you display hidden files in the solution tab and go to
obj\Release\android
this directory has the manifest that is generated for your app. Maybe it will shed some light.
I'm using DevStudio and did all of the following things, the last of which FINALLY worked and the Play store accepted my build. I'm pretty sure #2 and #5 are required, maybe all of them, but in any case I think this should go a long way to helping people in a similar situation:
Changed the filename to com.foo.bar.apk (pretty sure this doesn't
matter)
Right-clicked on ProjectName.Droid, Properties-->Android Manifest. Changed the Package Name to com.foo.bar
In that same dialog, set Version Number to 1 and Version Name to "Alpha 1"
Under Properties-->Application, changed Assembly to com.foo.bar
In the Archive Manager, right click on my app and Delete it. Re-create via right-clicking on project again and choosing
Archive...

Update Private Gallery atom such that VS shows that an extension update is available

I'm using a Visual Studio Private Gallery to publish a VSIX internal to my company. My VSIX shows up in the "Online" section of "Extensions and Updates" in Visual Studio 2012 and I can install it from there:
However, once it's installed, I can't figure out how to update my extension in a way that makes it show up in the "Updates" section of that same dialog box, nor can I figure out how to make Visual Studio notify me that an update is available.
I've tried various combinations of the following:
Increasing the version number in the VSIX itself and in the atom.xml
Changing the updated tag inside of the entry tag to the current date and time
Changing the updated tag inside of the feed tag to the current date and time
Changing the published tag inside of the entry tag to the current date and time
My expectation was that a combination of 1, 2, and 3 should be enough to show that there is an update, but to no avail. This guide seems to confirm my expectation:
Published - The date/time when the extension was added.
Updated - The date/time when the extension was last updated.
I've also tried all 4 at the same time, also to no avail.
I'm serving the gallery from an Apache instance, and I've confirmed that it's setting a correct Last-Modified header for the atom.xml .
Is there some interval at which Visual Studio checks for updates? Does opening the "Updates" section of "Extensions and Updates" not force Visual Studio to check?
Here's the contents of my atom.xml:
<?xml version="1.0" encoding="utf-8" ?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title type="text">Visual Studio Extension Gallery</title>
<id>uuid:CDC295B0-7885-4B59-9BDF-F059A9F4B338;id=1</id>
<updated>2013-12-11T19:00:00Z</updated>
<entry>
<id>MyVSIX..b242c6de-d0a6-4ba1-9672-b866e36607d3</id>
<title type="text">MyVSIX</title>
<summary type="text">MyVSIX is a nifty extension that does things.</summary>
<published>2013-12-11T19:00:00Z</published>
<updated>2013-12-11T19:00:00Z</updated>
<author>
<name>daxelrod</name>
</author>
<content type="application/octet-stream" src="vsix/MyVSIX.vsix" />
<Vsix
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.microsoft.com/developer/vsx-syndication-schema/2010"
>
<Id>MyVSIX..b242c6de-d0a6-4ba1-9672-b866e36607d3</Id>
<Version>0.5</Version>
<References />
<Rating xsi:nil="true" />
<RatingCount xsi:nil="true" />
<DownloadCount xsi:nil="true" />
</Vsix>
</entry>
</feed>
I should also note that my extension is not Strong Name Signed, because it uses a third party assembly that is unsigned. Does that make a difference?
I had the same Issue and made some deep investigation. In my case it was odd, that my extension always shown as "Download" in the Private Gallery instead as "Installed" (the Green Hook). So I guessed there is a missing Link between the Gallery item and the installed Item
The answer is as simple as annoying:
The ID has to be "THE ID".
So the Product ID (in the VSIX Configuration) is the reference which has to be in the Atom-File.
In Your case:
<Vsix>
<Id>b242c6de-d0a6-4ba1-9672-b866e36607d3</Id>
</Vsix>
As you see: Withyout your "MyVSIX..".
After that it will recognize your Extension and if installed also hide the "Download" Button within the Gallery
For Update:
It's enough if you increase the < Version > Content.
For The Update Cycle (my experience):
It checks on start of the Visual Studio (once Daily, if in Option enabled)
It checks every time you open the "Extensions and Updates". So reopen after a save of the XML should be enough.
EDIT: (thanks for the Upvote)
Here the Pictures for better understaning (made in VS2013, but almost same for VS2012)
The ID in the VSIX File.
How it should look like in the Atom-Feedfile.
<Vsix>
<Id>d4d50729-a612-4260-9b2e-3a61ad5e2207</Id>
</Vsix>
How it should look if you correctly linked between Gallery and VSIX File.
We tried to use an atom.xml in a private gallery for an automatic update. It did not work at all, even after removing the name from the ID in the VSIX tag. We are using a package developed for VS 2015.
Then, looking more carefully, we realized that the ID of the package class, that is also present in the vsct file, is different from the ID defined in the manifest file: source.extension.vsixmanifest. While the first is a pure GUID the second is a concatenation of the name, producer and another GUID.
Something like:
MyVSIX.MyCompany.GUID (in form of xxxxxxxx-xxxx...)
When we used the second one, everything worked perfectly. We even managed to update packages that were previously installed by double-clicking the vsix file.
I want to thank you as this article was a very good start to solve our problem.
All the best,
Dan Vasilescu
it looks like VS only checks for updates once a day, but I wasn't able to get it to detect an updated extension in an Atom gallery.

Developing an OpenSocial Gadget within Visual Studio

We are about to implement a bunch of OpenSocial gadgets. They are not going to be run on Facebook or any other social network but rather on our own internal Apache Shindig server. (We embed these gadgets using iframes in a normal ASP.NET MVC cshtml view)
According to http://docs.opensocial.org/display/OSREF/OpenSocial+Tutorial, the structure of a gadget is like so:
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="Hello World!">
<Require feature="opensocial-0.8" />
</ModulePrefs>
<Content type="html">
<![CDATA[
Hello, world!
]]>
</Content>
</Module>
Whereas the HTML, CSS and JS are embedded within the in the tag. If we want to develop a file like this in XML format in Visual Studio, it renders Syntax Highlighting, IntelliSense, IntelliTrace and JavaScript debugging impossible. That's not very comfortable.
Question 1: Do you know of any usable(!) extension for Visual Studio that re-enables all these features for these OpenSocial XML gadgets?
Question 2: Or if not, have any of you ever tried the same and found a good way to work around these hurdles?
Update: We have done a proof-of-concept of using a post build step that takes a plain HTML file, a plain JS file, and an XML skeleton and merges them into a gadget. In debug mode we might conceivably include the plain files directly while in the deployment process we call Shindig with the merged XML file from the post build step:
if (#Html.IsDebugMode())
{
<iframe src="/Gadgets/HelloWorld.html"/>
}
else
{
<iframe src="http://example.org/shindig?url=http://example.org/Gadgets/Merged/HelloWorld.xml"/>
}
This is how the solution works:
Add a Gadgets\HelloWorld.js file
Add a Gadgets\HelloWorld.html file that includes the js file.
Add a Gadgets\HelloWorld.xml file with the gadget XML but with an empty <Content> tag.
Create a CSHTML page with an iframe that includes the plain HTML file in Debug mode but includes the Gadget in Release mode.
Define a Post Build Event that reads the contents of HelloWorld.html and pastes it into the Content tag of the XML. In addition it reads the JS code from the JS file and replaces the script inclusion <script src="HelloWorld.js" /> in the HTML by an inline JavaScript <script>...</script> with the respective code.
Advantages:
Clean separation of logic (JS file), presentation (HTML file) and metadata (XML file).
Complete Visual Studio HTML authoring support when working on the HTML.
Complete Javascript authoring support when working on the JS.
Tools such as JSLint can be used to check the JavaScript style.
Caveats:
In Debug mode, if we call Shindig to render the gadget, we don't have a way to open the JavaScript in Visual Studio and setting a breakpoint. However, if any error occurs in the JS code, Visual Studio will open a view on the JS code and mark the erroneous line. Once that view is open, we can use it for setting break points, too. Live editing is not possible though because the original JS file only gets merged into the XML in the course of the build process.
On the other hand, if we include the plain HTML file as an iframe instead of having Shindig render it, we gain the possibility of live-editing and debugging directly in the respective files. But of course all of the Shindig features are not effective. In particular, all the scripts automatically added by Shindig are missing or have to be included by hand.
Ideally every change in the HTML or JS file while running the application in debug mode would immediately update the merged Gadget XML file, thus allowing life editing even when using Shindig.
A2: You can develop your javascript in a separated js file and just include it in the gadget xml as you would with html file contain a js include. Further more, you can use frames inside your gadget html, but that will may prevent you from using some of the js API available from Shindig.

Is it possible to filter on files in sub folders in ContentFiles for a web setup project?

I have a web setup project and a web site included in the same sollution.
In the setup project, I have added Content files pointing to the web site content.
In this web site there are some folders that contains dynamically generated files (i.e .log files, some image files etc.) I do not want these files to be included in the setup. I have tried to add a filter Symbols\*.png but this does not work. I have also tried a filter called *.png, and this excludes the .png files within that folder, but the problem is it also excludes all static .png files in the web site that must be there.
How can I add a filter that excludes only the files under the directory I want?
Is it possible to call something in the PreBuildEvent after the files are deleted that will tell VS to refresh the web site content?
Are there any other approaches that can solve this?
Have you tried to edit your .csproj file with notepad and add something like:
<ItemGroup>
<!-- This will exclude the .png files from the Symbols folder -->
<ExcludeFromPackageFiles Include="$(ProjectDir)..\..\MyWebSite\Symbols\*.png" />
</ItemGroup>
where ItemGroup is after the following line:
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
More info you can find in the following article: http://sedodream.com/2010/05/01/WebDeploymentToolMSDeployBuildPackageIncludingExtraFilesOrExcludingSpecificFiles.aspx
As a workaround, I have created a PreBuildEvent that deletes all the files that should not be included in the setup:
del /Q $(ProjectDir)..\..\MyWebSite\Symbols\*.png
This actually deletes the files when I start the build, but it causes an error later in the build, because some content files does not exist that the setup content thinks should be there. The files that are deleted, are still referenced in VS as content in the web site. If I browse the folders in the web site, I see that the deleted files are there in the VS GUI (although the files are actually deleted). I have to do a refresh on the web site project to tell VS that the content has changed, and then do the build again. Then it works, and my setup contains what I want.

Resources