Error while build MSBee Beta 2

Topics: For MSBee Users
Aug 16, 2006 at 8:24 PM
migrated from power toy forums
originally posted by Amarendra Behera
------------------------------------------------------

Hello,

I just installed MSBee beta 2 and tried to build one of my application (Windows)

What i did :

Installed MSBee beta 2
Insert "
<Import Project="$(MSBuildExtensionsPath)\MSBee\MSBuildExtras.FX11.VisualBasic.targets" Condition=" '$(BuildingInsideVisualStudio)' == '' AND '$(TargetFX11)'=='true'" />

Try to run msbuild project file /t:Rebuild /p:TargetFX1_1=true

It gave me so may error and warning, Result - FAILED

I too tried with another options for step 2 as mentioned on the ReadMe documents.

Run -

msbuild project file /p:TargetFX11=true /p:CustomAfterMicrosoftCommonTargets=%ProgramFiles%\MSBuild\MSBee\MSBuildExtras.Fx11.CSharp.targets

It also gave me the same no of warning and errors.

But: If i run only msbuild "project file /p:TargetFX11=true" and then msbuild project file /t:Rebuild /p:TargetFX11=true" it succeeded.

Any idea on this.

Thanks

-------------------------------------------------------Amarendra,Softtrends Software Pvt. Ltd.

Aug 16, 2006 at 8:25 PM
originally posted by Craig Lichtenstein - MSFT
------------------------------------------------------

So, your command line looks correct. My first question is did this project build in VS 2003? Also, does it build successfully with MSBuild when not using MSBee?

What would really help is if you could add '/v:diag' to the end of the MSBuild command line and run it again. The /v switch controls build output being generated by MSBuild and 'diag' produces diagnostic output which makes debugging easier. Thus, if you could add this flag to obtain the output and then post the output (including the compiler errors and warnings), I could review it and hopefully come up with a definitive answer on what's going on.
Aug 16, 2006 at 8:25 PM
originally posted by Amarendra Behera
------------------------------------------------------

Yes the project is building with VS 2003 and also with MSBuild wihou MSBee.

I run /v tag like this : msbuild project file /t:Rebuild /p:TargetFX1_1=true /verbosity:diag and got the follwing results.

0 ms WriteLinesToFile 2 calls
0 ms RemoveDuplicates 3 calls
0 ms Message 3 calls
0 ms CreateItem 8 calls
0 ms AssignTargetPath 4 calls
0 ms AssignCulture 1 calls
0 ms ReadLinesFromFile 2 calls
0 ms GetFrameworkSDKPath 1 calls
0 ms CreateProperty 6 calls
0 ms CreateVisualBasicManifestResourceName 1 calls
0 ms MakeDir 3 calls
0 ms Delete 1 calls
16 ms GetRegistryValue 2 calls
16 ms FindUnderPath 5 calls
375 ms GenerateResource 1 calls
1031 ms Vbc 1 calls
1594 ms ResolveAssemblyReference 1 calls
3359 ms MSBuild 1 calls
3375 ms CallTarget 1 calls
Errors & Warnings:

C:\Projects\Respository for InstallShield Builds\BackupLibrary\SPSRestore.vb(109
): error BC30456: 'AddWithValue' is not a member of 'System.Data.SqlClient.SqlPa
rameterCollection'.
error BC30002: Type 'Containers.CoreData' is not defined.
if i build only with MSBuild it builds finly but errors when i use MSBee.Let me clear you one thing is : this "AddWithValue" was added when i convert the VS 2003 project to VS 2005.After converting to 2005 i got some wanrning, so to remove those warning i used "AddWithValue" (one example) parameter which is actually not there in VS 2003.

I hope these errors are coming becuase of those warning which i got while converting from 2003 to 2005.

Thanks

-------------------------------------------------------
Amarendra,Softtrends Software Pvt. Ltd.
Aug 16, 2006 at 8:25 PM
originally posted by Craig Lichtenstein - MSFT
------------------------------------------------------

AddWithValue is a method in SqlParameterCollection. Since the method is new in .NET 2.0, trying to build in MSBee will fail. Can you post the warning you got after converting? Also, can you tell me more about the second error; did you add Containers.CoreData after the conversion? Is error 2 related to error 1?

One thing you can try is if'defing your code. In MSBee Beta 2, a "FX1_1" constant is defined when building with MSBee. Thus, after converting your project in VS2005, you can do something like:

#If FX1_1 Then
// use the pre-conversion code
#Else
// use AddWithValue
#End If

This should keep your code 1.1 compatible (and thus buildable with MSBee) after the conversion and also maintain your .NET 2.0 builds.
Aug 16, 2006 at 8:29 PM
originally posted by Amarendra Behera
------------------------------------------------------

The answer of your questions are :

Warning (after conversion) :Warning 146 'Public Function Add(parameterName As String, value As Object) As System.Data.SqlClient.SqlParameter' is obsolete: 'Add(String parameterName, Object value) has been deprecated. Use AddWithValue(String parameterName, Object value). http://go.microsoft.com/fwlink/?linkid=14202'
No "Containers.CoreData" is not added after conversion.It is from 2003.It is just a new item (DATASET) added to my project(Containers is a folder)
Error 2 is not related with error 1.
I will try it out your suggestion you gave and tell you the results tommorow.how ever if i do like that , the warning will not remove right?and there are so many warning related to "AddWithValue"

Thanks

------------------------------------------------------
Amarendra,Softtrends Software Pvt. Ltd.
Aug 16, 2006 at 8:31 PM
originally posted by Craig Lichtenstein - MSFT
------------------------------------------------------

The deprecation warning should go away if you use the FX11 constant. You're getting the warning since the Add method is deprecated in .NET 2.0 and thus you should use AddWithValue instead when building for .NET 2.0. However, in .NET 1.1, the Add method is valid. Thus, using the FX11 constant to control when to use either method will prevent the deprecation warning from appearing when you build for .NET 2.0 (since you'll use AddWithValue) and will prevent the compiler warning when building with MSBee (since you'll use Add). Note that you'll need to do this everywhere Add has been changed to AddWithValue to fix all the warnings.
Aug 16, 2006 at 8:39 PM
originally posted by Amarendra Behera
------------------------------------------------------

You are right....ok before i move to use that FX1_1 constant, i just converted my project from VS 2003 to 2005 and with out removing any warning (i did not chnage from ADD to ADDWITHVALUE) when i builds with MSBuild it succeded but when build with MSBee it failed, gave me different errors.

errors looks like this : error BC30002: Type "SPSite"/"SPWeb" is not defined.

error BC30002: "Containers.CoreData" is not defined.

I m using SharePoint DLLs in my project.Is MSBee is not supporting SharePoint dlls?How to reference those dlls?

Another thing is that there are many warnings related to "Addwithvalue" so i need to change a lot, so is there any other way to take cae of this...i mean can i declare some where globally one time so that when ever this "Addwithvalue" parameter comes, will be taken care of?

Thanks for your quick responce.

------------------------------------------------------
Amarendra,Softtrends Software Pvt. Ltd.

Aug 16, 2006 at 8:39 PM
originally posted by Craig Lichtenstein - MSFT
------------------------------------------------------

1. With the two BC30002 errors, I'm wondering if you have some projects in your solution that aren't being built with MSBee. Did you remember to add the MSBee <Import Project...> line to all the projects in your solution? If that isn't the issue, then I'd look over where you're defining SPSite/SPWeb and Containers.CoreData and see if something changed in the conversion from what you had before. I don't think referencing the SharePoint dlls should cause any problems, provided they can be referenced by the 1.1 compiler (which presumably they can be since you built this in VS 2003).

2. For the AddWithValue change, you might try creating a method that contains the #if FX1_1 block and then replacing the calls to Add with the new method.
Aug 16, 2006 at 8:39 PM
originally posted by Amarendra Behera
------------------------------------------------------

What your thinking is right.Let me clear you , i have only two projects.One is windows (main) and another is DLL(Class Lib).In both of the projects i m using ShrePoint Dlls.I should first build DLL, add it to main(win) then build the main application.While build my DLL got these arrors which i mentioned(two for ex) above.Both the projects are added with MSBee tags.

I hope there is nothing changed by conversion as with out MSBee it works fine for me as it was working with VS 2003. SPSite/SPWeb are classes and i m creating object of those in my project.Containers.CoreData(dataset.xsd) is new dataset item added to my projects, just to hold some datas from database.

Thanks

------------------------------------------------------
Amarendra,Softtrends Software Pvt. Ltd.
Aug 16, 2006 at 8:40 PM
originally posted by Craig Lichtenstein - MSFT
------------------------------------------------------

Any follow-up here? Were you able to resolve the compiler errors? If I don't hear back in a few days, I'm going to consider the problem resolved and close this thread.