Add a file to UWP Sideload Publishing Folder During Publish Process - visual-studio

I have a UWP app I'm publishing via sideload (it will never be in the MS Store) and I have a PowerShell script that checks for an existing install of the app and whether it has un-synced data. I need this script to be included in the folder the Publish process creates, or better yet can I somehow customize Install.ps1 beforehand? I can't do it after publishing as that isn't an option due to the processes in place at work. Otherwise I'd just drag/drop via Explorer of course.
The UWP app will be installed via running this script (if it doesn't find un-synced data) rather than using the .msixbundle directly.
Need the Publish process from VS to add my custom PS script here:
I tried adding the file to the UWP project in the Solution and setting the Build Action property to Content or the Copy to Output Directory to Always, but as expected these weren't relevant to publishing a "sideload" UWP and had no effect.

Related

open a sideloaded UWA app with parameters

I have created a wpf app and have been learning how to deploy it as a side loaded windows store app through an appinstaller package.
I now want to launch the app through a shell command with parameters. I did setup a protocol, but it doesnt seem to open the app. to make things worse I do not have permission to see the contents of the windowsApps folder it should be installed in.
can anybody explain how i can launch this app with an argument? Also can anybody explain how the file structure is setup inside the windowsApps folder?
In the end i setup a protocol in the declarataions of my package manifest for my app to allow it to be opened through a url eg myapname:
here is an explanation of how this works
the full uri that is called is passed in the app parameters so i put custom handling in to allow me to pass waht i want in as a querystring
so for example i could call mayapp:?arg1=myvalue or myapp:localhost:80?myarg=myvalue

How to red an external file during the installation of an .appxbundle

I want to distribute my UWP app using side-loading.
I have created the .appxbundle using Visual Studio, and also EV code-signed it.
So, when the user clicks on the .appxbundle file, my app is properly installed and the user can start working with it!
In this way, I can place such .appxbundle on my website, and the users can download and install it. Marvelous.
Now, I would like to customize each download, by adding a file with some tracking information to attribute a download e.g. to a specific ad campaign that I am running.
So my server can generate a ZIP file containing the .appxbundle and a little .txt file containing the tracking info (I need to generate a separate file because the signed .appxbundle takes too long - several minutes - to regenerate each time).
The user then unzips the ZIP file, clicks on the .appxbundle and installs the app.
The tricky part is that, during the installation of the app, I would like to copy the .txt file into the LocalState folder of the app that is being installed.
Is it possible?
How can I do that?
Thanks!
If your users are going to install the app by clicking a ms-appinstaller:// link, you can attach extra data using the activationUri.
This can be a custom URL scheme that you register for your app with any url parameters. The appinstaller will call this url once the app is installed.
We use this to pass login information to the app, like this:
ms-appinstaller:?source=https://localhost:8000/myApp.appinstaller&activationUri=my-app-track-install:?campaign=billboards
If your app registers for the my-app-track-install url scheme in the Appxmanifest, then from the apps perspective the first launch is then a url activation with the url you added as activationUri. In your case you would track the install, and then proceed to launch the app normally.
You can find more info on this in the example and remark for this (semi-related) api-documentation:
https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.package.getappinstallerinfo?view=winrt-19041

Associate App with Messages Extension

I created a Messages Extension in Xcode 8 using the appropriate template, that seems to be working fine and when I run the extension, it's installed in the Messages app and I can use it without any issues.
My problem is that I wanted to create an actual app to be associated with this extension (so that the user would be able to search the extension through the Messages Store or install the actual app through the App Store). I gave it a matching bundle identifier (my extension is com.XXX.testmessage.MessagesExtension, so for the app I set com.XXX.testmessage), but when I run the app, it doesn't install the extension.
Is it possible to do that? And if so, what am I missing?
In XCode8, open your existing app. Then you need to add a new target to your app (File->New->Target->iOS->Sticker Pack Extension (or an iMessage Extension if you want a custom messages experience)). It will then create a folder visible in Project Navigator. The name of the folder depends on the name you gave to the extension. In that folder you will find a Stickers.xcassets where you can drop your stickers.

Run a powershell script or batch file on target server after publish

I'm using visualstudio.com and Hosted build controller to build and publish my website to a server with web deploy.
After the publish I want to execute a file (powershell script or batch file).
I know that I could create a Windows Service that runs on target server and uses the FileSystemWatcher to monitor changes and run a file when it detects a file change.
But is there any better way to do this?
I assume you've customized your XAML workflow to add a new Activity (of type InvokeProcess maybe?) to handle the Publish part.
If so, you can add another Activity that will execute your custom powershell (say custom.ps1) script like so:
Add custom.ps1 to your source control
Add the folder of custom.ps1 to those used when building (Right click your build definition > Edit Build Definition... > Source Settings tab > add your folder here)
Add a new InvokeProcess Activity after the publish, that will call powershell.exe and give "custom.ps1" as the argument.
The basic idea is: deploy the .ps1 along-side your source code, and execute it after publishing is over.
Also, I strongly encourage you to take a look at Ewald Hofman's great series, especially the following:
http://www.ewaldhofman.nl/post/2010/11/09/part-14-execute-a-powershell-script.aspx

Opening a file from TFS using the full TFS Path, from a web site

So I have a website running that displays full path of a TFS File on the page somewhere, I want the user to be able to click on it, which should then open up that file from TFS inside their Visual Studio.
The command to do this inside Visual Studio is "File.TfsOpenFromSourceControl" (DTE command) - it's basically the user manually going to that file using the Source control explorer and double clicking to open it up.
I am wanting to simulate that action from my web app inside the browser.
Update: The Web app is a pure ASPNet MVC app with Jquery available to it. I am already showing the file's content to the user in the web app. But I want the user to open the same file in Visual studio, by clicking on the file path in the web app. The question is more of Browser to VS integration and how to execute the DTE command in question, from within the web app context of the browser.
Any clues would be helpful
I don't know the answer to Pavel's question, so I'll sketch an outline of both solutions.
If you want to display the file inside the browser, call the Item.DownloadFile() API. NB: in 2008 SP1 there is another overload of this method that allows streaming into a memory buffer instead of writing directly to the filesystem. If you don't already work with Item objects directly, you can retrieve them via the GetItem() / GetItems() APIs.
If you want to make the file open in VS, there are a couple approaches. Perhaps your web app already includes the concept of local workspace(s) for the user, similar to Source Control Explorer. If so, you'd simply call Workspace.GetLocalItemForServerItem() to find the local path of the item, then ShellExecute it. (Or maybe pass it as a command line parameter to devenv.exe, if it's not natively associated with VS.) If not, you can either create a temporary workspace on behalf of the user, or use the same DownloadFile() API shown before; stream the contents to the client over a web service, save to disk, then launch VS as before.
Naturally, the more involved scenarios under option #2 will require deeper OS integration than the DOM / Javascript can provide. Would help to know if this web app is already built on ActiveX, Flash, Silverlight, XBAP, or similar technology...

Resources