Fixing errors CS1525 and CS1003 in MSBuild

When building a Microsoft Visual Studio 2017 solution that uses C#6 and C#7 features from the command line (PowerShell), I was getting the errors:

MyClass.cs(845,112): error CS1525: Invalid expression term ‘decimal’ [Web.csproj]
MyClass.cs(845,120): error CS1003: Syntax error, ‘,’ expected [Web.csproj]
MyClass.cs(870,116): error CS1525: Invalid expression term ‘decimal’ [Web.csproj]
MyClass.cs(870,124): error CS1003: Syntax error, ‘,’ expected [Web.csproj]

This was caused by using the wrong version of MSBuild.

I used "C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" after switching to

"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" the problem was resolved.

How to create deployment zip packages for any Microsoft Visual Studio 2012 project type, simply by editing the *.csproj files.

If you want to create deployment zip packages for any Microsoft Visual Studio project type (like, Web Site, Web Service, Windows Service, Console Application etc. then just follow the steps below:


In this example I will be zipping all content files and *.dll files found in the "bin" folder of an ASP .NET MVC 4 Web Application, but the same will work for other project types. This example will be using the MSBuild Community Zip Task and at this point will work for  .NET projects <= 4.5.


Create a new ASP .NET MVC 4 Web Application

In Microsoft Visual Studio 2012, choose:

File > New > Project…


Choose Internet Application



Add the nuget package"MSBuild Community Tasks"

Click click the solution in the Solution Explorer and choose "Manage NuGet Packages for Solution…"


Choose MSBuildTasks




Edit MSBuild.Community.Tasks.targets

Edit the MSBuild.Community.Tasks.targets file, so it will use the MSBuild.Community.Tasks.dll found in the .build folder created by the NuGet package.











Edit the *.csproj file

Unload project (right click project > Unload Project)



Edit *.csproj file


Scroll to the bottom of the file and


<!-- 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 Name="AfterBuild">
</Target> -->



<!-- Start Zip target --> <ItemGroup> <!-- Add all *.dll files found in the root of the "bin" folder as link files. - Use Files="@(Content);@(Link)" in the zip target the include both content files as build output in the zip content.
- Using the "@(Content);@(Link)" notation, will merge ItemGroup Content and ItemGroup Link into one property.
- The ".\" before the "bin" folder name in the Include, results in a zip package containing the bin folder. - If you do not want to include the "bin" folder itself but only the files, use "bin\*.dll". - If you want to include subfolders use ".\bin\**\*.dll" --> <Link Include=".\bin\*.dll" />
<Link Include=".\bin\*.exe" />
<Link Include=".\bin\*.exe.config" />
</ItemGroup> <!-- A relative path will start from the *.csproj file location, so to get to the MSBuild.Community.Tasks.Targets file, we must add "..\.build\". --> <Import Project="..\.build\MSBuild.Community.Tasks.Targets" /> <!-- The afterbuild target will only be executed, when the project is build in "Release" mode. --> <Target Name="AfterBuild" Condition="'$(Configuration)' == 'Release'"> <PropertyGroup> <ReleasePath>bin</ReleasePath> </PropertyGroup> <Zip Files="@(Content);@(Link)" WorkingDirectory="$(ReleasePath)" ZipFileName="output\$(AssemblyName).zip" ZipLevel="9" /> </Target> <!-- End Zip target -->


Reload project



Build project project in "Release" configuration



An output folder should be created containing the



Zip file: