WPF and XAML errors: "Version string portion was too long or too short"

2 Minute(s) to read

Encountered a problem recently when working with WPF, XAML, and C# in Visual Studio 2017. I lost a lot of time over it while scratching my head in confusion, but I found the problem at the solution.

It was somewhat self-inflicted, but it didn't necessarily help that the error being presented indicated nothing about where it was coming from!

If you are manually editing your project file so that you can integrate Windows 10 OS features with your desktop application, it's likely because you were reading this MSDN article.

Problem

Desktop C# applications can reference WinRT run-time libraries that are available as part of the Windows 10 SDK. I was recently working on a project that required references to those libraries, so that I could integrate a Windows 10 feature with my application.

This required me to modify my project file (.csproj) so that it contained the following XML elements.

<PropertyGroup>
...
    <TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
    <TargetPlatformVersion>10</TargetPlatformVersion>
...
</PropertyGroup>

The problem here is that "TargetPlatformVersion" is considered to be malformed. The version string specified is too short, or doesn't contain sufficient information such as the minor revision or build number.

Should you open the XAML designer after modifying the project manually with the property value above, you are going to encounter this mysterious and useless error.

Microsoft Visual Studio

Solution

Simply modify your .csproj file so that it specifies the exact version of the Windows 10 SDK that you are intending on using. Unfortunately when you open the XAML designer, there is no indication where the error is coming from exactly. Seemingly the XAML designer is disconnected from the Windows 10 SDK that is being referenced by the project.

<PropertyGroup>
...
    <TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
    <TargetPlatformVersion>10.0.17763.0</TargetPlatformVersion>
...
</PropertyGroup>


Comments

Comments

Gravatar for Amilanaf

Форум по заработку <a href=>https://razula.ru/</a>
Бесплатные курсы по заработку. https://razula.ru/
Множество бесплатных книг любой тематики.

Gravatar for StephenDug


<h2>Регистрация на сайте Гидры</h2>
Гидра сайт имеет удобную систему регистрации, сам процесс не займет много времени, достаточно придумать пароль, логин, указать действующий е-мейл. По окончании регистрации участник получает удобный личный кабинет. Таким образом, можно добавлять товары в корзину и производить оплату. В Hydra 24 существует техническая поддержка, которая рада помочь и решить конфликтные ситуации с магазинами.

Gravatar for mwpmxaph

what do generic viagra pills look like http://viagrastoreon.com/ - sildenafil generic vs viagra

buy viagra now <a href=http://viagrastoreon.com/#>viagra without prescription</a>

Gravatar for Natashapal0223

Perfect update of captchas regignizing software "XRumer 19.0 + XEvil 5.0":

Captcha regignizing of Google (ReCaptcha-2 and ReCaptcha-3), Facebook, BitFinex, Bing, Hotmail, SolveMedia, Yandex,
and more than 12000 another types of captcha,
with highest precision (80..100%) and highest speed (100 img per second).
You can use XEvil 5.0 with any most popular SEO/SMM software: iMacros, XRumer, SERP Parser, GSA SER, RankerX, ZennoPoster, Scrapebox, Senuke, FaucetCollector and more than 100 of other software.

Interested? You can find a lot of introducing videos about XEvil in YouTube.

FREE DEMO AVAILABLE!

See you later!

Gravatar for Thomastaush

Я слушаю качественную музыку онлайн либо скачиваю исключительно с этого сайта
вы иожете убедится сколько здесь всегда загружается лихо и весь песенки
в много хорошем качестве! Беспричинно же бесконечно удобно выслушивать с телефона
песни сами переключаются https://z1music.online