Has anyone successfully created a .csproj
file for a UWP project that uses the new SDK-style .csproj
format? I drew inspiration from this question about WPF, and that got me 90% of the way there.
After that, I began using the MSBuild.Sdk.Extras package, which gave me access to uap10.0
as a <TargetFramework>
, and after a little bit of tweaking, I got it actually compiling with the following .csproj
:
<Project Sdk="MSBuild.Sdk.Extras">
<PropertyGroup>
<!--UWP-specific properties-->
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.17134.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17134.0</TargetPlatformMinVersion>
<TargetFrameworks>uap10.0</TargetFrameworks>
<OutputType>AppContainerExe</OutputType>
<LanguageTargets>$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets</LanguageTargets>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<PackageCertificateKeyFile>Test.UWP_TemporaryKey.pfx</PackageCertificateKeyFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<OutputPath>bin\x86\Debug\</OutputPath>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<PlatformTarget>x86</PlatformTarget>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<ItemGroup>
<!--XAML stuff-->
<ApplicationDefinition Include="App.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</ApplicationDefinition>
<Page Include="**\*.xaml" Exclude="App.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Compile Update="**\*.xaml.cs" SubType="Code" DependentUpon="%(Filename)" />
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
<!--Local projects-->
<!--Nuget references-->
</ItemGroup>
</Project>
However, a few problems remain:
- When comparing a stock UWP project, and my custom project, the custom project's compiled
/bin
directory doesn't seem to include dependency .dlls. (/bin dir for custom project on the left, stock UWP project on the right.)
- Visual Studio's intellisense complains about built-in XAML types not being supported.
...which leads to the resultant .exe immediately crashing on boot.
Does anyone have advice for how to get this thing to the finish line?