开发者

Windows 7 x64 Edition and Visual Studio 2010 dll reference

开发者 https://www.devze.com 2023-04-05 07:33 出处:网络
I used to use Visual Studio 2008. Then I decided to take Windows 7 x64 and Visual Studio 2010 to use new IDE features inside of the our development cycle etc.

I used to use Visual Studio 2008. Then I decided to take Windows 7 x64 and Visual Studio 2010 to use new IDE features inside of the our development cycle etc.

One of our projects is using Microsoft.SqlServer.Smo.dll and related some SQL server management DLLs also. I got many problems when I tried to compile new projects.

Here is the my problem.

  • I create a very simple console project, then I added Microsoft.SqlServer.Smo.dll reference and I put a simple below line into main() function.

        static void Main(string[] args)
        {
            Microsoft.SqlServer.Management.Smo.ApplicationRole role =
                new Microsoft.SqlServer.Management.Smo.ApplicationRole();
        }
    

ApplicationRole class is coming from Microsoft.SqlServer.Smo.dll, I changed Target framework property of project to .Net Framework 4 (not client profile). It compil开发者_JAVA技巧ed successfully.

When I tried to change target framework to .Net Framework 2.0 it's giving error that

Error 1 The type or namespace name 'ApplicationRole' does not exist in the namespace 'Microsoft.SqlServer.Management.Smo' (are you missing an assembly reference?) C:\Users\fatihy\documents\visual studio 2010\Projects\ConsoleApplication2\ConsoleApplication2\Program.cs 14 52 ConsoleApplication2

That's the small one of errors what I have, but I'm sure others related with this issue.

When I checked Microsoft.SqlServer.Smo.dll with corflags tool see below,

Setting environment for using Microsoft Visual Studio 2010 x86 tools.

c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>corflags "C:\Program File
s\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.Smo.dll"
Microsoft (R) .NET Framework CorFlags Conversion Tool.  Version  4.0.30319.1
Copyright (c) Microsoft Corporation.  All rights reserved.

Version   : v2.0.50727
CLR Header: 2.5
PE        : PE32
CorFlags  : 9
ILONLY    : 1
32BIT     : 0
Signed    : 1

c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>

As you can see this dll is supporting .net 2.0 CRL.

Sample project can be also downloaded from here

What I'm doing wrong ?

Thank you


Microsoft.SqlServer.Smo.dll is build in .Net 3.5. You simply can't use it if your target framework for the project is .Net Framework 2.0.

Just checked it in your demo console app.

0

精彩评论

暂无评论...
验证码 换一张
取 消