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

1,080 Views
Last Modified: 2015-08-08
Hello,

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"/>

  <!--======================================================================================================================= -->
  
	<PropertyGroup>
		<ProjectDir>$(MSBuildProjectDirectory)</ProjectDir>
	</PropertyGroup>
  
  <PropertyGroup>
    <SvnRepoPath>svn://Repository/Application/trunk</SvnRepoPath>
    <SvnUsername>user</SvnUsername>
    <SvnPassword>pass</SvnPassword>
  </PropertyGroup>
 
  <!--If the configuration is not passed in from the command prompt then we default it to debug -->
  <PropertyGroup>
    <Configuration Condition="$(Configuration) == '' ">Release</Configuration>
  </PropertyGroup>
  
  <!-- Set up and default the version properties -->
  <PropertyGroup>
		<Major>4</Major>
		<Minor>3</Minor>
		<Build>2</Build>
		<Revision>1</Revision>
	</PropertyGroup>

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

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

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

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

  <AssemblyInfo CodeLanguage="VB"
        OutputFile="$(ProjectDir)\ClassLibriaries\AssemblyInfo.vb"
        AssemblyVersion="$(Major).$(Minor).$(Build).$(Revision)"
        AssemblyFileVersion="$(Major).$(Minor).$(Build).$(Revision)"
        Condition="$(Revision) != '0' "/>

  <AssemblyInfo CodeLanguage="VB"
        OutputFile="$(ProjectDir)\Include\AssemblyInfo.vb"
        AssemblyVersion="$(Major).$(Minor).$(Build).$(Revision)"
        AssemblyFileVersion="$(Major).$(Minor).$(Build).$(Revision)"
        AssemblyTitle="Application"
        AssemblyDescription="$(SvnRepoPath)"
        Guid="3d5900ae-111a-45be-96b3-d9e4606ca793"
        Condition="$(Revision) != '0' "/>

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

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

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

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

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

</Project>

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.

resourcesys.
Comment
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