msbuild fails:WinForms build error

Topics: For MSBee Users
Aug 16, 2006 at 9:01 PM
migrated from power toy forums
originally posted by mattdk
------------------------------------------------------

Hello,

I'm new to the MSBee initiative. As everybody else, I'm trying to compile a VS2005 project to a .NET 1.1 executable. Unfortunately, I don't have VS2003 anymore, and besides, it seems that VS2005 has gotten many IDE improvements.

I realize that I cannot use the new .NET 2.0 features, but as to my understanding, I'm not.

Have I got some reference wrongly setup or what seems to be the problem here?

The sequence below has been updated:

- I removed the System.Deployment from the dependencies

- I removed "partial" from my class definition (since it's Whidbey/.NET 2.0 functionality)

but it still gives me the following (shortened):

-------------------------------------------------------

Target CoreCompile:
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Csc.exe /noconfig /warn:4 /defi
ne:DEBUG;TRACE;FX1_1 /reference:C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Sys
tem.Data.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll
/reference:C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Drawing.dll /refe
rence:C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Windows.Forms.dll /ref
erence:C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Xml.dll /debug+ /debu
g:full /optimize- /out:obj\FX11\Debug\GetText.exe /resource:obj\FX11\Debug\Get
Text.Form1.resources /resource:obj\FX1_1\Debug\GetText.Properties.Resources.reso
urces /target:winexe Form1.cs Form1.Designer.cs Program.cs Properties\AssemblyIn
fo.cs Properties\Resources.Designer.cs Properties\Settings.Designer.cs Win32API.
cs
Form1.Designer.cs(3,5): error CS0116: A namespace does not directly contain
members such as fields or methods
Form1.Designer.cs(3,19): error CS0101: The namespace 'GetText' already conta
ins a definition for 'Form1'
Program.cs(7,5): error CS0116: A namespace does not directly contain members
such as fields or methods
Properties\Resources.Designer.cs(22,13): warning CS0658: 'global' is not a r
ecognized attribute location. All attributes in this block will be ignored.
Properties\Resources.Designer.cs(22,13): error CS1001: Identifier expected
Properties\Resources.Designer.cs(23,13): warning CS0658: 'global' is not a r
ecognized attribute location. All attributes in this block will be ignored.
Properties\Resources.Designer.cs(23,13): error CS1001: Identifier expected
Properties\Resources.Designer.cs(24,13): warning CS0658: 'global' is not a r
ecognized attribute location. All attributes in this block will be ignored.
Properties\Resources.Designer.cs(24,13): error CS1001: Identifier expected
Properties\Resources.Designer.cs(28,30): error CS1519: Invalid token ':' in
class, struct, or interface member declaration
Properties\Resources.Designer.cs(30,30): error CS1519: Invalid token ':' in
class, struct, or interface member declaration
Properties\Resources.Designer.cs(32,17): warning CS0658: 'global' is not a r
ecognized attribute location. All attributes in this block will be ignored.
Properties\Resources.Designer.cs(32,17): error CS1001: Identifier expected
Properties\Resources.Designer.cs(32,74): error CS1519: Invalid token '(' in
class, struct, or interface member declaration
Properties\Resources.Designer.cs(40,17): warning CS0658: 'global' is not a r
ecognized attribute location. All attributes in this block will be ignored.
Properties\Resources.Designer.cs(40,17): error CS1001: Identifier expected
Properties\Resources.Designer.cs(40,64): error CS1519: Invalid token '(' in
class, struct, or interface member declaration
Properties\Resources.Designer.cs(40,71): error CS1519: Invalid token ':' in
class, struct, or interface member declaration
Properties\Resources.Designer.cs(40,124): error CS1519: Invalid token ')' in
class, struct, or interface member declaration
Properties\Resources.Designer.cs(41,31): error CS1519: Invalid token ':' in
class, struct, or interface member declaration
Properties\Resources.Designer.cs(58,17): warning CS0658: 'global' is not a r
ecognized attribute location. All attributes in this block will be ignored.
Properties\Resources.Designer.cs(58,17): error CS1001: Identifier expected
Properties\Resources.Designer.cs(58,64): error CS1519: Invalid token '(' in
class, struct, or interface member declaration
Properties\Resources.Designer.cs(58,71): error CS1519: Invalid token ':' in
class, struct, or interface member declaration
Properties\Resources.Designer.cs(58,124): error CS1519: Invalid token ')' in
class, struct, or interface member declaration
Properties\Resources.Designer.cs(59,31): error CS1519: Invalid token ':' in
class, struct, or interface member declaration
Properties\Settings.Designer.cs(15,13): warning CS0658: 'global' is not a re
cognized attribute location. All attributes in this block will be ignored.
Properties\Settings.Designer.cs(15,13): error CS1001: Identifier expected
Properties\Settings.Designer.cs(16,13): warning CS0658: 'global' is not a re
cognized attribute location. All attributes in this block will be ignored.
Properties\Settings.Designer.cs(16,13): error CS1001: Identifier expected
Properties\Settings.Designer.cs(17,21): error CS1518: Expected class, delega
te, enum, interface, or struct
Properties\Settings.Designer.cs(17,52): error CS1514: { expected
Properties\Settings.Designer.cs(18,5): error CS1519: Invalid token '{' in cl
ass, struct, or interface member declaration
Properties\Settings.Designer.cs(20,69): error CS1026: ) expected
Properties\Settings.Designer.cs(20,128): error CS1519: Invalid token '(' in
class, struct, or interface member declaration
Properties\Settings.Designer.cs(20,143): error CS1002: ; expected
Done building target "CoreCompile" in project "GetText.csproj" -- FAILED.

Done building project "GetText.csproj" -- FAILED.

Build FAILED.
C:\Documents and Settings\Administrator\Dokumenter\Visual Studio 2005\Projects\G
etText\GetText\GetText.csproj(71,11): warning MSB4011: There is a circular refer
ence involving the import of file "C:\Programmer\MSBuild\MSBee\MSBuildExtras.FX1
_1.CSharp.targets". This file may have been imported more than once, or you may
have attempted to import the main project file. All except the first instance of
this file will be ignored.
Properties\Resources.Designer.cs(22,13): warning CS0658: 'global' is not a recog
nized attribute location. All attributes in this block will be ignored.
Properties\Resources.Designer.cs(23,13): warning CS0658: 'global' is not a recog
nized attribute location. All attributes in this block will be ignored.
Properties\Resources.Designer.cs(24,13): warning CS0658: 'global' is not a recog
nized attribute location. All attributes in this block will be ignored.
Properties\Resources.Designer.cs(32,17): warning CS0658: 'global' is not a recog
nized attribute location. All attributes in this block will be ignored.
Properties\Resources.Designer.cs(40,17): warning CS0658: 'global' is not a recog
nized attribute location. All attributes in this block will be ignored.
Properties\Resources.Designer.cs(58,17): warning CS0658: 'global' is not a recog
nized attribute location. All attributes in this block will be ignored.
Properties\Settings.Designer.cs(15,13): warning CS0658: 'global' is not a recogn
ized attribute location. All attributes in this block will be ignored.
Properties\Settings.Designer.cs(16,13): warning CS0658: 'global' is not a recogn
ized attribute location. All attributes in this block will be ignored.
Form1.Designer.cs(3,5): error CS0116: A namespace does not directly contain memb
ers such as fields or methods
Form1.Designer.cs(3,19): error CS0101: The namespace 'GetText' already contains
a definition for 'Form1'
Program.cs(7,5): error CS0116: A namespace does not directly contain members suc
h as fields or methods
Properties\Resources.Designer.cs(22,13): error CS1001: Identifier expected
Properties\Resources.Designer.cs(23,13): error CS1001: Identifier expected
Properties\Resources.Designer.cs(24,13): error CS1001: Identifier expected
Properties\Resources.Designer.cs(28,30): error CS1519: Invalid token ':' in clas
s, struct, or interface member declaration
Properties\Resources.Designer.cs(30,30): error CS1519: Invalid token ':' in clas
s, struct, or interface member declaration
Properties\Resources.Designer.cs(32,17): error CS1001: Identifier expected
Properties\Resources.Designer.cs(32,74): error CS1519: Invalid token '(' in clas
s, struct, or interface member declaration
Properties\Resources.Designer.cs(40,17): error CS1001: Identifier expected
Properties\Resources.Designer.cs(40,64): error CS1519: Invalid token '(' in clas
s, struct, or interface member declaration
Properties\Resources.Designer.cs(40,71): error CS1519: Invalid token ':' in clas
s, struct, or interface member declaration
Properties\Resources.Designer.cs(40,124): error CS1519: Invalid token ')' in cla
ss, struct, or interface member declaration
Properties\Resources.Designer.cs(41,31): error CS1519: Invalid token ':' in clas
s, struct, or interface member declaration
Properties\Resources.Designer.cs(58,17): error CS1001: Identifier expected
Properties\Resources.Designer.cs(58,64): error CS1519: Invalid token '(' in clas
s, struct, or interface member declaration
Properties\Resources.Designer.cs(58,71): error CS1519: Invalid token ':' in clas
s, struct, or interface member declaration
Properties\Resources.Designer.cs(58,124): error CS1519: Invalid token ')' in cla
ss, struct, or interface member declaration
Properties\Resources.Designer.cs(59,31): error CS1519: Invalid token ':' in clas
s, struct, or interface member declaration
Properties\Settings.Designer.cs(15,13): error CS1001: Identifier expec
Aug 16, 2006 at 9:01 PM
originally posted by Craig Lichtenstein - MSFT
------------------------------------------------------

I tried building a C# WinForms application in VS 2005 with MSBee and was able to duplicate your compiler errors. The bolded compiler error above (Form1.Designer.cs(3,5)) stems from the use of partial classes in the Form1.Designer.cs file. The next error (the namespace already contains a definition for 'Form1') is due to the lack of partial classes in .NET 1.1, which causes the Form1 class to be declared twice in your GetText namespace. The 'global is not recognized' warnings stem from the new global attribute in .NET 2.0. The global attribute reflects a change in .NET 2.0 where all namespaces are now rooted in the "global" namespace by default.
Aug 16, 2006 at 9:01 PM
originally posted by mattdk
------------------------------------------------------

After removing about 20 lines or so, it finally compiled and I could launch it on a 1.1 framework. Great!

Now I only have problems using the ListView control, since the VS2005 IDE appearantly makes use of new overloads. yawn I think it's time to get VS2003 again :-P

Hail the sysops who doesn't recognize .NET 2.0
Aug 16, 2006 at 9:01 PM
originally posted by Jazzy
------------------------------------------------------

Once the project is further along in the release stage, maybe someone will create a plugin for VS 2005 that will limit the use of overloads. I tried to modify the IDE references for certain controls or re-add controls for the 1.1 framework, but that did not work. The only thing I can think of is to create an addin that specifically shows only those references that are 1.1 compatible.

After creating templates, that would be a TODO for full IDE integration.