Problems upgrading VB.Net 2008 project into VS2010
Asked Answered
D

9

20

I have been upgrading several different VS2008 projects into VS2010 and have found a problem with VB.Net projects when they are converted.

Once converted, the .vbproj files have changed from this in VS2008:

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
   <DebugSymbols>true</DebugSymbols>
   <DebugType>full</DebugType>
   <DefineDebug>true</DefineDebug>
   <DefineTrace>true</DefineTrace>
   <OutputPath>bin\Debug\</OutputPath>
   <DocumentationFile>CustomerManager.xml</DocumentationFile>
   <WarningsAsErrors>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036</WarningsAsErrors>
</PropertyGroup>

To this in VS2010:

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
   <DebugSymbols>true</DebugSymbols>
   <DebugType>full</DebugType>
   <DefineDebug>true</DefineDebug>
   <DefineTrace>true</DefineTrace>
   <OutputPath>bin\Debug\</OutputPath>
   <DocumentationFile>CustomerManager.xml</DocumentationFile>
   <NoWarn>42353,42354,42355</NoWarn>
   <WarningsAsErrors>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036</WarningsAsErrors>
</PropertyGroup>

The main difference, is that in the VS2010 version, the 42353,42354,42355 value has been added; Inside the IDE, this manifests itself as the following setting in the Project Properties | Compile section as:

"Function returning intrinsic value type without return value" = None

This isn't a problem when building code inside Visual Studio 2010, but when trying to build the code through our continuous integration scripts, it fails with the following errors:

[msbuild] vbc : Command line error BC2026: warning number '42353' for the option 'nowarn' is either not configurable or not valid

[msbuild] vbc : Command line error BC2026: warning number '42354' for the option 'nowarn' is either not configurable or not valid

[msbuild] vbc : Command line error BC2026: warning number '42355' for the option 'nowarn' is either not configurable or not valid

I couldn't find anything on Google for these messages, which is strange, as I am trying to find out why this is happening.

Any suggestions as to why Visual Studio 2010's conversion wizard is doing this?

Dreadfully answered 10/5, 2010 at 15:0 Comment(2)
We're getting the same errors, even though we're targetting .NET3.5 in the compile options. What would be the solution in the case of not using .NET 4.0?Senecal
Are you sure you're using the 3.5 compiler in your scripts?Dreadfully
L
24

Have you changed your build script to use the 4.0 version of MSBuild? Looks to me like you haven't and MSBuild is complaining it knows nothing about warning 42353 etc. (which would make sense if they were introduced in 4.0)

Lode answered 10/5, 2010 at 15:8 Comment(2)
You're right - I haven't. It appears that my scripts are using the <msbuild> task as part of the NAntContrib project, which when I looked into it, appears that it's build using the 2.0 Framework.Dreadfully
This was exactly my issue as well. I'd love to find more documentation of the warnings that were introduced as part of the new system.Chiaroscuro
J
1

I repro this behavior on converted projects. Can't find any docs on what these warning numbers mean, the MSDN library hasn't been updated yet. Nevertheless, my compiler has no trouble with them. Your problem is almost certainly caused by your build server or scripts using an old version of vbc.exe. Be sure the one in c:\windows\microsoft.net\framework\v4.0.30319 compiles the code.

Judijudicable answered 10/5, 2010 at 17:39 Comment(1)
No, I couldn't find anything either. Hopefully if other people stumble across this post for the same problem it may help them too.Dreadfully
D
0

Just edit *.vbproj project file and delete all occurrences of 42353,42354,42355, this should fix the build problem.

Disjunct answered 10/5, 2010 at 17:49 Comment(1)
You're right, it did fix the outcoming problems, but I would rather look towards the underlying problem as the other answers suggest of swapping out the vbc.exe version for that in the 4.0 Framework.Dreadfully
S
0

You're quite right to think that hacking the .vbproj files isn't really the solution. You need to edit the .config for the TFS build service to use the 4.0 version of MSBuild, as described at Link . Note: service needs restarting for the change to take effect, and you'll need to use the correct directory for .NET 4.0 framework (blog specifies a beta version)

Shortwave answered 24/5, 2010 at 22:20 Comment(0)
S
0

The answers saying "use .net version 4" are both right and wrong, imo. It allows you to build the project, but it shouldn't be necessary. In my case I do not want to use the .net 4 msbuild, since it's a web project (asp mvc) which needs to be deployed to servers which don't have .net 4 installed. That's why I answered "no" to the "Do you want to upgrade to .net 4" question when converting from VS2008 to VS2010. In my view this is a bug in that conversion wizard, since I said to leave it as .net 3.5 but I can't build the resulting project using .net 3.5.

I can if I remove those warnings from the project file but can anyone point me to an explanation of what these warning codes actually mean? I'm kind of surprised I can't find a list of warning codes and explanations somewhere. The '"Function returning intrinsic value type without return value" = None' explanation - is that for all 3 warning codes 8together or seperately)? Or just for one of them? Don't quite understand why there are 3 codes if they have 1 meaning...

Stacey answered 29/11, 2010 at 11:25 Comment(1)
VS2010 projects require .NET 4 MSBuild to build, but will still build a 2.0/3.5 project that is configured for those versions. You shouldn't need 4.0 installed after building a 3.5 project from .NET 4 MSBuild.Inept
S
0

I've now investigated a bit further. Note that I'm not using TFS - we use subversion for version management and our own build/deploy scripts which simply call msbuild from the command line - and it's there that mine fails. However, if I open the project properties in the upgraded version, go to the Compile tab and change the "Function returning intrinsic value type without return value" option from "None" to "Warning" then I can build the project again.

Note that this has the somehwat same effect as editing the vbproj file, in that it removes those warning numbers from the section of the vbproj file. It may change a couple of other warning numbers there too I think. Anyway, I can live with getting more warnings (not that I get any warnings anyway, but potentially being warned about this instead of the warnign being ignored can't be a problem, the way I look at it) and the project builds and works now, using the 3.5 version of msbuild that we've always used before. I do think it's potentially a bug in the upgrade wizard and have reported it via MS Connect too.

Stacey answered 2/12, 2010 at 8:23 Comment(0)
D
0

Workaround found on this Microsoft Connect page:

After upgrade, change the "Function returning intrinsic value type without return value" option under warning configurations on the compile tab of the project properties from "None" to "Warning"

All seems to work now.

Dreadfully answered 11/9, 2012 at 15:33 Comment(0)
S
0

Just remove the nowarn it will work.

Actually, we are working on a framework 3.5 api, build on visual studio 2008, some people here work on studio 2012, others on 2008, on the same vbproj (2 solution file, 1 for 2008, 1 for 2012).

We only had to remove these 3 numbers in the nowarn section after the upgrade to make our project compile on our server, where framework 4.0+ is not installed, and everything works fine, using the msbuild 3.5.

Suspensoid answered 19/9, 2012 at 12:19 Comment(0)
C
0

This was my solution. My solutions target .net 2.0 but from VS2010. The net-4.0 tells NAnt to use the MSBuild from .net 4 install. it still builds the 2.0 or 3.5 output if that is whats set in your project file. Also setting "none" to "warning" in the project properties build section helps as mentioned further below. :-)

property name="nant.settings.currentframework" value="net-4.0"

    <msbuild project="..\Test.sln" verbosity="Normal">
        <property name="Configuration" value="${Build.Configuration}" />
        <property name="OutDir" value="${Build.OutputFolder}\Test\\" />
        <arg value="/t:Rebuild" />
    </msbuild>
Cathrinecathryn answered 13/3, 2013 at 1:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.