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.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jacques Bourgeois (James Burger)PresidentCommented:

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.
David Johnson, CD, MVPOwnerCommented:
why don't you download and install Visual Studio Community ?
resourcesysAuthor Commented:
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.

Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

resourcesysAuthor Commented:
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.
David Johnson, CD, MVPOwnerCommented:
what is the content of CompileAll.bat
resourcesysAuthor Commented:
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.
resourcesysAuthor Commented:
I have adjusted the .proj file and commented out the <Output TaskParameter="TargetOutputs" ItemName="@(TargetOutputsDirectory)" /> line in the MSBuild tags.

This is allowing the code to build and the .dll files are being generated correctly.

I am not sure of the function of this code but obviously it appears to be redundant.

So in summary, to take care of my issues, I pointed to a different directory for MSBuild and VBC. Also, I commented out a redundant line from the .proj file.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
resourcesysAuthor Commented:
Steps taken in my "solution" have solved my initial issues
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.