Xamarin Android Archive error. Invalid Android Archive (no .APK files) - xamarin

I am trying to publish an APK for a PCL Xamarin project. I am following these steps: Publishing An Application and at the 'Archive for Publishing' step I get the following error after a small wait:
"Failed to create App archive 'MyProject_Test.Droid' Invalid Android
Archive (no .APK files)"
I have rebuild my Solution and tried running Visual Studio with Administration Privileges. If you need any log files or details from me, I will provide those you request (not sure which log files will help with this)
I am using Visual Studio 2017 Enterprise.
My project file contents:
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectGuid>{58739EF0-7612-43F3-BF3D-E752CCCCFF44}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>IsoMetrix_Mobile.Droid</RootNamespace>
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<AndroidResgenClass>Resource</AndroidResgenClass>
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
<AndroidApplication>True</AndroidApplication>
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
<TargetFrameworkVersion>v6.0</TargetFrameworkVersion>
<AssemblyName>IsoMetrix_Mobile.Droid</AssemblyName>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidLinkMode>None</AndroidLinkMode>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
<ConsolePause>false</ConsolePause>
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
<BundleAssemblies>false</BundleAssemblies>
<EnableProguard>false</EnableProguard>
<AndroidSupportedAbis>armeabi;armeabi-v7a</AndroidSupportedAbis>
</PropertyGroup>
<ItemGroup>
<Reference Include="FormsViewGroup, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.2.3.1.114\lib\MonoAndroid10\FormsViewGroup.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Java.Interop" />
<Reference Include="SQLite-net, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\sqlite-net-pcl.1.1.2\lib\portable-net45+wp8+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10\SQLite-net.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SQLitePCL.batteries, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\SQLitePCL.bundle_green.0.9.2\lib\MonoAndroid\SQLitePCL.batteries.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SQLitePCL.raw, Version=0.9.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\SQLitePCL.raw.0.9.2\lib\MonoAndroid\SQLitePCL.raw.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SQLitePCLPlugin_esqlite3, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\SQLitePCL.plugin.sqlite3.android.0.9.2\lib\MonoAndroid\SQLitePCLPlugin_esqlite3.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="Mono.Android" />
<Reference Include="Xamarin.Android.Support.Animated.Vector.Drawable, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.Animated.Vector.Drawable.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Xamarin.Android.Support.Design, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Android.Support.Design.23.3.0\lib\MonoAndroid43\Xamarin.Android.Support.Design.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Xamarin.Android.Support.v4, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Android.Support.v4.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v4.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Xamarin.Android.Support.v7.AppCompat, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Android.Support.v7.AppCompat.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.AppCompat.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Xamarin.Android.Support.v7.CardView, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Android.Support.v7.CardView.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.CardView.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Xamarin.Android.Support.v7.MediaRouter, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Android.Support.v7.MediaRouter.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.MediaRouter.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Xamarin.Android.Support.v7.RecyclerView, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Android.Support.v7.RecyclerView.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.RecyclerView.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Xamarin.Android.Support.Vector.Drawable, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.Vector.Drawable.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.2.3.1.114\lib\MonoAndroid10\Xamarin.Forms.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Xamarin.Forms.Platform, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.2.3.1.114\lib\MonoAndroid10\Xamarin.Forms.Platform.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Xamarin.Forms.Platform.Android, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.2.3.1.114\lib\MonoAndroid10\Xamarin.Forms.Platform.Android.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Xamarin.Forms.Xaml, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.2.3.1.114\lib\MonoAndroid10\Xamarin.Forms.Xaml.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\IsoMetrix_Mobile\IsoMetrix_Mobile.csproj">
<Name>IsoMetrix_Mobile</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="Activities\IBasePresenter.cs" />
<Compile Include="Activities\IBaseView.cs" />
<Compile Include="Activities\Login\LoginContract.cs" />
<Compile Include="Activities\Login\LoginFragment.cs" />
<Compile Include="Activities\Login\LoginPresenter.cs" />
<Compile Include="Activities\ModuleInstanceSelection\ModuleInstanceListAdapter.cs" />
<Compile Include="Activities\ModuleInstanceSelection\ExpandableSolutionProcessListAdapter.cs" />
<Compile Include="Activities\Login\LoginActivity.cs" />
<Compile Include="Activities\ModuleInstanceSelection\ModuleInstanceSelectionActivity.cs" />
<Compile Include="Activities\ModuleInstanceSelection\ProcessSelectionActivity.cs" />
<Compile Include="Activities\ModuleInstance\Control\Checkbox.cs" />
<Compile Include="Activities\ModuleInstance\Control\Datepicker\Datepicker.cs" />
<Compile Include="Activities\ModuleInstance\Control\Dropdown\Dropdown.cs" />
<Compile Include="Activities\ModuleInstance\Control\Dropdown\DropdownAdapter.cs" />
<Compile Include="Activities\ModuleInstance\Control\Dropdown\DropdownClickListener.cs" />
<Compile Include="Activities\ModuleInstance\Control\Label.cs" />
<Compile Include="Activities\ModuleInstance\Control\NumberBox.cs" />
<Compile Include="Activities\ModuleInstance\Control\Unsupported.cs" />
<Compile Include="Activities\ModuleInstance\Control\Textbox.cs" />
<Compile Include="Activities\ModuleInstance\Control\Timepicker\Timepicker.cs" />
<Compile Include="Activities\ModuleInstance\RecordListActivity.cs" />
<Compile Include="Activities\ModuleInstance\Control\Timepicker\TimePickerFragment.cs" />
<Compile Include="Activities\ModuleInstance\Control\Datepicker\DatePickerFragment.cs" />
<Compile Include="Activities\ModuleInstance\RecordViewActivity.cs" />
<Compile Include="Activities\ModuleInstance\Control\ControlFactory.cs" />
<Compile Include="Activities\Utils.cs" />
<Compile Include="Core\DependencyServices\AuthenticationAndroid.cs" />
<Compile Include="Core\Helper.cs" />
<Compile Include="Resources\Resource.designer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Core\DependencyServices\SQLiteAndroid.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="Resources\AboutResources.txt" />
<None Include="Properties\AndroidManifest.xml" />
<None Include="Assets\AboutAssets.txt" />
<AndroidResource Include="Resources\layout\ProcessSelection.axml">
<SubType>Designer</SubType>
</AndroidResource>
<AndroidResource Include="Resources\layout\ProcessListItem.axml">
<SubType>Designer</SubType>
</AndroidResource>
<AndroidResource Include="Resources\layout\ModuleInstanceListItem.axml">
<SubType>Designer</SubType>
</AndroidResource>
<AndroidResource Include="Resources\layout\ModuleInstanceSelection.axml">
<SubType>Designer</SubType>
</AndroidResource>
<AndroidResource Include="Resources\layout\ModuleInstanceRecordViewer.axml">
<SubType>Designer</SubType>
</AndroidResource>
<AndroidResource Include="Resources\layout\TextViewItem.axml">
<SubType>Designer</SubType>
</AndroidResource>
<AndroidResource Include="Resources\layout\ModuleInstanceRecordList.axml">
<SubType>Designer</SubType>
</AndroidResource>
<AndroidResource Include="Resources\layout\Login_Act.axml" />
<AndroidResource Include="Resources\layout\Login_Frag.axml" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\values\Strings.xml" />
<AndroidResource Include="Resources\drawable-hdpi\Icon.png" />
<AndroidResource Include="Resources\drawable-mdpi\Icon.png" />
<AndroidResource Include="Resources\drawable-xhdpi\Icon.png" />
<AndroidResource Include="Resources\drawable-xxhdpi\Icon.png" />
<AndroidResource Include="Resources\drawable-xxxhdpi\Icon.png" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
<Import Project="..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets'))" />
<Error Condition="!Exists('..\..\packages\Xamarin.Forms.2.3.1.114\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Forms.2.3.1.114\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets'))" />
</Target>
<Import Project="..\..\packages\Xamarin.Forms.2.3.1.114\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.2.3.1.114\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />
</Project>

For anyone that happens onto this the way I managed to get it working:
Close VS
Go to your project folder
Open the bin folder and delete everything
Re-open VS and build your solution and then try the archive option

Related

System.IO.FileLoadException when trying to test Entity Framework Core using MSTest - why?

I cannot unit test an Entity Framework Core project using MSTest.
When I do, I always get the following exception when I execute the test:
Test method "EF_Tests.CreateDbTests.CreateDb" threw exception:
System.IO.FileLoadException: Could not load file or assembly "System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
What am I doing wrong?
Here's my project structure and settings:
Here's my project files' content:
Repository.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" />
</ItemGroup>
</Project>
EF-DB.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>EF_DB</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<DebugType>none</DebugType>
<DebugSymbols>false</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.6" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Repository\Repository.csproj" />
</ItemGroup>
</Project>
EF-Tests.csproj
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" 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>{538D0C25-637D-4CDF-BDBC-26AEEB9117FD}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>EF_Tests</RootNamespace>
<AssemblyName>EF-Tests</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.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' ">
<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>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<Compile Include="CreateDbTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\EF-DB\EF-DB.csproj">
<Project>{c6c34842-8e25-4bcb-a20a-6c415baa008e}</Project>
<Name>EF-DB</Name>
</ProjectReference>
<ProjectReference Include="..\Repository\Repository.csproj">
<Project>{b4e6eeda-2439-4674-b127-0fbf91b90a08}</Project>
<Name>Repository</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="MSTest.TestAdapter">
<Version>2.1.2</Version>
</PackageReference>
<PackageReference Include="MSTest.TestFramework">
<Version>2.1.2</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
That's what I thought. Your test csproj is all "frameworked" up.
You want something like this: (which comes from a .net CORE mstest project) (see images below)
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Chronos.Abstractions" Version="2.0.24" />
<PackageReference Include="coverlet.msbuild" Version="2.8.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" Version="5.10.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="Moq" Version="4.13.1" />
<PackageReference Include="MSTest.TestAdapter" Version="2.1.0" />
<PackageReference Include="MSTest.TestFramework" Version="2.1.0" />
<PackageReference Include="coverlet.collector" Version="1.2.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="PasswordGenerator" Version="2.0.5" />
</ItemGroup>
</Project>

visual studio: copy *.pdb of the project references from some directory to TargetDir

There are few solutions (business logic etc) that copies their *.dll and *.pdb to some directories.
<PropertyGroup>
<PostBuildEvent>copy $(TargetPath) $(DllDir)\*.*
copy $(TargetDir)*.pdb $(SymbolsFolder)\*.pdb </ PostBuildEvent> </ PropertyGroup>
there are few GUI-solutions that references these dlls (not each and every just few of them)
for better debugging experience it would be great to have ability during compile time or after successful build to copy *.pdb of referenced assemblies from $(SymbolsFolder) to bin/debug directory of building GUI-project
something like this in GUI's *.csproj file:
<Target Name="Compile">
<MSBuild Projects="#(Reference)" Targets="Build" >
copy $(SymbolsFolder)\'%(Name)'.pdb $(TargetDir)*.pdb
</MSBuild>
this code doesn't work. Can you help me to correct this pseudo-code please?
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" 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>{15E44798-6182-44B0-9302-C96532A334FF}</ProjectGuid>
<OutputType>library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>GuiControls</RootNamespace>
<AssemblyName>GuiControls</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<TargetFrameworkProfile />
</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>
<Prefer32Bit>false</Prefer32Bit>
<UseVSHostingProcess>true</UseVSHostingProcess>
<PlatformTarget>AnyCPU</PlatformTarget>
</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>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>test21.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug_x86|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug_x86\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug_x86|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug_x86\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Releasex86|AnyCPU'">
<OutputPath>bin\Releasex86\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Releasex86|x86'">
<OutputPath>bin\x86\Releasex86\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Accessibility" />
<Reference Include="Pr21BusinessObjects5">
<HintPath>..\..\..\Product21Projects2018\DllsProduct21\Pr21BusinessObjects5.dll</HintPath>
</Reference>
<Reference Include="Pr21BusinessObjects5.DataAccess">
<HintPath>..\..\..\Product21Projects2018\DllsProduct21\Pr21BusinessObjects5.DataAccess.dll</HintPath>
</Reference>
<Reference Include="Pr21BusinessObjectsFlat">
<HintPath>..\..\..\Product21Projects2018\DllsProduct21\Pr21BusinessObjectsFlat.dll</HintPath>
</Reference>
<Reference Include="Pr21Common">
<HintPath>..\..\..\Product21Projects2018\DllsProduct21\Pr21Common.dll</HintPath>
</Reference>
<Reference Include="Product21.Datamodel">
<HintPath>..\..\..\Product21Projects2018\DllsProduct21\Product21.Datamodel.dll</HintPath>
</Reference>
<Reference Include="Product21.Factory">
<HintPath>..\..\..\Product21Projects2018\DllsProduct21\Product21.Factory.dll</HintPath>
</Reference>
<Reference Include="Product21.Utilities">
<HintPath>..\..\..\Product21Projects2018\DllsProduct21\Product21.Utilities.dll</HintPath>
</Reference>
<Reference Include="Product21CodingLists">
<HintPath>..\..\..\Product21Projects2018\DllsProduct21\Product21CodingLists.dll</HintPath>
</Reference>
<Reference Include="Pr21Interfaces">
<HintPath>..\..\..\Product21Projects2018\DllsProduct21\Pr21Interfaces.dll</HintPath>
</Reference>
<Reference Include="Pr21UtilsHelpers">
<HintPath>..\..\..\Product21Projects2018\DllsProduct21\Pr21UtilsHelpers.dll</HintPath>
</Reference>
<Reference Include="BusinessObjects">
<HintPath>..\..\..\Product21Projects2018\DllsProduct21\BusinessObjects.dll</HintPath>
</Reference>
<Reference Include="ConfigurationProduct21, Version=1.0.0.0, Culture=neutral, PublicKeyToken=549588756ec70082, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Product21Projects2018\DllsProduct21\ConfigurationProduct21.dll</HintPath>
</Reference>
<Reference Include="InfragisticsWPF4.Controls.Charts.XamDataChart.v13.1, Version=13.1.20131.2406, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Product21Projects2018\DllsExternal\Infragistics\Infragistics2013\SharedXAML\InfragisticsWPF4.Controls.Charts.XamDataChart.v13.1.dll</HintPath>
</Reference>
<Reference Include="InfragisticsWPF4.DataPresenter.v13.1, Version=13.1.20131.2406, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Product21Projects2018\DllsExternal\Infragistics\Infragistics2013\WPFOnly\InfragisticsWPF4.DataPresenter.v13.1.dll</HintPath>
</Reference>
<Reference Include="InfragisticsWPF4.DataVisualization.v13.1, Version=13.1.20131.2406, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Product21Projects2018\DllsExternal\Infragistics\Infragistics2013\SharedXAML\InfragisticsWPF4.DataVisualization.v13.1.dll</HintPath>
</Reference>
<Reference Include="InfragisticsWPF4.Editors.v13.1, Version=13.1.20131.2406, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Product21Projects2018\DllsExternal\Infragistics\Infragistics2013\WPFOnly\InfragisticsWPF4.Editors.v13.1.dll</HintPath>
</Reference>
<Reference Include="InfragisticsWPF4.v13.1, Version=13.1.20131.2406, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Product21Projects2018\DllsExternal\Infragistics\Infragistics2013\WPFOnly\InfragisticsWPF4.v13.1.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Expression.Interactions, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Product21Projects2018\DllsExternal\Microsoft.Expression.Interactions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.mshtml, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Microsoft.Practices.Prism">
<HintPath>..\..\..\Product21Projects2018\DllsExternal\Microsoft.Practices.Prism.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Practices.Prism.Interactivity">
<HintPath>..\..\..\Product21Projects2018\DllsExternal\Microsoft.Practices.Prism.Interactivity.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Practices.Prism.MefExtensions">
<HintPath>..\..\..\Product21Projects2018\DllsExternal\Microsoft.Practices.Prism.MefExtensions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Practices.Prism.UnityExtensions">
<HintPath>..\..\..\Product21Projects2018\DllsExternal\Microsoft.Practices.Prism.UnityExtensions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Practices.ServiceLocation">
<HintPath>..\..\..\Product21Projects2018\DllsExternal\Microsoft.Practices.ServiceLocation.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Practices.Unity">
<HintPath>..\..\..\Product21Projects2018\DllsExternal\Microsoft.Practices.Unity.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.0.0\lib\net45\NLog.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="PresentationUI, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="Prism, Version=7.1.0.431, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">
<HintPath>..\packages\Prism.Core.7.1.0.431\lib\net45\Prism.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="ReachFramework" />
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Printing" />
<Reference Include="System.ValueTuple, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.3.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Expression.Blend.Sdk.1.0.2\lib\net45\System.Windows.Interactivity.dll</HintPath>
<Private>True</Private>
</Reference>
<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.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="Telerik.Windows.Controls, Version=2020.1.218.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL" />
<Reference Include="Telerik.Windows.Controls.FixedDocumentViewers, Version=2020.1.218.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL" />
<Reference Include="telerik.windows.controls.fixeddocumentviewersui, Version=2020.1.218.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL" />
<Reference Include="Telerik.Windows.Controls.ImageEditor, Version=2020.1.218.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL" />
<Reference Include="Telerik.Windows.Controls.Input, Version=2020.1.218.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL" />
<Reference Include="Telerik.Windows.Controls.Navigation, Version=2020.1.218.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL" />
<Reference Include="Telerik.Windows.Controls.RibbonView, Version=2020.1.218.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL" />
<Reference Include="Telerik.Windows.Controls.RichTextBoxUI, Version=2020.1.218.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL" />
<Reference Include="Telerik.Windows.Documents, Version=2020.1.218.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL" />
<Reference Include="Telerik.Windows.Documents.Core, Version=2020.1.212.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL" />
<Reference Include="Telerik.Windows.Documents.Fixed, Version=2020.1.212.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL" />
<Reference Include="TXTextControl, Version=19.0.1200.500, Culture=neutral, PublicKeyToken=6b83fe9a75cfb638, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Program Files\Text Control GmbH\TX Text Control 19.0.NET for WPF\Assembly\TXTextControl.dll</HintPath>
</Reference>
<Reference Include="UIAutomationProvider" />
<Reference Include="UIAutomationTypes" />
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="WindowsFormsIntegration" />
</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="Product21.snk" />
<None Include="Pr21p.config" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>copy $(TargetPath) $(Pr21DllDir)\*.*
copy $(TargetName).pdb $(Product21SymbolsFolder)\$(TargetName).pdb
if $(ConfigurationName) == Debug (
copy $(Product21SymbolsFolder)\Pr21BusinessObjects5.pdb $(TargetDir)\*.*
copy $(Product21SymbolsFolder)\Pr21BusinessObjectsFlat.pdb $(TargetDir)\*.*
copy $(Product21SymbolsFolder)\Pr21Common.pdb $(TargetDir)\*.*
copy $(Product21SymbolsFolder)\Pr21Constants.pdb $(TargetDir)\*.*
copy $(Product21SymbolsFolder)\Product21.Datamodel.pdb $(TargetDir)\*.*
copy $(Product21SymbolsFolder)\Product21.Factory.pdb $(TargetDir)\*.*
copy $(Product21SymbolsFolder)\Pr21Interfaces.pdb $(TargetDir)\*.*
copy $(Product21SymbolsFolder)\Pr21Styles.pdb $(TargetDir)\*.*
copy $(Product21SymbolsFolder)\BusinessObjects.pdb $(TargetDir)\*.*
)</PostBuildEvent>
</PropertyGroup>
<!-- 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>
visual studio: copy *.pdb of the project references from some
directory to TargetDir
I think the main issue is that you did not define the custom property Pr21DllDir and Product21SymbolsFolder in your xxx.csproj file which I have not seen those properties in your file. So when you execute these command, MSBuild unable to identify $(Pr21DllDir) and $(Product21SymbolsFolder).
Solution
You can try these:
<PropertyGroup>
<Pr21DllDir>C:\xxx\xxxx\xxx(the folder name)</Pr21DllDir>
<Product21SymbolsFolder>C:\xxx\xxx\xxx(the folder name)</Product21SymbolsFolder>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>
copy $(TargetPath) $(Pr21DllDir)\*.*
copy $(TargetName).pdb $(Product21SymbolsFolder)\$(TargetName).pdb
if $(ConfigurationName) == Debug (
copy $(Product21SymbolsFolder)\Pr21BusinessObjects5.pdb $(TargetDir)\*.*
copy $(Product21SymbolsFolder)\Pr21BusinessObjectsFlat.pdb $(TargetDir)\*.*
copy $(Product21SymbolsFolder)\Pr21Common.pdb $(TargetDir)\*.*
copy $(Product21SymbolsFolder)\Pr21Constants.pdb $(TargetDir)\*.*
copy $(Product21SymbolsFolder)\Product21.Datamodel.pdb $(TargetDir)\*.*
copy $(Product21SymbolsFolder)\Product21.Factory.pdb $(TargetDir)\*.*
copy $(Product21SymbolsFolder)\Pr21Interfaces.pdb $(TargetDir)\*.*
copy $(Product21SymbolsFolder)\Pr21Styles.pdb $(TargetDir)\*.*
copy $(Product21SymbolsFolder)\BusinessObjects.pdb $(TargetDir)\*.*
)
</PostBuildEvent>
</PropertyGroup>
And make sure that the folders exists under your path. Since you have not provided the error message and if you have any other error, please share with us and we will help you solve it as soon as possible.
Update 1
Try to use these node instead of PostBuildEvent property and this function works well in my side and can match the reference dll name in Product21SymbolsFolder folder.
Note: you should remove every reference dll's Version,Culture and PublicKeyToken in xxx.csproj file.
Like: change <Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
to <Reference Include="Newtonsoft.Json">.
Function
target test is to split all dependencies referenced by the project
target test1 is to match the referenced dependency in the Product21SymbolsFolder, match successfully, copy to the output folder.
<PropertyGroup>
<Pr21DllDir>C:\xxx\xx</Pr21DllDir>
<Product21SymbolsFolder>C:\xxx\xxx</Product21SymbolsFolder>
</PropertyGroup>
<Target Name="test" AfterTargets="Build">
<PropertyGroup>
<MoreFile>
#(Reference)
</MoreFile>
</PropertyGroup>
<ItemGroup>
<MoreFilesArray Include="$(MoreFile.Split(';'))" />
</ItemGroup>
</Target>
<Target Name="test1" AfterTargets="test">
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(Pr21DllDir)"></Copy>
<Copy SourceFiles="$(ProjectDir)$(OutputPath)$(TargetName).pdb" DestinationFolder="$(Product21SymbolsFolder)"></Copy>
<Copy Condition="'$(ConfigurationName)'=='Debug' and Exists('$(Product21SymbolsFolder)\%(MoreFilesArray.Identity).pdb')" SourceFiles=" $(Product21SymbolsFolder)\%(MoreFilesArray.Identity).pdb" DestinationFolder="$(TargetDir)"></Copy>
</Target>

Visual Studio 2015 project template type

I'm creating a project template and suffering placing it into a particular section in "New Project" window. I found a MyTemplate.vstemplate xml-like file inside the template folder and there is an entry 'ProjectType'. And that seems to be the right way to solve the problem just setting a proper value there, but I can't find all the list of available types. No problem placing the template into 'Visual C#' or 'Visual Basic' sections, but I would like to put in under 'Other Project Types' or 'Visual Studio Solutions'.
And the greatest achievement would be to setup the template along with an extension.
Any ideas will be appreciated. Thanks
csproj content:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" 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>{$guid1$}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>$safeprojectname$</RootNamespace>
<AssemblyName>$safeprojectname$</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</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>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ModuleRegistry.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<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>
-->
<Target Name="TemplateProjectOutputGroup">
</Target>
</Project>
It's not ProjectType that you should use for that.
Edit the csproj that contains the MyTemplate.vstemplate file and set the OutputSubPath value like this:
<VSTemplate Include="MyTemplate.vstemplate">
<OutputSubPath>ELEVATION</OutputSubPath>
</VSTemplate>

Publish Fails when targeting multiple frameworks in VS2017

When targeting multiple frameworks in Visual Studio 2017 project (netcoreapp1.1;net462)
Every time I try to publish the publish fails with the error:
"The 'Publish' target is not supported without specifying a target framework. The current project targets multiple frameworks, please specify the framework for the published application"
I've got my property group conditionals in place, but what else do I need to do to 'specify the framework for the published application'. Am I missing something?
Further - Project compiles fine. Also, worthy of note it was a project created in VS 2015 and converted to a VS 2017 project.
Here is .csproj:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>netcoreapp1.1;net462</TargetFrameworks>
<PreserveCompilationContext>true</PreserveCompilationContext>
<AssemblyName>Project.WebApp</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>Project.WebApp</PackageId>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.1' ">1.1.1</RuntimeFrameworkVersion>
</PropertyGroup>
<ItemGroup>
<None Include="App.config" />
<None Update="wwwroot\**\*">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Data\Proj.Data.csproj" />
<ProjectReference Include="..\Proj.Data\Proj.Data.csproj" />
<ProjectReference Include="..\Proj.Web.Client\Proj.Web.Client.csproj" />
<ProjectReference Include="..\Proj.Web.Models\Proj.Web.Models.csproj" />
<ProjectReference Include="..\Proj.Services.Client\Proj.Services.Client.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="AngleSharp" Version="0.9.9" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Rewrite" Version="1.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Routing" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.1.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net462' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish" Condition=" '$(IsCrossTargetingBuild)' != 'true' ">
<Exec Command="bower install" />
<Exec Command="dotnet bundle" />
</Target>
<ItemGroup>
<DotNetCliToolReference Include="BundlerMinifier.Core" Version="2.2.301" />
</ItemGroup>
</Project>
Also here is the Publish Profile, it appears to specify a Publish Framework:
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<PublishFramework>netcoreapp1.1</PublishFramework>
<ProjectGuid>3794908a-5af3-4dba-bb6a-8d846b773ff7</ProjectGuid>
<publishUrl>\\app\Applications\App\Web Site\</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
</PropertyGroup>
</Project>
EDIT: The solution that worked for me
I tried #Stan88 solution of just using the command line and specifying the version to publish. This didn't work for me as my PrepublishScript failed for some reason.
In the end what worked for me was basically editing my .csproj file to only target the netcoreapp1.1 framework. However, in the end I ended up realizing my PrepublishScript had issues and ended up deleting reference to it in the .csproj file - so in the end I think Stan88's command line solution would have worked if not for prepublish craziness, hence, marked as correct.
Here is what my .csproj ended up looking like.
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>netcoreapp1.1</TargetFrameworks>
<PreserveCompilationContext>true</PreserveCompilationContext>
<AssemblyName>Project.WebApp</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>Project.WebApp</PackageId>
</PropertyGroup>
<ItemGroup>
<None Include="App.config" />
<None Update="wwwroot\**\*">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Data\Proj.Data.csproj" />
<ProjectReference Include="..\Proj.Data\Proj.Data.csproj" />
<ProjectReference Include="..\Proj.Web.Client\Proj.Web.Client.csproj" />
<ProjectReference Include="..\Proj.Web.Models\Proj.Web.Models.csproj" />
<ProjectReference Include="..\Proj.Services.Client\Proj.Services.Client.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="AngleSharp" Version="0.9.9" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Rewrite" Version="1.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Routing" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.1.0" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="BundlerMinifier.Core" Version="2.2.301" />
</ItemGroup>
</Project>
You can only publish for one framework at a time so you have to specify the target framework to publish for when executing dotnet publish command.
dotnet publish -f=netcoreapp1.1
or
dotnet publish -f=net462

Injecting .cs file into msbuild works fine except the Intellisense (VS 2010)

This is what i am trying to do, but so far been unsuccessful. I have a WPF Project with some xaml classes. I have a msbuild task that creates partial classes with the same name as xaml classes but with some extra properties. The partial classes gets created properly and it builds fine too. However the newly created properties do not show up on the Intellisense in VS2010. I am also using Resharper.
I have imported my target in the original .csproj file. the original file is pasted at the end of the question.
<Import Project="..\XamlModifyTask\bin\Debug\TXamlModifyTask.csproj" />
And this is how the TXamlModifyTask.csproj looks like
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<UsingTask AssemblyFile="XamlModifyTask.dll" TaskName="XamlModifyTask"/>
<!--PropertyGroup>
<ResolveReferencesDependsOn>XamlModify;$(ResolveReferencesDependsOn)</ResolveReferencesDependsOn>
</PropertyGroup-->
<PropertyGroup>
<CompileDependsOn>XamlModify;$(CompileDependsOn)</CompileDependsOn>
</PropertyGroup>
<ItemGroup>
<SettingsGenerated Include="$(IntermediateOutputPath)**\*.test.cs"></SettingsGenerated>
</ItemGroup>
<Target Name="XamlModify">
<XamlModifyTask Files="#(Page)" OutputPath="$(IntermediateOutputPath)"></XamlModifyTask>
<ItemGroup>
<Compile Include="#(SettingsGenerated)"></Compile>
<FileWrites Include="#(SettingsGenerated)"/>
</ItemGroup>
</Target>
I have even tried using BeforeCompile/BeforeBuild events. but it does not work. Am i doing something wrong here.
This is the original project file.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="JPMorgan.Build.XamlModifyTask" AssemblyFile="H:\Visual Studio 2010\Projects\WpfApplication1\WpfApplication1\JPMorgan.Build.dll" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{55A24932-DA31-4837-9E1E-9E69C34BFB5F}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>WpfApplication1</RootNamespace>
<AssemblyName>WpfApplication1</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</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|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<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.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>
<Compile Include="View\Window1.xaml.cs">
<DependentUpon>Window1.xaml</DependentUpon>
</Compile>
<Compile Include="Window2.xaml.cs">
<DependentUpon>Window2.xaml</DependentUpon>
</Compile>
<Compile Include="Window4.xaml.cs">
<DependentUpon>Window4.xaml</DependentUpon>
</Compile>
<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>
<Page Include="View\Window1.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Window2.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Window3.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Compile Include="Window3.xaml.cs">
<DependentUpon>Window3.xaml</DependentUpon>
</Compile>
<Page Include="Window4.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</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>
<AppDesigner Include="Properties\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\XamlModifyTask\bin\Debug\TXamlModifyTask.csproj" />
<!--Target Name="BeforeBuild">
<ItemGroup>
<Compile Include="#(SettingsGenerated)"></Compile>
<FileWrites Include="#(SettingsGenerated)"/>
</ItemGroup>
</Target-->
<!--Target Name="AfterBuild">
</Target-->
</Project>

Resources