Visual Studio for Mac can compile but cannot run iOS app - ios

I have a Xamarin.Forms project in Visual Studio for Mac. Currently, I am able to build the iOS project, but I am not given the option to run it:
Additionally, I have many build types available. None of them allow me to run.
Most of the progress I've made has been in the iOS csproj file, so here it is.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\Xamarin.Forms.3.4.0.1008975\build\Xamarin.Forms.props" Condition="Exists('..\..\packages\Xamarin.Forms.3.4.0.1008975\build\Xamarin.Forms.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">iPhone</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{A49C2037-7B2A-43EB-BCDB-62E1BEEB4EE7}</ProjectGuid>
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>APPNAME.iOS</RootNamespace>
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
<AssemblyName>APPNAME.iOS</AssemblyName>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhone\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<MtouchArch>ARM64</MtouchArch>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchDebug>true</MtouchDebug>
<!--<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>-->
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<MtouchArch>x86_64</MtouchArch>
<MtouchLink>None</MtouchLink>
<MtouchDebug>true</MtouchDebug>
<CodesignEntitlements></CodesignEntitlements>
<CodesignKey>iPhone Developer</CodesignKey>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\iPhone\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchArch>ARMv7, ARM64</MtouchArch>
<ConsolePause>false</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
<!--<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>-->
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhone' ">
<DebugType>none</DebugType>
<Optimize>True</Optimize>
<OutputPath>bin\iPhone\Ad-Hoc</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
<MtouchArch>ARMv7, ARM64</MtouchArch>
<BuildIpa>True</BuildIpa>
<CodesignProvision>Automatic:AdHoc</CodesignProvision>
<CodesignKey>iPhone Distribution</CodesignKey>
<!--<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>-->
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' ">
<DebugType>none</DebugType>
<Optimize>True</Optimize>
<OutputPath>bin\iPhone\AppStore</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
<MtouchArch>ARMv7, ARM64</MtouchArch>
<CodesignProvision>Automatic:AppStore</CodesignProvision>
<CodesignKey>iPhone Distribution</CodesignKey>
<!--<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>-->
</PropertyGroup>
<PropertyGroup Condition=" '$(RunConfiguration)' == 'Default' ">
<AppExtensionDebugBundleId />
</PropertyGroup>
<ItemGroup>
<Compile Include="Data\NetworkConnection.cs" />
<Compile Include="Data\SQL_IOS.cs" />
<Compile Include="Helpers\Settings.cs" />
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
<None Include="app.config" />
<None Include="Entitlements.plist" />
<None Include="Info.plist" />
<Compile Include="Properties\AssemblyInfo.cs" />
<ITunesArtwork Include="iTunesArtwork" />
<ITunesArtwork Include="iTunesArtwork#2x" />
<None Include="packages.config" />
<Compile Include="PicturePickerImplementation.cs" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\Default-568h%402x.png" />
<BundleResource Include="Resources\Default-Portrait.png" />
<BundleResource Include="Resources\Default-Portrait%402x.png" />
<BundleResource Include="Resources\Default.png" />
<BundleResource Include="Resources\Default%402x.png" />
<BundleResource Include="Resources\Icon-60%402x.png" />
<BundleResource Include="Resources\Icon-60%403x.png" />
<BundleResource Include="Resources\Icon-76.png" />
<BundleResource Include="Resources\Icon-76%402x.png" />
<BundleResource Include="Resources\Icon-Small-40.png" />
<BundleResource Include="Resources\Icon-Small-40%402x.png" />
<BundleResource Include="Resources\Icon-Small-40%403x.png" />
<BundleResource Include="Resources\Icon-Small.png" />
<BundleResource Include="Resources\Icon-Small%402x.png" />
<BundleResource Include="Resources\Icon-Small%403x.png" />
<InterfaceDefinition Include="Resources\LaunchScreen.storyboard" />
<BundleResource Include="Resources\passwordicon.png" />
<BundleResource Include="Resources\usernameicon.png" />
<BundleResource Include="Resources\checkmark.png" />
<BundleResource Include="Resources\loading.jpg" />
<BundleResource Include="Resources\noimage.jpeg" />
</ItemGroup>
<ItemGroup>
<Reference Include="Plugin.Settings, Version=3.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xam.Plugins.Settings.3.1.1\lib\Xamarin.iOS10\Plugin.Settings.dll</HintPath>
</Reference>
<Reference Include="Plugin.Settings.Abstractions, Version=3.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xam.Plugins.Settings.3.1.1\lib\Xamarin.iOS10\Plugin.Settings.Abstractions.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.iOS" />
<Reference Include="SQLitePCLRaw.core">
<HintPath>..\..\packages\SQLitePCLRaw.core.1.1.11\lib\Xamarin.iOS10\SQLitePCLRaw.core.dll</HintPath>
</Reference>
<Reference Include="SQLitePCLRaw.provider.sqlite3">
<HintPath>..\..\packages\SQLitePCLRaw.provider.sqlite3.ios_unified.1.1.11\lib\Xamarin.iOS10\SQLitePCLRaw.provider.sqlite3.dll</HintPath>
</Reference>
<Reference Include="SQLitePCLRaw.batteries_green">
<HintPath>..\..\packages\SQLitePCLRaw.bundle_green.1.1.11\lib\Xamarin.iOS10\SQLitePCLRaw.batteries_green.dll</HintPath>
</Reference>
<Reference Include="SQLitePCLRaw.batteries_v2">
<HintPath>..\..\packages\SQLitePCLRaw.bundle_green.1.1.11\lib\Xamarin.iOS10\SQLitePCLRaw.batteries_v2.dll</HintPath>
</Reference>
<Reference Include="SQLite-net">
<HintPath>..\..\packages\sqlite-net-pcl.1.5.231\lib\netstandard1.1\SQLite-net.dll</HintPath>
</Reference>
<Reference Include="Plugin.Connectivity.Abstractions">
<HintPath>..\..\packages\Xam.Plugin.Connectivity.3.2.0\lib\Xamarin.iOS10\Plugin.Connectivity.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Plugin.Connectivity">
<HintPath>..\..\packages\Xam.Plugin.Connectivity.3.2.0\lib\Xamarin.iOS10\Plugin.Connectivity.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Core">
<HintPath>..\..\packages\Xamarin.Forms.3.4.0.1008975\lib\Xamarin.iOS10\Xamarin.Forms.Core.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform">
<HintPath>..\..\packages\Xamarin.Forms.3.4.0.1008975\lib\Xamarin.iOS10\Xamarin.Forms.Platform.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform.iOS">
<HintPath>..\..\packages\Xamarin.Forms.3.4.0.1008975\lib\Xamarin.iOS10\Xamarin.Forms.Platform.iOS.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Xaml">
<HintPath>..\..\packages\Xamarin.Forms.3.4.0.1008975\lib\Xamarin.iOS10\Xamarin.Forms.Xaml.dll</HintPath>
</Reference>
<Reference Include="WebP.Touch">
<HintPath>..\..\packages\WebP.Touch.1.0.8\lib\Xamarin.iOS10\WebP.Touch.dll</HintPath>
</Reference>
<Reference Include="FFImageLoading">
<HintPath>..\..\packages\Xamarin.FFImageLoading.2.4.4.859\lib\Xamarin.iOS10\FFImageLoading.dll</HintPath>
</Reference>
<Reference Include="FFImageLoading.Platform">
<HintPath>..\..\packages\Xamarin.FFImageLoading.2.4.4.859\lib\Xamarin.iOS10\FFImageLoading.Platform.dll</HintPath>
</Reference>
<Reference Include="FFImageLoading.Forms">
<HintPath>..\..\packages\Xamarin.FFImageLoading.Forms.2.4.4.859\lib\Xamarin.iOS10\FFImageLoading.Forms.dll</HintPath>
</Reference>
<Reference Include="FFImageLoading.Forms.Platform">
<HintPath>..\..\packages\Xamarin.FFImageLoading.Forms.2.4.4.859\lib\Xamarin.iOS10\FFImageLoading.Forms.Platform.dll</HintPath>
</Reference>
<Reference Include="FFImageLoading.Transformations">
<HintPath>..\..\packages\Xamarin.FFImageLoading.Transformations.2.4.4.859\lib\Xamarin.iOS10\FFImageLoading.Transformations.dll</HintPath>
</Reference>
<Reference Include="Plugin.Permissions">
<HintPath>..\..\packages\Plugin.Permissions.3.0.0.12\lib\xamarinios10\Plugin.Permissions.dll</HintPath>
</Reference>
<Reference Include="Plugin.Media">
<HintPath>..\..\packages\Xam.Plugin.Media.4.0.1.5\lib\xamarinios10\Plugin.Media.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http" />
<Reference Include="Xamarin.Auth">
<HintPath>..\..\packages\Xamarin.Auth.1.6.0.4\lib\Xamarin.iOS10\Xamarin.Auth.dll</HintPath>
</Reference>
<Reference Include="System.Json" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\APPNAME\APPNAME.csproj">
<Project>{B1A336E0-3016-4315-8143-1ED508B427B2}</Project>
<Name>APPNAME</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Resources\Brushed.png" />
<Content Include="Resources\metal.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\icon.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</BundleResource>
</ItemGroup>
<ItemGroup>
<Content Include="Resources\logo.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<Import Project="..\..\packages\Xamarin.Forms.3.4.0.1008975\build\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.3.4.0.1008975\build\Xamarin.Forms.targets')" />
</Project>
I am able to build and run a new xamarin iOS project.
How can I configure my project to allow me to run my iOS app?

Firstly, check in your Solution Options (right click on Solution -> Options or double click solution) if you have Build property checked on your iOS project: .
You might also find that the build property is checked, but the configuration is set to something other than Debug|iPhoneSimulator. You can edit the configuration to Debug|iPhoneSimulator by clicking on it:
Secondly, on the bar select Debug | iPhone simulator, select the simulator you want to use and you should be ready.

Check there's nothing listening on the debugger's port. Right click on you ios project => options => Build => ios Debug, then change the port to a different one.
I got the same error because i was running Azurite which uses the default debugger's 10000 for its blob storage.
I changed it to a different for has in the screenshot and it started working again.

Related

MSBuild not adding a /reference for nuget PackageReference when building with jenkins

I have a jenkins build that cleans, restores, and then builds a unit test project. This project, along with my others, have recently been migrated to use PackageReference. The clean works, and the restore works. I verified that NUnit exists in %userprofile%/.nuget/packages/. Here are the commands that are in my build script:
msbuild /p:Configuration="Debug" /t:clean OtherProjectName.Test.csproj
msbuild /p:Configuration="Debug" /t:restore OtherProjectName.Test.csproj
msbuild /p:Configuration="Debug" OtherProjectName.Test.csproj
This later results in output that looks something like this:
csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /define:DEBUG;TRACE /highentropyva+
/reference:<one of my references> /reference:<another one> /reference:<and so on>
/out:obj\Debug\OtherProjectName.Test.dll /subsystemversion:6.00 /target:library /utf8output <a list of source files>
The build for my project fails because it can't find NUnit (see below). I believe it can't find NUnit because the compilation command does not include a "/reference" to the NUnit nuget package.
error CS0246: The type or namespace name 'NUnit' could not be found (are you missing a using directive or an assembly reference?
My other projects do have '/reference' for NuGet packages. So I compared them to see if anything looked significantly different. I did notice that most of my projects include this line at the start:
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
I thought that might be the culprit, based on my brief reading on what this line does, but when I tried the same steps on my local machine (it has VS2017 and MSbuild 15, just like the jenkins server) I could not replicate the issue.
My .csproj file has the following:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{a guid}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OtherProjectName.Test</RootNamespace>
<AssemblyName>OtherProjectName.Test</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<!-- a couple entries like this -->
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net">
<HintPath>Z:\path\to\log4net.dll</HintPath>
</Reference>
<!-- a couple references like this -->
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup>
</When>
<Otherwise />
</Choose>
<ItemGroup>
<!-- all my C# source files -->
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OtherProjectName\OtherProjectName.csproj">
<Project>{a guid}</Project>
<Name>OtherProjectName</Name>
</ProjectReference>
<ProjectReference Include="..\OtherProjectName2\OtherProjectName2.csproj">
<Project>{another guid}</Project>
<Name>OtherProjectName2</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="App.config">
<SubType>Designer</SubType>
</None>
<None Include="App.config.1" />
<None Include="Unit Test Playlists\Fast.playlist" />
<!-- all my unit test playlists -->
</ItemGroup>
<ItemGroup>
<PackageReference Include="NUnit">
<Version>3.11.0</Version>
</PackageReference>
<PackageReference Include="NUnit.ConsoleRunner">
<Version>3.9.0</Version>
</PackageReference>
<PackageReference Include="NUnit3TestAdapter">
<Version>3.11.0</Version>
</PackageReference>
<!-- other nuget packages -->
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
</ItemGroup>
</When>
</Choose>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
Please compare the version of the MSBUILD on your local and the build server. Looks like you might have a lower version of MSBUILD running on the build server that doesn't support packagereferences.

compiling uwp-community-toolkit dll issue

A contributor made some updates to "Toolkit.win32.ui.controls" in their own branch. I downloaded, compiled, and referenced the resulting dll in my project. I see the API changes in the Object Browser (see attached image); However, the compiler does not seem to see these changes, as I get errors whenever I try to use the additional APIs.
The branch: https://github.com/rjmurillo/UWPCommunityToolkit/tree/WebView/NavigateWithHttpMessage
The changes he made:
https://github.com/Microsoft/WindowsCommunityToolkit/pull/2195
Where the error occurs:
Uri url = webView.BuildLocalStreamUri("MyTag", "/Minesweeper/default.html");
The error:
Severity Code Description Project File Line Suppression State
Error CS1061 'WebView' does not contain a definition for 'BuildLocalStreamUri' and no extension method 'BuildLocalStreamUri' accepting a first argument of type 'WebView' could be found (are you missing a using directive or an assembly reference?) Test.WPF C:\Users\Adam\Desktop\Test.WPF\MainWindow.xaml.cs 29 Active
It's almost as if it is still using the original, unmodified, version of the reference, because it does recognize "WebView".
The XAML:
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SparkStore.WPF"
xmlns:winforms="clr-namespace:Microsoft.Toolkit.Win32.UI.Controls.WinForms;assembly=Microsoft.Toolkit.Win32.UI.Controls"
xmlns:WPF="clr-namespace:Microsoft.Toolkit.Win32.UI.Controls.WPF;assembly=Microsoft.Toolkit.Win32.UI.Controls" x:Class="Test.WPF.MainWindow"
mc:Ignorable="d"
Title="Test" Height="450" Width="800">
<Grid>
<WPF:WebView x:Name="webView" Margin="0"/>
</Grid>
</Window>
The project file:
[![<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{525B29B6-0498-46D2-A1E9-EDBBFA4FA34D}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>Test.WPF</RootNamespace>
<AssemblyName>Test.WPF</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Toolkit.Win32.UI.Controls">
<HintPath>..\UWPCommunityToolkit\Microsoft.Toolkit.Win32\Microsoft.Toolkit.Win32.UI.Controls\bin\AnyCPU\Release\net462\Microsoft.Toolkit.Win32.UI.Controls.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Design" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.6.1">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.6.1 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Resource Include="Readme.txt" />
</ItemGroup>
<Import Project="..\Test\Test.projitems" Label="Shared" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>][1]][1]
One of the goals of the Windows Community Toolkit version of the WebView is to provide separation between WinRT and .NET concepts and provide an abstraction from the nature and limitations of providing a bridge between Win32 and UWP applications, so some APIs were omitted from the initial release. By exposing BuildLocalStreamUri(String, String) without any abstraction, the return value provides a relative URI to the Win32WebViewHost UWP application hosting the web view (e.g. ms-local-stream://microsoft.win32webviewhost_cw5n1h2txyewy_54657374/foo.htm), rather than the Windows Forms or WPF application itself, which can be confusing.
The branch mentioned does provide support for BuildLocalStreamUri, however, it is intended to be used within the context of NavigateToLocalStreamUri(Uri, IUriToStreamResolver) or NavigateToLocal(String) to provide that abstraction. Using either of those methods will invoke BuildLocalStreamUri internally to normalize the URI, and invoke an instance of IUriToStreamResolver to translate an asset to a System.IO.Stream.

Build project with multiple targetframeworks in TFS as a NuGet package

I want to build my NuGet package in one of my TFS build steps.
Because .NET Standard 2.0 is currently not supported by the TFS NuGet step, I am using /t:pack as the build argument in my MSBuild invocation.
When I only use one TargetFramework it is working fine. My assemblies get a version and my NuGet package too.
Even if I am using an AssemblyInfo.cs in .NET Standard 2.0 - explained in this answer.
So far no problem, but if I want to build now on two different TargetFrameworks like <TargetFramework>netstandard2.0;net45</TargetFramework> my NuGet package won't get a Version.
So in the end this is working and is generating a versioned NuGet file.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<GenerateNuspecDependsOn>$(GenerateNuspecDependsOn);ReadPackageVersionFromOutputAssembly</GenerateNuspecDependsOn>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<Target Name="ReadPackageVersionFromOutputAssembly" DependsOnTargets="Build">
<GetAssemblyIdentity AssemblyFiles="$(TargetPath)">
<Output TaskParameter="Assemblies" ItemName="PackAssembly" />
</GetAssemblyIdentity>
<PropertyGroup>
<PackageVersion>%(PackAssembly.Version)</PackageVersion>
</PropertyGroup>
</Target>
<ItemGroup>
<Compile Remove="AccessControl\**" />
<EmbeddedResource Remove="AccessControl\**" />
<None Remove="AccessControl\**" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\common\Version.cs" Link="Properties\Version.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Threading.Tasks.Dataflow" Version="4.8.0" />
</ItemGroup>
<ItemGroup>
<Reference Include="MyEngine">
<HintPath>..\libs\NetStandard\MyEngine.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
</Project>
So here is my current .csproj file. This builds too and also generates a NuGet file. But in this case my NuGet file is unversioned. Why is it this way and how can I fix it?
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<GenerateNuspecDependsOn>$(GenerateNuspecDependsOn);ReadPackageVersionFromOutputAssembly</GenerateNuspecDependsOn>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<Target Name="ReadPackageVersionFromOutputAssembly" DependsOnTargets="Build">
<GetAssemblyIdentity AssemblyFiles="$(TargetPath)">
<Output TaskParameter="Assemblies" ItemName="PackAssembly" />
</GetAssemblyIdentity>
<PropertyGroup>
<PackageVersion>%(PackAssembly.Version)</PackageVersion>
</PropertyGroup>
</Target>
<ItemGroup>
<Compile Remove="AccessControl\**" />
<EmbeddedResource Remove="AccessControl\**" />
<None Remove="AccessControl\**" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\common\Version.cs" Link="Properties\Version.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Threading.Tasks.Dataflow" Version="4.8.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<Reference Include="MyEngine">
<HintPath>..\libs\NetStandard\MyEngine.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net45'">
<Reference Include="MyEngine">
<HintPath>..\libs\NET45\MyEngine.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
</Project>
The targets can be adapted to support multi-targeting like this:
<Target Name="ReadPackageVersionFromOutputAssemblySingleTfm" Returns="#(PackAssembly)" Condition="'$(IsCrossTargetingBuild)' != 'true'">
<GetAssemblyIdentity AssemblyFiles="$(TargetPath)">
<Output TaskParameter="Assemblies" ItemName="PackAssembly" />
</GetAssemblyIdentity>
<PropertyGroup>
<PackageVersion>%(PackAssembly.Version)</PackageVersion>
</PropertyGroup>
</Target>
<Target Name="ReadPackageVersionFromOutputAssemblyMultipleTfms" Condition="'$(IsCrossTargetingBuild)' == 'true'">
<PropertyGroup>
<FirstTargetFramework>$([System.String]::Copy($(TargetFrameworks)).Split(';').GetValue(0))</FirstTargetFramework>
</PropertyGroup>
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="ReadPackageVersionFromOutputAssemblySingleTfm" Properties="TargetFramework=$(FirstTargetFramework)">
<Output TaskParameter="TargetOutputs" ItemName="PackAssembly" />
</MSBuild>
<PropertyGroup>
<PackageVersion>%(PackAssembly.Version)</PackageVersion>
</PropertyGroup>
</Target>
<Target Name="ReadPackageVersionFromOutputAssembly" DependsOnTargets="Build;ReadPackageVersionFromOutputAssemblySingleTfm;ReadPackageVersionFromOutputAssemblyMultipleTfms" />

MSBuild - Circular dependency in the target dependency graph

I am getting the following error in my build
Error MSB4006: There is a circular dependency in the target dependency graph involving target "DoPublish".
The DoPublish is triggering Publish and I assume the Build. How can I avoid this.
I am using the Visual Studio build. I was using the MSBUILD with the targets /t:UpdateVersion;DoPublish;publish, which worked. I would like to use the Visual Studio build in TFS instead of MSBUILD
Project:
<Target Name="UpdateVersion" AfterTargets="PostBuildEvent">
<RevisionTask>
<Output TaskParameter="PublishVersion" PropertyName="PublishVersion" />
</RevisionTask>
<Message Text="The Version is $(PublishVersion)" Importance="high" />
<PropertyGroup>
<ApplicationVersion>$(PublishVersion)</ApplicationVersion>
</PropertyGroup>
<ItemGroup>
<ConfigFile Include="$(MSBuildProjectDirectory)\Configs\$(Configuration)\AppDeploy.config" />
</ItemGroup>
<Copy SourceFiles="#(ConfigFile)" DestinationFolder="$(TargetDir)" Condition=" '$(Configuration)' == 'DEV' OR '$(Configuration)' == 'SIT' OR '$(Configuration)' == 'UAT' " ContinueOnError="true" />
<Copy SourceFiles="#(ConfigFile)" DestinationFolder="$(MSBuildProjectDirectory)" Condition=" '$(Configuration)' == 'DEV' OR '$(Configuration)' == 'SIT' OR '$(Configuration)' == 'UAT' " ContinueOnError="true" />
<Message Text="Copying File from $(MSBuildProjectDirectory)\Configs\$(Configuration)\Web.config to $(TargetDir)" Importance="high" />
</Target>
<Target Name="DoPublish" AfterTargets="UpdateVersion" Condition=" '$(BuildingInsideVisualStudio)' != '' ">
<MSBuild Projects="$(ProjectFileName)" Targets="Publish" Properties="ApplicationVersion=$(PublishVersion)" />
<!-- Write publish.htm file for ClickOnce -->
<Message Text="FileUpdate - $(ProjectDir)\Configs\publish.htm: Replace {PublishVersion} with $(PublishVersion)" Importance="high" />
<FileUpdate Files="$(ProjectDir)\Configs\publish.htm" IgnoreCase="true" Multiline="true" Singleline="false" Regex="{PublishVersion}" ReplacementText="$(PublishVersion)" />
<Message Text="FileUpdate - $(ProjectDir)\Configs\publish.htm: Replace {AssemblyName} with $(AssemblyName)" Importance="high" />
<FileUpdate Files="$(ProjectDir)\Configs\publish.htm" IgnoreCase="true" Multiline="true" Singleline="false" Regex="{AssemblyName}" ReplacementText="$(AssemblyName)" />
<Message Text="FileUpdate - $(ProjectDir)\Configs\publish.htm: Replace {ProductName} with $(ProductName)" Importance="high" />
<FileUpdate Files="$(ProjectDir)\Configs\publish.htm" IgnoreCase="true" Multiline="true" Singleline="false" Regex="{ProductName}" ReplacementText="$(ProductName)" />
<Copy SourceFiles="$(ProjectDir)\Configs\publish.htm" DestinationFiles="$(PublishDir)publish.htm" />
</Target>
I created a web app project and tested this on my environment (TFS2015) with following of your code kept:
<Target Name="UpdateVersion" AfterTargets="PostBuildEvent">
<Message Text="The Version is $(PublishVersion)" Importance="high" />
<PropertyGroup>
<ApplicationVersion>$(PublishVersion)</ApplicationVersion>
</PropertyGroup>
<Message Text="Copying File from $(MSBuildProjectDirectory)\Configs\$(Configuration)\Web.config to $(TargetDir)" Importance="high" />
</Target>
<Target Name="DoPublish" AfterTargets="UpdateVersion" Condition="'$(BuildingInsideVisualStudio)' != 'true'">
<MSBuild Projects="$(ProjectFileName)" Targets="Publish" />
</Target>
But I couldn't reproduce this issue. The build can be completed successfully. I can only see MSB4006 error when "Target="Publish" isn't added in "DoPublish" target.
I changed Condition=" '$(BuildingInsideVisualStudio)' != '' " to Condition="'$(BuildingInsideVisualStudio)' != 'true'" as the BuildingInsideVisualStudio value is always empty under my environment. "DoPublish" target does not run with Condition=" '$(BuildingInsideVisualStudio)' != '' ".
Since I cannot add comment, I have a question need to check here: What do you mean by using the Visual Studio build in TFS instead of MSBUILD?
After seeing this post I came up with similar solution overriding the AfterPubish target.
To correct the circular dependency, just change the target name to AfterPublish and removed the AfterTargerts attribute.
<Target Name="AfterPublish" Condition=" '$(BuildingInsideVisualStudio)' != '' ">
<MSBuild Projects="$(ProjectFileName)" Targets="Publish" Properties="ApplicationVersion=$(PublishVersion)" />
<!-- Write publish.htm file for ClickOnce -->
<Message Text="FileUpdate - $(ProjectDir)\Configs\publish.htm: Replace {PublishVersion} with $(PublishVersion)" Importance="high" />
<FileUpdate Files="$(ProjectDir)\Configs\publish.htm" IgnoreCase="true" Multiline="true" Singleline="false" Regex="{PublishVersion}" ReplacementText="$(PublishVersion)" />
<Message Text="FileUpdate - $(ProjectDir)\Configs\publish.htm: Replace {AssemblyName} with $(AssemblyName)" Importance="high" />
<FileUpdate Files="$(ProjectDir)\Configs\publish.htm" IgnoreCase="true" Multiline="true" Singleline="false" Regex="{AssemblyName}" ReplacementText="$(AssemblyName)" />
<Message Text="FileUpdate - $(ProjectDir)\Configs\publish.htm: Replace {ProductName} with $(ProductName)" Importance="high" />
<FileUpdate Files="$(ProjectDir)\Configs\publish.htm" IgnoreCase="true" Multiline="true" Singleline="false" Regex="{ProductName}" ReplacementText="$(ProductName)" />
<Copy SourceFiles="$(ProjectDir)\Configs\publish.htm" DestinationFiles="$(PublishDir)publish.htm" />
</Target>

Error deploying asp.net mvc 3 projects to Windows Azure web site

I have an asp.net mvc 3 project and a separate BusinessLayer project included in the solution. When I'm trying to deploy my site to Azure via local git repository, I'm getting the following error: '<remote_path>\BusinessLayer\BusinessLayer.csproj' is not a deployable project.. No other information is provided in logs. Site perfectly deploys on my local server. So I want to know at least some possible reasons why this error occurs. Thanks in advance.
Here's my .csproj file, if necessary:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{31F2F6FE-10D8-4510-AC61-CBE1962D3940}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BusinessLayer</RootNamespace>
<AssemblyName>BusinessLayer</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="MongoDB.Bson">
<HintPath>..\..\Libs\MongoDB.Bson.dll</HintPath>
</Reference>
<Reference Include="MongoDB.Driver">
<HintPath>..\..\Libs\MongoDB.Driver.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Battle.cs" />
<Compile Include="BattleManager.cs" />
<Compile Include="BattlePlace.cs" />
<Compile Include="Helpers\ConvertHelper.cs" />
<Compile Include="Helpers\ImageHelper.cs" />
<Compile Include="Message.cs" />
<Compile Include="Picture.cs" />
<Compile Include="Place.cs" />
<Compile Include="PlaceManager.cs" />
<Compile Include="Subject.cs" />
<Compile Include="User.cs" />
<Compile Include="Helpers\DBHelper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
You may need to tell Azure exactly which project it should deploy, which you can do using a .deployment file at the root of your project. e.g.
[config]
project = WebProject/WebProject.csproj
Please see this page for more information about this.
Sounds like you're trying to deploy the BusinessLayer project and not the Website project. As long as your MVC site project has a reference to BusinessLayer, just deploy the website. BusinessLayer will be included as a reference.
You can't deploy BusinessLayer by itself, as it is a library and not an application.

Resources