Error when trying to compile Windows Form

Jun 18, 2008 at 6:20 PM
Hello all,

I am trying to compile a simple VB.NET Windows Form project which was converted from VS 2003 to VS 2005 using the .NET 1.1 framework from VS 2005. Based on the instructions, I have added bellow this line (in .vbproj file):

<Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" />

the following:

<Import Project="$(MSBuildExtensionsPath)\MSBee\MSBuildExtras.FX1_1.VisualBasic.targets" Condition="'$(BuildingInsideVisualStudio)' == '' AND '$(TargetFX1_1'=='true'" />

When I run the following command from VS 2005 command line:

msbuild C:\Temp\WindowsApplication1\WindowsApplication1\WindowsApplication1.vbproj /p:TargetFX1_1=true

I get the following errors and warnings:

Target GetVisualStudioSearchPaths:
    "HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\7.1\AssemblyFolders" doe
s not exist in the local machine's registry.
Target ResolveAssemblyReferences:
    Primary reference "System.Deployment".
    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets : war
ning MSB3245: Could not resolve this reference. Could not locate the assembly "S
ystem.Deployment". Check to make sure the assembly exists on disk. If this refer
ence is required by your code, you may get compilation errors.
            For SearchPath "bin\FX1_1\Debug\".
            Considered "bin\FX1_1\Debug\System.Deployment.exe", but it didn't ex
ist.
            Considered "bin\FX1_1\Debug\System.Deployment.dll", but it didn't ex
ist.
            For SearchPath "{TargetFrameworkDirectory}".
            Considered "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Depl
oyment.exe", but it didn't exist.
            Considered "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Depl
oyment.dll", but it didn't exist.
            For SearchPath "C:\Program Files\Microsoft.NET\Primary Interop Assem
blies\".
            Considered "C:\Program Files\Microsoft.NET\Primary Interop Assemblie
s\System.Deployment.exe", but it didn't exist.
            Considered "C:\Program Files\Microsoft.NET\Primary Interop Assemblie
s\System.Deployment.dll", but it didn't exist.
            For SearchPath "{RawFileName}".
            Considered treating "System.Deployment" as a file name, but it didn'
t exist.
Done building target "ResolveAssemblyReferences" in project "WindowsApplication1
.vbproj".
Target CoreResGen:
    Copying file from "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.
dll" to "C:\Documents and Settings\pedram.soheil\Local Settings\Temp\tmp69\Syste
m.Data.dll".
    Copying file from "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
to "C:\Documents and Settings\pedram.soheil\Local Settings\Temp\tmp69\System.dll
".
    Copying file from "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Drawi
ng.dll" to "C:\Documents and Settings\pedram.soheil\Local Settings\Temp\tmp69\Sy
stem.Drawing.dll".
    Copying file from "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Windo
ws.Forms.dll" to "C:\Documents and Settings\pedram.soheil\Local Settings\Temp\tm
p69\System.Windows.Forms.dll".
    Copying file from "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Xml.d
ll" to "C:\Documents and Settings\pedram.soheil\Local Settings\Temp\tmp69\System
.Xml.dll".
    Copying file from "C:\Program Files\Microsoft.NET\SDK\v1.1\bin\Resgen.exe" t
o "C:\Documents and Settings\pedram.soheil\Local Settings\Temp\tmp69\Resgen.exe"
.
    C:\Documents and Settings\pedram.soheil\Local Settings\Temp\tmp69\Resgen.exe
 /compile Form1.resx,obj\FX1_1\Debug\WindowsApplication1.Form1.resources "My Pro
ject\Resources.resx",obj\FX1_1\Debug\WindowsApplication1.Resources.resources
    Deleting file "C:\Documents and Settings\pedram.soheil\Local Settings\Temp\t
mp69\Resgen.exe".
    Deleting file "C:\Documents and Settings\pedram.soheil\Local Settings\Temp\t
mp69\System.Data.dll".
    Deleting file "C:\Documents and Settings\pedram.soheil\Local Settings\Temp\t
mp69\System.dll".
    Deleting file "C:\Documents and Settings\pedram.soheil\Local Settings\Temp\t
mp69\System.Drawing.dll".
    Deleting file "C:\Documents and Settings\pedram.soheil\Local Settings\Temp\t
mp69\System.Windows.Forms.dll".
    Deleting file "C:\Documents and Settings\pedram.soheil\Local Settings\Temp\t
mp69\System.Xml.dll".
    Deleting directory "C:\Documents and Settings\pedram.soheil\Local Settings\T
emp\tmp69\".
Target CoreCompile:
    C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Vbc.exe /imports:Microsoft.Visu
alBasic,System,System.Collections,System.Collections.Generic,System.Data,System.
Drawing,System.Diagnostics,System.Windows.Forms /rootnamespace:WindowsApplicatio
n1 /define:"CONFIG=\"Debug\",DEBUG=-1,TRACE=-1,_MyType=\"WindowsForms\",PLATFORM
=\"AnyCPU\",FX1_1=-1" /reference:C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Sy
stem.Data.dll,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll,C:\WINDOWS
\Microsoft.NET\Framework\v1.1.4322\System.Drawing.dll,C:\WINDOWS\Microsoft.NET\F
ramework\v1.1.4322\System.Windows.Forms.dll,C:\WINDOWS\Microsoft.NET\Framework\v
1.1.4322\System.Xml.dll /main:WindowsApplication1.My.MyApplication /debug+ /debu
g:full /out:obj\FX1_1\Debug\WindowsApplication1.exe /resource:obj\FX1_1\Debug\Wi
ndowsApplication1.Form1.resources /resource:obj\FX1_1\Debug\WindowsApplication1.
Resources.resources /target:winexe Form1.vb Form1.Designer.vb "My Project\Assemb
lyInfo.vb" "My Project\Application.Designer.vb" "My Project\Resources.Designer.v
b" "My Project\Settings.Designer.vb"
    vbc : error BC30464: Namespace or type 'Generic' in the project-level Import
s 'System.Collections.Generic' cannot be found.
    vbc : error BC30420: 'Sub Main' was not found in 'WindowsApplication1.My.MyA
pplication'.
    C:\Temp\WindowsApplication1\WindowsApplication1\Form1.Designer.vb(2): error
BC32035: Attribute specifier is not a complete statement. Use a line continuatio
n to apply the attribute to the following statement.
    C:\Temp\WindowsApplication1\WindowsApplication1\Form1.Designer.vb(3): error
BC30001: Statement is not valid in a namespace.
    C:\Temp\WindowsApplication1\WindowsApplication1\Form1.Designer.vb(6): error
BC30001: Statement is not valid in a namespace.
    C:\Temp\WindowsApplication1\WindowsApplication1\Form1.Designer.vb(15): error
 BC30001: Statement is not valid in a namespace.
    C:\Temp\WindowsApplication1\WindowsApplication1\Form1.Designer.vb(20): error
 BC30001: Statement is not valid in a namespace.
    C:\Temp\WindowsApplication1\WindowsApplication1\Form1.Designer.vb(47): error
 BC30001: Statement is not valid in a namespace.
    C:\Temp\WindowsApplication1\WindowsApplication1\Form1.Designer.vb(49): error
 BC30460: 'End Class' must be preceded by a matching 'Class'.
    C:\Temp\WindowsApplication1\WindowsApplication1\Form1.vb(3): error BC30590:
Event 'Load' cannot be found.
    C:\Temp\WindowsApplication1\WindowsApplication1\Form1.vb(4): error BC30451:
Name 'lblFramework' is not declared.
    C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Application.Desig
ner.vb(22): error BC30188: Declaration expected.
    C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Application.Desig
ner.vb(24): error BC30001: Statement is not valid in a namespace.
    C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Application.Desig
ner.vb(33): error BC30001: Statement is not valid in a namespace.
    C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Application.Desig
ner.vb(37): error BC30460: 'End Class' must be preceded by a matching 'Class'.
    C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Resources.Designe
r.vb(24): error BC30002: Type 'Global.System.CodeDom.Compiler.GeneratedCodeAttri
bute' is not defined.
    C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Resources.Designe
r.vb(25): error BC30002: Type 'Global.System.Diagnostics.DebuggerNonUserCodeAttr
ibute' is not defined.
    C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Resources.Designe
r.vb(26): error BC30002: Type 'Global.System.Runtime.CompilerServices.CompilerGe
neratedAttribute' is not defined.
    C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Resources.Designe
r.vb(27): error BC30002: Type 'Global.Microsoft.VisualBasic.HideModuleNameAttrib
ute' is not defined.
    C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Resources.Designe
r.vb(30): error BC30002: Type 'Global.System.Resources.ResourceManager' is not d
efined.
    C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Resources.Designe
r.vb(32): error BC30002: Type 'Global.System.Globalization.CultureInfo' is not d
efined.
    C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Resources.Designe
r.vb(37): error BC30002: Type 'Global.System.ComponentModel.EditorBrowsableAttri
bute' is not defined.
    C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Resources.Designe
r.vb(38): error BC30002: Type 'Global.System.Resources.ResourceManager' is not d
efined.
    C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Resources.Designe
r.vb(41): error BC30002: Type 'Global.System.Resources.ResourceManager' is not d
efined.
    C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Resources.Designe
r.vb(52): error BC30002: Type 'Global.System.ComponentModel.EditorBrowsableAttri
bute' is not defined.
    C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Resources.Designe
r.vb(53): error BC30002: Type 'Global.System.Globalization.CultureInfo' is not d
efined.
    C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Resources.Designe
r.vb(57): error BC30002: Type 'Global.System.Globalization.CultureInfo' is not d
efined.
    C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Settings.Designer
.vb(20): error BC32035: Attribute specifier is not a complete statement. Use a l
ine continuation to apply the attribute to the following statement.
    C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Settings.Designer
.vb(21): error BC30001: Statement is not valid in a namespace.
    C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Settings.Designer
.vb(23): error BC30001: Statement is not valid in a namespace.
    C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Settings.Designer
.vb(27): error BC30001: Statement is not valid in a namespace.
    C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Settings.Designer
.vb(29): error BC30001: Statement is not valid in a namespace.
    C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Settings.Designer
.vb(31): error BC30001: Statement is not valid in a namespace.
    C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Settings.Designer
.vb(40): error BC30001: Statement is not valid in a namespace.
    C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Settings.Designer
.vb(56): error BC30460: 'End Class' must be preceded by a matching 'Class'.
    C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Settings.Designer
.vb(61): error BC30002: Type 'Global.Microsoft.VisualBasic.HideModuleNameAttribu
te' is not defined.
    C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Settings.Designer
.vb(62): error BC30002: Type 'Global.System.Diagnostics.DebuggerNonUserCodeAttri
bute' is not defined.
    C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Settings.Designer
.vb(63): error BC30002: Type 'Global.System.Runtime.CompilerServices.CompilerGen
eratedAttribute' is not defined.
    C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Settings.Designer
.vb(66): error BC30002: Type 'Global.System.ComponentModel.Design.HelpKeywordAtt
ribute' is not defined.
    C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Settings.Designer
.vb(67): error BC30002: Type 'Global.WindowsApplication1.My.MySettings' is not d
efined.
    C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Settings.Designer
.vb(69): error BC30451: Name 'Global' is not declared.
Done building target "CoreCompile" in project "WindowsApplication1.vbproj" -- FA
ILED.

Done building project "WindowsApplication1.vbproj" -- FAILED.

Build FAILED.
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets : warning
 MSB3245: Could not resolve this reference. Could not locate the assembly "Syste
m.Deployment". Check to make sure the assembly exists on disk. If this reference
 is required by your code, you may get compilation errors.
vbc : error BC30464: Namespace or type 'Generic' in the project-level Imports 'S
ystem.Collections.Generic' cannot be found.
vbc : error BC30420: 'Sub Main' was not found in 'WindowsApplication1.My.MyAppli
cation'.
C:\Temp\WindowsApplication1\WindowsApplication1\Form1.Designer.vb(2): error BC32
035: Attribute specifier is not a complete statement. Use a line continuation to
 apply the attribute to the following statement.
C:\Temp\WindowsApplication1\WindowsApplication1\Form1.Designer.vb(3): error BC30
001: Statement is not valid in a namespace.
C:\Temp\WindowsApplication1\WindowsApplication1\Form1.Designer.vb(6): error BC30
001: Statement is not valid in a namespace.
C:\Temp\WindowsApplication1\WindowsApplication1\Form1.Designer.vb(15): error BC3
0001: Statement is not valid in a namespace.
C:\Temp\WindowsApplication1\WindowsApplication1\Form1.Designer.vb(20): error BC3
0001: Statement is not valid in a namespace.
C:\Temp\WindowsApplication1\WindowsApplication1\Form1.Designer.vb(47): error BC3
0001: Statement is not valid in a namespace.
C:\Temp\WindowsApplication1\WindowsApplication1\Form1.Designer.vb(49): error BC3
0460: 'End Class' must be preceded by a matching 'Class'.
C:\Temp\WindowsApplication1\WindowsApplication1\Form1.vb(3): error BC30590: Even
t 'Load' cannot be found.
C:\Temp\WindowsApplication1\WindowsApplication1\Form1.vb(4): error BC30451: Name
 'lblFramework' is not declared.
C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Application.Designer.
vb(22): error BC30188: Declaration expected.
C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Application.Designer.
vb(24): error BC30001: Statement is not valid in a namespace.
C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Application.Designer.
vb(33): error BC30001: Statement is not valid in a namespace.
C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Application.Designer.
vb(37): error BC30460: 'End Class' must be preceded by a matching 'Class'.
C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Resources.Designer.vb
(24): error BC30002: Type 'Global.System.CodeDom.Compiler.GeneratedCodeAttribute
' is not defined.
C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Resources.Designer.vb
(25): error BC30002: Type 'Global.System.Diagnostics.DebuggerNonUserCodeAttribut
e' is not defined.
C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Resources.Designer.vb
(26): error BC30002: Type 'Global.System.Runtime.CompilerServices.CompilerGenera
tedAttribute' is not defined.
C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Resources.Designer.vb
(27): error BC30002: Type 'Global.Microsoft.VisualBasic.HideModuleNameAttribute'
 is not defined.
C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Resources.Designer.vb
(30): error BC30002: Type 'Global.System.Resources.ResourceManager' is not defin
ed.
C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Resources.Designer.vb
(32): error BC30002: Type 'Global.System.Globalization.CultureInfo' is not defin
ed.
C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Resources.Designer.vb
(37): error BC30002: Type 'Global.System.ComponentModel.EditorBrowsableAttribute
' is not defined.
C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Resources.Designer.vb
(38): error BC30002: Type 'Global.System.Resources.ResourceManager' is not defin
ed.
C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Resources.Designer.vb
(41): error BC30002: Type 'Global.System.Resources.ResourceManager' is not defin
ed.
C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Resources.Designer.vb
(52): error BC30002: Type 'Global.System.ComponentModel.EditorBrowsableAttribute
' is not defined.
C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Resources.Designer.vb
(53): error BC30002: Type 'Global.System.Globalization.CultureInfo' is not defin
ed.
C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Resources.Designer.vb
(57): error BC30002: Type 'Global.System.Globalization.CultureInfo' is not defin
ed.
C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Settings.Designer.vb(
20): error BC32035: Attribute specifier is not a complete statement. Use a line
continuation to apply the attribute to the following statement.
C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Settings.Designer.vb(
21): error BC30001: Statement is not valid in a namespace.
C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Settings.Designer.vb(
23): error BC30001: Statement is not valid in a namespace.
C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Settings.Designer.vb(
27): error BC30001: Statement is not valid in a namespace.
C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Settings.Designer.vb(
29): error BC30001: Statement is not valid in a namespace.
C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Settings.Designer.vb(
31): error BC30001: Statement is not valid in a namespace.
C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Settings.Designer.vb(
40): error BC30001: Statement is not valid in a namespace.
C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Settings.Designer.vb(
56): error BC30460: 'End Class' must be preceded by a matching 'Class'.
C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Settings.Designer.vb(
61): error BC30002: Type 'Global.Microsoft.VisualBasic.HideModuleNameAttribute'
is not defined.
C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Settings.Designer.vb(
62): error BC30002: Type 'Global.System.Diagnostics.DebuggerNonUserCodeAttribute
' is not defined.
C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Settings.Designer.vb(
63): error BC30002: Type 'Global.System.Runtime.CompilerServices.CompilerGenerat
edAttribute' is not defined.
C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Settings.Designer.vb(
66): error BC30002: Type 'Global.System.ComponentModel.Design.HelpKeywordAttribu
te' is not defined.
C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Settings.Designer.vb(
67): error BC30002: Type 'Global.WindowsApplication1.My.MySettings' is not defin
ed.
C:\Temp\WindowsApplication1\WindowsApplication1\My Project\Settings.Designer.vb(
69): error BC30451: Name 'Global' is not declared.
    1 Warning(s)
    41 Error(s)

Time Elapsed 00:00:10.76

C:\Program Files\Microsoft Visual Studio 8\VC>msbuild C:\Temp\WindowsApplication
1\WindowsApplication1\WindowsApplication1.vbproj /p:TargetFX1_1=true

I have been at this for hours. Please help!!

Thanks,
Pete

Jun 20, 2008 at 8:05 PM

It looks like the issue was being caused by any new Windows Forms that are added to the project using VS 2005! If I simply copy an existing VS 2003 created form, rename all reference to it in both resx and .vb files it compiles successfully! Even though that would be a pain to do on an ongoing basis, I think it would be worth it if it means I don't have to maintain 2 seperate versions of my application.

Thanks,
Pete

May 7, 2009 at 7:48 PM
I get this error without having a form, The project is a class library.

Any ideas how this is happing? Where is Global.System.CodeDom.Compiler.GeneratedCodeAttribute used in the project?
May 7, 2009 at 8:53 PM
Well, to answer my own question. I opened the projects Settings.Designer.vb and Resources.Designer.vb files and commented out the offending code.