Featured post
How to write for .net 3.5 in Visual Studio 2010 -
i have asp mvc 2 project, written in vs 2008 upgraded vs 2010. want, however, remain .net 3.5 since production environment not have .net 4 installed yet. thought possible. when upgraded project answered no question upgrading .net framework version. have checked , .net 3.5 set target framework in advanced compile options project.
my problem can write code builds , runs fine in vs doesn't work in .net 3.5 environment. example, added function optional paramater of type integer? (nullable integer). appears allowed in 4 not in 3.5? anyway, works fine in vs 2010. however, when try build , deploy run 1 of 2 problems. (we use custom build/deploy scripts - build uses msbuild on separate build server.)
porblem 1 if try use 3.5 version of msbuild. build fails message "error bc31405: optional parameters cannot have structure types.".
problem 2 if try use .net 4 version of msbuild on build server (remember target framework still 3.5, change msbuild executable build script uses). in case builds, when try run site on server has 3.5 not .net 4 installed error "could not load file or assembly 'projectname.xmlserializers' or 1 of dependencies. assembly built runtime newer loaded runtime , cannot loaded."
according msdn (http://msdn.microsoft.com/en-us/library/bb398202.aspx) need make sure target framework right (and references, there doesn't seem problem there in builds fine against 3.5 long avoid syntaxes, etc.)
the problem no error in vs tell me there problem if use structures won't build. accoridng visual studio multi-targeting overview article on msdn (http://msdn.microsoft.com/en-us/library/bb398197.aspx) "when work on project targets earlier version of .net framework, visual studio dynamically makes changes in development environment, such following ... compiles , builds appropriate version of compiler , appropriate compiler options" why compile in vs not msbuild?
i wondered if toolset property problem (if specify /tv:3.5 on command line msbuild 4 same build errors msbuild 3.5). according msbuild multitargeting article (http://msdn.microsoft.com/en-us/library/ee395432.aspx) "you designate tool set setting toolsversion attribute of project element of project file". however, if change toolsversion="4.0" toolsversion="3.5" in .vbproj file visual studio conversion wizard pops when try reload proejct.
so, how can either:
a - vs 2010 accept it's .net 3.5 project , use appropraite background compiler , therefore show me errors during development (before gets build server)?
or
b - build project such way (with msbuild 4 example) build still run in .net 3.5 environment?
seems trying use c# 4.0 language features
in .net framework 3.5
application.
refrain using new features introduced in c# 4.0
such as:
- optional parameters
- dynamic programming
- covariance/contravariance
- and others listed here.
and should fine.
- Get link
- X
- Other Apps
Comments
Post a Comment