I was trying to create new packages for a Store application and got this error. I was updating my Nest Thermostat application and adding the new Navigation View component. Which is a great new XAML component.

The docs for the navigationview xaml control are great. But during the creation of the new store package I got this dummymodulereference error… Here is my attempt to fix it:

image

  1. cleared all nuget caches
  2. removed the .vs hidden folder in my solution folder
  3. removed in each project folder the bin and obj folder
  4. removed the project.lock
  5. Had to open my solution file in notepad++ to see that I had a project in my solution in an other (parent) dir. So had to remove bin and obj and project.lock there too.
  6. right click on solution in the solution explorer and restore nuget packages
  7. build –> rebuild solution

But unfortunately..  I Googled with Bing and found people having similar issues: https://developercommunity.visualstudio.com/content/problem/133644/internal-compiler-error-5.html

and https://developercommunity.visualstudio.com/content/problem/137629/error-on-build-for-store.html


I even removed the symbol cache (tools –> options –> debugging –> symbols –> empty symbol cache)

Also skipped the nuget restore, because creating store packages will auto restore nuget packages.


I found out that the issue was in a global nuget package:

image

So I added a reference in my store app project to the same nuget but a newer version. Not 1.7.1 but 2.0.0

That did not help, so I added the microsoft.net.native.compiler package to all my referenced projects.

Also no fix. Last resort: tweet to @VisualStudio because it is already listed in the vs feedback.




Please let me know if you have a solution.

Pin on pinterest Plus on Googleplus Post on LinkedIn

The 15.4 update of Visual Studio has a lot of new things. Also the Fall creator update enables you to use .net Standard 2.0 in UWP apps. Adding UWP apps in the store is easy and native. But you can also pack other types and submit them as store apps.

WAP

Windows Application Packaging Project. it’s a new project template in vs15.4 You can load up the solution containing your application and add a new project of this type.

Select the target and minimum version of the Windows SDK (this is recognizable from uwp apps)

Right click applications in the solution explorer and add a reference to your main application project

Add Project Reference

Then you can use the create app packages like you would do for an UWP app

You can read more about it on the microsoft docs site

https://docs.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-packaging-dot-net

Pro tip: visit the Microsoft Docs website more often. They are really improving lately. Like a lot!

There is just one thing I would like to point out: your developer account needs extra permissions to submit such type of application.

You will need to submit your info on this page:

https://developer.microsoft.com/en-us/windows/projects/campaigns/desktop-bridge

and they will get back to you in 6 business days.

I have submitted two apps, one for the general store and one as a business app which is only available for my colleagues in a private store. Both are still waiting for approval. Hope to hear soon from the team.

So the pro-tip of today is: make sure your dev ms account has privileges to submit a desktop bridge app to the store!


Good luck!

Pin on pinterest Plus on Googleplus Post on LinkedIn

It all starts with installing Windows 10 IoT on a suitable device. I used a Raspberry Pi 2 (Model B) and installed the creators update of Windows 10 IoT. You should really get the dashboard from Microsoft: https://developer.microsoft.com/en-us/windows/iot/downloads

snip_20170504105939

It is really easy to get Windows 10 IoT on your device. Here is a small manual https://developer.microsoft.com/en-us/windows/iot/docs/iotdashboard

snip_20170504111010

If you have your Visual Studio 2017 configured, you can easy deploy to it.

The hardware

I bought stuff from aliexpress. I had no rush, so saved a lot of money Smile

I was inspired by this article https://www.modmypi.com/blog/raspberry-pi-plant-pot-moisture-sensor-with-email-notification-tutorial but that referenced to a moisture sensor for 4 gbp and shipping was also 4 gbp. So just the sensor could cost me 9,40 eur. Which makes it less fun, because the whole idea of a raspberry pi is that you can make an internet of things device with little costs.

 

I spend only 42 cent on the sensor and bought some male/female, male/male, female/female jumper cables too and even an hdmi to dvi connector so I could connect an external monitor, but never used it.

Ali Url snip_20170504112536

€ 0,42

Ali Url snip_20170504112647

€ 2,19

Ali Url snip_20170504113017

€ 1,14

(optional)

So I had to spend € 2,61 euro including shipping to get the parts for my Pi 2.

Hardware wiring

Connect the probe to the sensor with two wires. Doesn’t matter which goes where.

Connect the sensor to the GPIO

VCC 3v3 Pin 1
GND GND Pin 9
D0 GPIO 17 Pin 11

 

WP_20170406_17_01_50_Pro

WP_20170406_17_01_40_Pro

WP_20170406_17_01_26_Pro

WP_20170406_17_01_13_Pro

this is a good page for gpio pins: http://www.raspberrypi-spy.co.uk/2012/06/simple-guide-to-the-rpi-gpio-header-and-pins/

snip_20170504134958

Software

I hit a strange bug with the UWP but fixed it, thanks to stack overflow, by manual creating a project.json file. As said, I was inspired by this article but that is coded in Python. My preference language is still C# and I wanted to try win 10 iot. So I rewrote this python code to C# and got this: 

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Http;
using Windows.ApplicationModel.Background;
using Windows.Devices.Gpio;
using Windows.UI.Core;
using System.ServiceModel;
using LightBuzz.SMTP;
using Windows.ApplicationModel.Email;

namespace BackgroundApplication1
{
    public sealed class StartupTask : IBackgroundTask
    {
        private const int SENSOR_PIN = 17;
        private GpioPin pinSensor;
        private BackgroundTaskDeferral deferral;

        private const string SMTP_SERVER    = "smtp-mail.outlook.com";
        private const string STMP_USER      = "YOURPLANTSADDRESSHERE@hotmail.com";
        private const string SMTP_PASSWORD  = "YOURPASSWORDHERE";
        private const int    SMTP_PORT      = 587;
        private const bool   SMTP_SSL       = false;

        private const string MAIL_RECIPIENT = "iwillwatertheplants@hotmail.com";

        public void Run(IBackgroundTaskInstance taskInstance)
        {
            deferral = taskInstance.GetDeferral();

            taskInstance.Canceled += TaskInstance_Canceled;

            var gpio = GpioController.GetDefault();

            if (gpio != null)
            {
                pinSensor = gpio.OpenPin(SENSOR_PIN);

                var r = pinSensor.Read();

                pinSensor.SetDriveMode(GpioPinDriveMode.Input);

                var dm = pinSensor.GetDriveMode();

                pinSensor.DebounceTimeout = TimeSpan.FromMilliseconds(50);

                pinSensor.ValueChanged += PinIn_ValueChanged;
            }
        }

        private void PinIn_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs args)
        {
            if (pinSensor.Read() == GpioPinValue.High)
                SendMail("Thirsty", "Plant needs water");
            else
                SendMail("I am good", "Plant is fine again");
        }

        private async void SendMail(string subject, string body)
        {
            using (SmtpClient client = new SmtpClient(SMTP_SERVER, SMTP_PORT, SMTP_SSL, STMP_USER, SMTP_PASSWORD))
            {
                EmailMessage emailMessage = new EmailMessage();

                emailMessage.To.Add(new EmailRecipient(MAIL_RECIPIENT));
                emailMessage.Subject = subject;
                emailMessage.Body = body;

                await client.SendMailAsync(emailMessage);
            }
        }

        private void TaskInstance_Canceled(IBackgroundTaskInstance sender, BackgroundTaskCancellationReason reason)
        {
            pinSensor.Dispose();
        }
    }
}

I used the nuget "lightbuzz-smtp" to send mail https://github.com/LightBuzz/SMTP-WinRT

Have fun with Windows 10 IoT raspberries etc.

Pin on pinterest Plus on Googleplus Post on LinkedIn
0 Comments

This post covers storing and retrieving settings with a WPF combobox for the UI. If you are looking for a solution to store settings across devices, for instance a Windows Surface tablet and a Windows Phone powered device, you should check out the blog of Mike Taulty. That is called roaming data storage. And if you are not working on an app for Windows RT/metro or Windows Phone but are just coding some WPF application, you should read this post from Scott Hanselman.

Let’s start with some code now that it’s clear what this post covers and what it doesn’t cover.

Here is my XAML from my userinterface:

<ComboBox x:Name="cbCountry" 
    SelectionChanged="ComboBox_SelectionChanged" 
    PlaceholderText="Select country" SelectedValuePath="Tag">
    <ComboBoxItem Content="Australia" Tag="au"/>
    <ComboBoxItem Content="New Zealand" Tag="nz"/>
</ComboBox>

Please note the ‘SelectedValuePath’ is being set to ‘Tag’, otherwise it would grab the ‘comboboxitem’ or ‘content’ like this:

var comboboxContent = ((ComboBoxItem)cbCountry.SelectedValue).Content;

With the value path set to tag, it will grab ‘au’ or ‘nz’ as selected value.

This is the constructor of the xaml page containing my settings.

var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

this.InitializeComponent();

if (localSettings.Values.ContainsKey("country"))
{
    cbCountry.SelectedValue = localSettings.Values["country"];
}

and this is the code for the selectionchanged event of the combobox.

private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
    var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
    localSettings.Values["country"] = cbCountry.SelectedValue;
}

Good luck with this small code sample. If this is not what you are looking for, please check the links mentioned at the start. I strongly believe that they take you to the code that you are looking for (if the code above is insufficient)

Pin on pinterest Plus on Googleplus Post on LinkedIn