We help IT Professionals succeed at work.
Get Started

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

Last Modified: 2015-08-08

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="http://schemas.microsoft.com/developer/msbuild/2003" 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 http://go.microsoft.com/fwlink/?LinkID=533241

Any help/suggestions are much appreciated.

Watch Question
This problem has been solved!
Unlock 1 Answer and 8 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE