New default VB.NET project immediately gives an error

谁说胖子不能爱 提交于 2019-12-03 13:10:03

I had this problem when creating new VB Projects, I changed the file format to use when creating new projects to MSBuild (Visual Studio 2008) instead of the default MSBuild (Visual Studio 2010) From Preferences > Load/Save

Using a text editor, change your *.vbproj file to add the following line:

    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>

to the first PropertyGroup, e.g.

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    ...
    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
  </PropertyGroup>
  ...
</Project>

I had the same problem in Linux, but it seems that the version that properly supports VB.Net (at least without causing errors) is MonoDevelop 3.0.4, & after a google search, I landed on a SourceForge.net page with the newer MonoDevelop 3.0.6 source code.

I downloaded it, Extracted it's contents, & did the following in a root terminal...

      cd /home/knoppix/Downloads/monodevelop-3.0.6
      ./configure --prefix=`pkg-config --variable=prefix mono`
      make
      make install

Then closed the terminal, & ran MonoDevelop again, & it was no longer the version I had before (MonoDevelop 3.0.3), was now MonoDevelop 3.0.6.

When I created a new VB.Net GTK# 2.0 project, the errors were still there, but then I right-clicked on the project in the solution explorer, & chose Options, then under Build, I selected General... the 4.0 profile was now there, & could be selected. After selecting it, & closing the dialog, all the errors vanished.

I then changed the default format of new projects to MSBuild (Visual Studio 2010) from Edit, Preferences... then in the pop up dialog under Preferences, Load/Save.

I am still confused as to how to create a form though. C# side of things can create it easily, but I don't see the option in the VB side. I might have to install some other things to enable it, or something.

The VB.NET addin in MonoDevelop doesn't support the .NET 4.0 framework. I'm surprised it let you create an invalid project - that seems like a bug. Please file a report at http://bugzilla.xamarin.com.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!