Link to home
Start Free TrialLog in
Avatar of resourcesys

asked on

Trouble with MSBuild and setting a target framework for vbc migrating from 2.0 to .net 4.5.1


We have an application developed in ASP.NET 2.0 which we now want to compile in ASP.NET 4.5.1.

The application consists of a visual studio 2005 solution (a collection of class libraries) and  individual code behind files, not a part of a website project.

It is compiled via a command file that calls MSBuild running a .proj file (code follows)

<Project xmlns="" DefaultTargets="Build">

  <Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>

  <!--======================================================================================================================= -->
  <!--If the configuration is not passed in from the command prompt then we default it to debug -->
    <Configuration Condition="$(Configuration) == '' ">Release</Configuration>
  <!-- Set up and default the version properties -->

  <!--======================================================================================================================= -->
  <Target Name="VersionSetup" >

  <Time Format="yy">
    <Output TaskParameter="FormattedTime" PropertyName="Minor" />

  <Time Format="ddMM">
    <Output TaskParameter="FormattedTime" PropertyName="Build" />

  <Message Text="Version: $(Major).$(Minor).$(Build).$(Revision)"/>

  <AssemblyInfo CodeLanguage="VB"
        Condition="$(Revision) != '0' "/>

  <AssemblyInfo CodeLanguage="VB"
        Condition="$(Revision) != '0' "/>

  <Message Text="Version set up"/>
  <!--======================================================================================================================= -->
	<Target Name="Build" DependsOnTargets="VersionSetup">

    <CreateItem Include="$(ProjectDir)\ClassLibraries\">
      <Output TaskParameter="Include" ItemName="TargetOutputsDirectory"/>

    <MSBuild Projects="$(ProjectDir)\ClassLibraries\ClassLibraries.sln" Targets="Clean;ReBuild" Properties="Configuration=$(Configuration);OutDir=$(ProjectDir)\bin\" StopOnFirstFailure="false" ContinueOnError="true">
      <Output TaskParameter="TargetOutputs" ItemName="@(TargetOutputsDirectory)" />

    <Exec Command='CompileAll.bat' WorkingDirectory='$(ProjectDir)\Application' />
    <Exec Command='CompileAll.bat' WorkingDirectory='$(ProjectDir)\Application\Reports' />

    <Message Text="Build completed"/>
  <!--======================================================================================================================= -->


Open in new window

When the solution is built in vs2013 with the target framework set to .net 4.5.1 it compiles fine but when running the command file the following error occurs:

error MSB4028: The "MSBuild" task's outputs could not be retrieved from the "TargetOutputs" parameter. The name "D:\DotNet451\ClassLibriaries\" contains an invalid character ":".

A second issue is that the codebehind files are compiles via a command file that calls vbc in the .net 4 directory. Is there a way to get it to specifically compile in .net 4.5.1? The files do compile but I do not know what framework they are compiled against. Also, the following warning is displayed:

This compiler is provided as part of the Microsoft (R) .NET Framework, but only supports language versions up to Visual Basic 2012, which is no longer the latest version. For compilers that support newer versions of the Visual Basic programming language, see

Any help/suggestions are much appreciated.

Avatar of Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger)
Flag of Canada image


You have an extra i before the a in Libraries

For the second problem, are you sure that the vbc.exe file you are calling is the proper version? VS2013 can be installed with framework 4.5.2 and you seem to use a vbc that targets a previous version.
Avatar of David Johnson, CD
why don't you download and install Visual Studio Community ?
Avatar of resourcesys


Thanks for the replies guys.

I fixed the spelling mistake but still get the invalid character error message.

To be honest I don't know which vbc to point to, I just need one that will compile to 4.5.1

What difference will visual studio community make? I have 2015 pro if that helps?

But this all still needs to go through a command file as it is part of an automated build process.

I have pointed to the VBC in the MSBuild\12.0\bin directory which I believe covers .net 4.5.1. The code behind files are building without any warnings.

I have pointed to the sme directory for MSBuild to compile the solution but still have the issue with the colon character being invalid.
what is the content of CompileAll.bat
The CompileAll.bat file loops though all code behind files in a directory and compiles them. This is working fine since pointing to the version 12 vbc directory.
Avatar of resourcesys

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Steps taken in my "solution" have solved my initial issues