How to Add Reference to a netstandard 2.0 Nuget from VS2013 .Net Framework 4.8 Project - visual-studio-2013

I have a vs 2013 project which targets .net framework 4.8. I need to add a reference to Microsoft.Extensions.Hosting nuget package but when I do I get the following error on package manager console.
Error message:
PM> Install-Package Microsoft.Extensions.Hosting -Version 2.2.0
Installing 'Microsoft.Extensions.Hosting 2.2.0'.
You are downloading Microsoft.Extensions.Hosting from Microsoft, the license agreement to which is available at https://raw.githubusercontent.com/aspnet/AspNetCore/2.0.0/LICENSE.txt. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device.
Successfully installed 'Microsoft.Extensions.Hosting 2.2.0'.
Adding 'Microsoft.Extensions.Hosting 2.2.0' to QuartzExample.
Uninstalling 'Microsoft.Extensions.Hosting 2.2.0'.
Successfully uninstalled 'Microsoft.Extensions.Hosting 2.2.0'.
Install failed. Rolling back...
Install-Package : Could not install package 'Microsoft.Extensions.Hosting 2.2.0'. You are trying to install this package into
a project that targets '.NETFramework,Version=v4.8', but the package does not contain any assembly references or content
files that are compatible with that framework. For more information, contact the package author.
At line:1 char:1
+ Install-Package Microsoft.Extensions.Hosting -Version 2.2.0
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
My Project File looks like this
<?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>{07E02FE5-9E9B-434D-B6A2-D037DE7CE6CA}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>QuartzExample</RootNamespace>
<AssemblyName>QuartzExample</AssemblyName>
<TargetFrameworkVersion>v4.8</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>
<ItemGroup>
<Reference Include="Quartz, Version=3.0.7.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<HintPath>..\packages\Quartz.3.0.7\lib\net452\Quartz.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Quartz.Jobs, Version=3.0.7.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<HintPath>..\packages\Quartz.Jobs.3.0.7\lib\net452\Quartz.Jobs.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Quartz.Plugins, Version=3.0.7.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<HintPath>..\packages\Quartz.Plugins.3.0.7\lib\net452\Quartz.Plugins.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.Remoting" />
<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="MyJob.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config">
<SubType>Designer</SubType>
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Content Include="quartz_jobs.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</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>
My App.Config is as follows
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="quartz" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
<quartz>
<add key="quartz.plugin.xml.type" value="Quartz.Plugin.Xml.XMLSchedulingDataProcessorPlugin, Quartz.Plugins" />
<add key="quartz.plugin.xml.fileNames" value="~/quartz_jobs.xml" />
</quartz>
</configuration>
Without updating Visual Studio 2013, can I add references to a .netstandard2 nuget such as Microsoft.Extensions.Hosting?

You can't. VS2013 has an ancient version of NuGet which doesn't know anything about .NET Standard and therefore can't know that .NET Standard 2.0 is compatible with the .NET Framework 4.8.
If you really can't upgrade to a newer Visual Studio, maybe you can look into .NET Core. Visual Studio Code is a tiny installation and provides good .NET development experience, otherwise any text editor will do, you just lose intellisense if you can't use something that supports Omnisharp.

Related

NuGet package Microsoft.SqlServer.Compact does not copy native DLLs

I have created a .NET Framework 4.8 C# Class Library project that uses x64 as the TargetFramework.
I have added the NuGet package Microsoft.SqlServer.Compact to the project.
When I build the project, only the System.Data.SqlServerCe.dll file, which sits flat in the \lib\net40 folder, is copied to the Output folder.
The files that are in the NativeBinaries\amd64\ directory of the NuGet package are not copied.
But I need them in the OutputPath\amd64 directory.
What settings do I need to make so that these files are also copied?
Edit
Here is the content of my csproj 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>{409AD54E-75FD-419F-B5D7-D2368105B4A8}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>NuGetSQLTestClassLibraryNetFramework</RootNamespace>
<AssemblyName>NuGetSQLTestClassLibraryNetFramework</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</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>
<PlatformTarget>x64</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>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<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="Class1.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SqlServer.Compact">
<Version>4.0.8876.1</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
In my side, it works well and I have OutputPath\amd64 directory with the nuget package.
So please try the following steps to troubleshoot the issue:
1) clean nuget caches first or just delete all files under C:\Users\xxx\.nuget\packages
Also, delete the packages folder under <solution_folder>.
2) run update-package -reinstall under Tools-->Nuget Package Manager-->Package Manager Console
Update
Since you have used PackageReference nuget management format and you cannot get what you want in that format since the author did not consider the compatibility of PackageReference with the nuget package.
In my side, I used packages.config nuget management format and then get that.
To get what you want, you should add these additionally:
1) add this <GeneratePathProperty>true</GeneratePathProperty>under that nuget package reference node to generate msbuild property called PkgMicrosoft_SqlServer_Compact about the content path of the nupkg.
<ItemGroup>
<PackageReference Include="Microsoft.SqlServer.Compact">
<Version>4.0.8876.1</Version>
<GeneratePathProperty>true</GeneratePathProperty>
</PackageReference>
</ItemGroup>
2) right-click on the Proeject Properties-->Build Events-->post-build event command line--> add these:
if not exist "$(TargetDir)x86" md "$(TargetDir)x86"
xcopy /s /y "$(PkgMicrosoft_SqlServer_Compact)\NativeBinaries\x86\*.*" "$(TargetDir)x86"
if not exist "$(TargetDir)amd64" md "$(TargetDir)amd64"
xcopy /s /y "$(PkgMicrosoft_SqlServer_Compact)\NativeBinaries\amd64\*.*" "$(TargetDir)amd64"
After that, rebuild to get what you want.

Can I replace TurtleTasks in the AnkhSvn build

I am trying to build AnkhSVN based on the branch by Simonp22.
The solution includes the MSBuild target QQn.TurtleTasks.targets which contains two tasks:
QQn.TurtleTasks.CachedDownloadAndExtract
QQn.TurtleTasks.ApplyXslTransform
The targets file is imported into four projects in the solution.
The DLL QQn.TurtleTasks.dll is included in the repository (as a binary file). However, it targets .NET Framework 3.5, which I previously did not have installed on my computer.
I would like to get rid of the reference to Framework 3.5, so if possible I would like to replace or remove this reference.
It is not obvious to me, what these tasks are doing and what role they play in the build process.
Can anybody explain
What these tasks are doing?
What is QQn.TurtleTasks? Is it a project which still exists?
Is there a way to replace it?
This is the targets file:
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="../tools/Ankh-Common.targets" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.20506</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{874C0358-E7DD-42DA-BF07-58198B41FD25}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>TestUtils</RootNamespace>
<AssemblyName>TestUtils</AssemblyName>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
<SccProjectName>Svn</SccProjectName>
<SccLocalPath>Svn</SccLocalPath>
<SccAuxPath>Svn</SccAuxPath>
<SccProvider>SubversionScc</SccProvider>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>5</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>5</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="ICSharpCode.SharpZipLib">
<HintPath>..\tools\turtletasks\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="System">
<Name>System</Name>
</Reference>
<Reference Include="System.Data">
<Name>System.Data</Name>
</Reference>
<Reference Include="System.XML">
<Name>System.XML</Name>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="ProcessReader.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Zip.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>
Sorry, this is not directly a programming question, but it is a concrete problem related to programming and I think it can be answered. That is why I am asking on Stack Overflow.
Can I replace TurtleTasks in the AnkhSvn build. What is QQn.TurtleTasks? Is it a project which still exists?
I'm afraid no. That QQn.TurtleTasks is not a open-source project like AnkhSVN repos itself, I would think it's one old, Internal-use project, for this, you have to contact the authors of the AnkhSVN to get source project if it exists.
What these tasks are doing?
Take Ankh.Services.csproj as example, we can see something like:
<ItemGroup>
<DependencyDownload Include="SSvn-1.9005.3940.224.zip">
<Url>https://sharpsvn.open.collab.net/files/documents/180/18649/</Url>
<TargetDir>..\autolib</TargetDir>
<Version>1</Version>
<Visible>false</Visible>
</DependencyDownload>
<DependencyDownload Include="SGit-0.2401.1116.230.zip">
<Url>https://sharpsvn.open.collab.net/files/documents/180/12884/</Url>
<TargetDir>..\autolib</TargetDir>
<Version>1</Version>
<Visible>false</Visible>
</DependencyDownload>
</ItemGroup>
And the DependencyDownload Item is something that will be used by DownloadDependencies target here.
According to the content of these two files:
QQn.TurtleTasks.targets calls DownloadDependencies target=>CachedDownloadAndExtract task. And DependencyDownload item is the input of CachedDownloadAndExtract task(C# class that Implements Itask).
So for this task it will try to download xx.zip file from specific Url like https://sharpsvn.open.collab.net/files/documents/180/12884/ and cache them. But those real logic are hidden in the assembly QQn.TurtleTasks.dll.
So i think if you want to replace them, you have to contact the user to get source code of that QQn.TurtleTasks assembly or install .net framework 3.5 in your machine. Not a good suggestion, but after my check it's a quite old repos from VS2008(VS2005?), for such old project, .net 2.0 and 3.5 framework can help resolve many unknown issues.

MSB4067: The element <#text> beneath element <Target> is unrecognized

From the visual studio, I am able to compile code successfully but when I am trying to compile code using MSBuild, it throws me error like below
MSB4067: The element <#text> beneath element Target is unrecognized.
Please note: I am building code using MSBuild in release mode, the code which I have added for AfterTarget is only for Debug mode.
If I remove code i.e. than it is working fine.
Here is my csproj file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.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>{B9B35177-B239-41A9-946F-3BB1CC14BD3B}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ABC.MyProject.Engine</RootNamespace>
<AssemblyName>ABC.MyProject.Engine</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<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>
</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>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="ABCDataAccess, Version=2017.2.1.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\lib\internal\ABCDataAccess.dll</HintPath>
</Reference>
<Reference Include="ABCNotifier, Version=2016.2.2.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\lib\internal\ABCNotifier.dll</HintPath>
</Reference>
<Reference Include="ABCScheduler, Version=2016.2.2.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\lib\internal\ABCScheduler.dll</HintPath>
</Reference>
<Reference Include="log4net">
<HintPath>..\lib\thirdparty\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.configuration" />
<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.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="core.cs" />
<Compile Include="Model\FileInstance.cs" />
<Compile Include="Model\FileLifeCycle.cs" />
<Compile Include="Model\StateExecutor.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Include="Enterprise\Implementation\FileKarmaHandler.cs" />
<Compile Include="Enterprise\Implementation\FileKarma.cs" />
<Compile Include="Enterprise\Implementation\FileLifeCycleData.cs" />
<Compile Include="Enterprise\Interface\IFileLifeCycleData.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Core\ABC.MyProject.Core.csproj">
<Project>{E1B4DF28-23C5-4865-B7B7-51707D2116E3}</Project>
<Name>ABCCore</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Config\Archiver.xml" />
<Content Include="Config\ABClog.xml" />
<Content Include="Config\DataAccess.xml" />
<Content Include="Config\Notifier.xml" />
<Content Include="Config\Security.xml" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
rmdir config
mkdir config
rmdir sqls
mkdir sqls
rmdir templates
mkdir templates
exit 0
</PreBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>
copy $(ProjectDir)Config\*.xml config\
copy $(ProjectDir)..\lib\thirdparty\*.* $(ProjectDir)\bin\$(Configuration)\
copy $(ProjectDir)..\Core\Config\*.xml config\
copy $(ProjectDir)..\Core\sqls\*.* sqls\
</PostBuildEvent>
</PropertyGroup>
<UsingTask TaskName="XmlPreprocess" AssemblyFile="..\lib\msbuild\lib\XmlPreprocess.MSBuildTasks.dll" />
<Target Name="AfterBuild" Condition="'$(Configuration)' == 'Debug' ">
 
<PropertyGroup>
<ConfigValuesSpreadsheetFileLocation>
..\lib\msbuild\config\Settings.xls
</ConfigValuesSpreadsheetFileLocation>
</PropertyGroup>
<XmlPreprocess
ToolPath="..\lib\msbuild\lib\"
InputFiles="..\Core\Config\AlertParams.xml"
OutputFiles="bin\Debug\config\AlertParams.xml"
SpreadsheetFiles="$(ConfigValuesSpreadsheetFileLocation)"
Environment="$(Configuration)"
Clean="true"
Validate="true" />
 
<XmlPreprocess
ToolPath="..\lib\msbuild\lib\"
InputFiles="..\Core\Config\CoreParams.xml"
OutputFiles="bin\Debug\config\CoreParams.xml"
SpreadsheetFiles="$(ConfigValuesSpreadsheetFileLocation)"
Environment="$(Configuration)"
Clean="true"
Validate="true" />
 
<XmlPreprocess
ToolPath="..\lib\msbuild\lib\"
InputFiles="..\Core\Config\StateParams.xml"
OutputFiles="bin\Debug\config\StateParams.xml"
SpreadsheetFiles="$(ConfigValuesSpreadsheetFileLocation)"
Environment="$(Configuration)"
Clean="true"
Validate="true" />
 
<XmlPreprocess
ToolPath="..\lib\msbuild\lib\"
InputFiles="Config\Archiver.xml"
OutputFiles="bin\Debug\config\Archiver.xml"
SpreadsheetFiles="$(ConfigValuesSpreadsheetFileLocation)"
Environment="$(Configuration)"
Clean="true"
Validate="true" />
 
<XmlPreprocess
ToolPath="..\lib\msbuild\lib\"
InputFiles="Config\DataAccess.xml"
OutputFiles="bin\Debug\config\DataAccess.xml"
SpreadsheetFiles="$(ConfigValuesSpreadsheetFileLocation)"
Environment="$(Configuration)"
Clean="true"
Validate="true" />
 
<XmlPreprocess
ToolPath="..\lib\msbuild\lib\"
InputFiles="app.config"
OutputFiles="bin\Debug\app.config"
SpreadsheetFiles="$(ConfigValuesSpreadsheetFileLocation)"
Environment="$(Configuration)"
Clean="true"
Validate="true" />
</Target>
</Project>
I've seen this error happen when the XML is somehow malformed, such as having a duplicated > character.
To troubleshoot it you can remove XML nodes from your csproj until the error goes away (it should be right at the build start) and repeat until you narrow down to the specific line with the XML issue.
Look out for merge/conflict markers from your source control. I just ran into a GIT marker that was causing this error.
MSB4067: The element <#text> beneath element is unrecognized
First, you should use the MSBuild from the Visual Studio not from the .Net Framework.
That because starting with Visual Studio 2013, the 2013 version of MSBuild will ship as a part of Visual Studio instead of the .NET Framework. Check this blog for details. So you should use the MSBuild from:
C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe
Second, you should provide configuration parameter /P:configuration=Release when you build the project via MSBuild in release mode, the command looks like:
msbuild "YourProjectPath.csproj" /P:configuration=Release
Hope this helps.

Adding Folders inside android Assets in a Xamarin Android Project throws Build Error

Unable to add directories and subdirectories inside Assets in a Xamarin Android Project.
IDE: Visual Studio Community For Mac Version:7.3.2 (build 12)
OS: MacOS High Sierra version: 10.13.2
Error:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2,2): Error MSB3025: The source file "Assets/Dir/" is actually a directory. The "Copy" task does not support copying directories. (MSB3025) (assetsCheck)
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2,2): Error MSB3025: The source file "Assets/Dir/SubDir/" is actually a directory. The "Copy" task does not support copying directories. (MSB3025) (assetsCheck)
Note Was able to build successfully using Visual Studio Community in a Windows 10 system.
.csproj file
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Xamarin.Build.Download.0.4.3\build\Xamarin.Build.Download.props" Condition="Exists('..\packages\Xamarin.Build.Download.0.4.3\build\Xamarin.Build.Download.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{A6BF443D-8B89-4044-B951-E346FA8E68D3}</ProjectGuid>
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<RootNamespace>ScormReader.Droid</RootNamespace>
<AssemblyName>ScormReader.Droid</AssemblyName>
<TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
<AndroidApplication>True</AndroidApplication>
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
<AndroidResgenClass>Resource</AndroidResgenClass>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
<AndroidUseLatestPlatformSdk>true</AndroidUseLatestPlatformSdk>
</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>
<AndroidSupportedAbis>arm64-v8a;armeabi;armeabi-v7a;x86</AndroidSupportedAbis>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidManagedSymbols>true</AndroidManagedSymbols>
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="Mono.Android" />
<Reference Include="Xamarin.Android.Support.Annotations">
<HintPath>..\packages\Xamarin.Android.Support.Annotations.25.3.1\lib\MonoAndroid70\Xamarin.Android.Support.Annotations.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Android.Support.Compat">
<HintPath>..\packages\Xamarin.Android.Support.Compat.25.3.1\lib\MonoAndroid70\Xamarin.Android.Support.Compat.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Android.Support.Core.UI">
<HintPath>..\packages\Xamarin.Android.Support.Core.UI.25.3.1\lib\MonoAndroid70\Xamarin.Android.Support.Core.UI.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Android.Support.Core.Utils">
<HintPath>..\packages\Xamarin.Android.Support.Core.Utils.25.3.1\lib\MonoAndroid70\Xamarin.Android.Support.Core.Utils.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Android.Support.Media.Compat">
<HintPath>..\packages\Xamarin.Android.Support.Media.Compat.25.3.1\lib\MonoAndroid70\Xamarin.Android.Support.Media.Compat.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Android.Support.Fragment">
<HintPath>..\packages\Xamarin.Android.Support.Fragment.25.3.1\lib\MonoAndroid70\Xamarin.Android.Support.Fragment.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Android.Support.Vector.Drawable">
<HintPath>..\packages\Xamarin.Android.Support.Vector.Drawable.25.3.1\lib\MonoAndroid70\Xamarin.Android.Support.Vector.Drawable.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Android.Support.Animated.Vector.Drawable">
<HintPath>..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.25.3.1\lib\MonoAndroid70\Xamarin.Android.Support.Animated.Vector.Drawable.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Android.Support.v7.AppCompat">
<HintPath>..\packages\Xamarin.Android.Support.v7.AppCompat.25.3.1\lib\MonoAndroid70\Xamarin.Android.Support.v7.AppCompat.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="MainActivity.cs" />
<Compile Include="Resources\Resource.designer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\AboutResources.txt" />
<None Include="Properties\AndroidManifest.xml" />
<None Include="Assets\AboutAssets.txt" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\layout\Main.axml" />
<AndroidResource Include="Resources\values\Strings.xml" />
<AndroidResource Include="Resources\mipmap-hdpi\Icon.png" />
<AndroidResource Include="Resources\mipmap-mdpi\Icon.png" />
<AndroidResource Include="Resources\mipmap-xhdpi\Icon.png" />
<AndroidResource Include="Resources\mipmap-xxhdpi\Icon.png" />
<AndroidResource Include="Resources\mipmap-xxxhdpi\Icon.png" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\drawable\" />
</ItemGroup>
<ItemGroup>
</ItemGroup>
<ItemGroup>
</ItemGroup>
<ItemGroup>
<AndroidAsset Include="Assets\Parent\" />
<AndroidAsset Include="Assets\Parent\Child\" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<Import Project="..\packages\Xamarin.Build.Download.0.4.3\build\Xamarin.Build.Download.targets" Condition="Exists('..\packages\Xamarin.Build.Download.0.4.3\build\Xamarin.Build.Download.targets')" />
<Import Project="..\packages\Xamarin.Android.Support.Annotations.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Annotations.targets" Condition="Exists('..\packages\Xamarin.Android.Support.Annotations.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Annotations.targets')" />
<Import Project="..\packages\Xamarin.Android.Support.Compat.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Compat.targets" Condition="Exists('..\packages\Xamarin.Android.Support.Compat.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Compat.targets')" />
<Import Project="..\packages\Xamarin.Android.Support.Core.UI.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Core.UI.targets" Condition="Exists('..\packages\Xamarin.Android.Support.Core.UI.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Core.UI.targets')" />
<Import Project="..\packages\Xamarin.Android.Support.Core.Utils.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Core.Utils.targets" Condition="Exists('..\packages\Xamarin.Android.Support.Core.Utils.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Core.Utils.targets')" />
<Import Project="..\packages\Xamarin.Android.Support.Media.Compat.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Media.Compat.targets" Condition="Exists('..\packages\Xamarin.Android.Support.Media.Compat.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Media.Compat.targets')" />
<Import Project="..\packages\Xamarin.Android.Support.Fragment.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Fragment.targets" Condition="Exists('..\packages\Xamarin.Android.Support.Fragment.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Fragment.targets')" />
<Import Project="..\packages\Xamarin.Android.Support.Vector.Drawable.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Vector.Drawable.targets" Condition="Exists('..\packages\Xamarin.Android.Support.Vector.Drawable.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Vector.Drawable.targets')" />
<Import Project="..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Animated.Vector.Drawable.targets" Condition="Exists('..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Animated.Vector.Drawable.targets')" />
<Import Project="..\packages\Xamarin.Android.Support.v7.AppCompat.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.v7.AppCompat.targets" Condition="Exists('..\packages\Xamarin.Android.Support.v7.AppCompat.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.v7.AppCompat.targets')" />
</Project>
The "Copy" task does not support copying directories.
I reproduced your problem on my MacOS, and found the fix.
When you added the sub-directory, the csproj file had an item added that causes this error. Edit the csproj file and remove the line that references the sub-directory will solve this probelm.
Solution :
My .csproj file :
<ItemGroup>
<AndroidAsset Include="Assets\New Folder\hi.txt">
<Generator>RazorTemplatePreprocessor</Generator>
<LastGenOutput>hi.cs</LastGenOutput>
</AndroidAsset>
<AndroidAsset Include="Assets\New Folder1\" />
</ItemGroup>
Remove the first AndroidAsset that refers to the sub-directory :

Extension Won't Debug

I have a VSIX package in a 2015 Solution, targetting VS2013. Whenever I try to run it against the VS2013 Experimental Instance, the extension doesn't show up in the installed list.
However, I am able to manually install the .vsix file into 2013 by double clicking on it. This will install (and run) successfully.
The settings for creating the .vsix and deploying it to Exp appear to be correct. What am I missing?
Manifest
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="9D7E0DF5-0A4D-4B43-9D73-4AD3F83260FA" Version="1.2" Language="en-US" Publisher="VersionOne" />
<DisplayName>VersionOne TFS Checkin Policy</DisplayName>
<Description xml:space="preserve">TFS Checkin policy from VersionOne for Visual Studio 2013. Requires code commits to contain a VersionOne identifier</Description>
<License>LICENSE.md</License>
<Icon>logo.ico</Icon>
</Metadata>
<Installation>
<InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="[12.0]" />
<InstallationTarget Version="[12.0]" Id="Microsoft.VisualStudio.Premium" />
<InstallationTarget Version="[12.0]" Id="Microsoft.VisualStudio.Ultimate" />
</Installation>
<Dependencies>
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.5]" />
</Dependencies>
<Assets>
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="File" Path="RegistryKeyToAdd.pkgdef" />
</Assets>
</PackageManifest>
Project File
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">11.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>12.0</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<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>
<TargetFrameworkProfile />
</PropertyGroup>
<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>
<SchemaVersion>2.0</SchemaVersion>
<ProjectTypeGuids>{82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectGuid>{2153C73F-1BA9-49F8-BAB2-84F7769BD67A}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>VersionOne.Integration.Tfs.Policy.Deployment.VS2013</RootNamespace>
<AssemblyName>VersionOne.Integration.Tfs.Policy.VS2013</AssemblyName>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
<GeneratePkgDefFile>false</GeneratePkgDefFile>
<IncludeAssemblyInVSIXContainer>false</IncludeAssemblyInVSIXContainer>
<IncludeDebugSymbolsInVSIXContainer>false</IncludeDebugSymbolsInVSIXContainer>
<IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment>
<CopyBuildOutputToOutputDirectory>false</CopyBuildOutputToOutputDirectory>
<CopyOutputSymbolsToOutputDirectory>false</CopyOutputSymbolsToOutputDirectory>
</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>
<CreateVsixContainer>True</CreateVsixContainer>
<DeployExtension>True</DeployExtension>
</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>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="..\VersionOne.Integration.Tfs.Policy.Deployment.Shared\logo.ico">
<Link>logo.ico</Link>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="..\VersionOne.Integration.Tfs.Policy.Deployment.Shared\RegistryKeyToAdd.pkgdef">
<Link>RegistryKeyToAdd.pkgdef</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="..\VersionOne.Integration.Tfs.Policy.Deployment.Shared\LICENSE.md">
<Link>LICENSE.md</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<None Include="app.config" />
<None Include="source.extension.vsixmanifest">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.5">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.5 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</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>
<ProjectReference Include="..\VersionOne.Integration.Tfs.Policy.VS2013\VersionOne.Integration.Tfs.Policy.VS2013.csproj">
<Project>{24b4af99-795b-4b33-ad1d-fd51f32e2aeb}</Project>
<Name>VersionOne.Integration.Tfs.Policy.VS2013</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
<!-- 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 need to configure your project to deploy to VS2013, even when run from VS2015.
Sam Harwell wrote a NuGet package that does exactly that; just install that package and you should be good to go.

Resources