2

I created a test solution in that includes three projects. There's a database project, a PCL and a standard class library (let's call it SCL). They're all C# projects targetting .

If I add a reference from the database project to SCL, everything compiles without issues. If I also add a reference from database project to PCL, again everything compiles without any warnings in the build output.

However... there's this:

enter image description here

I noticed that little warning sign on the PCL. Unfortunately that's all I have. There's no build issues, no clues in the build output, no tooltip if I hover the sign... nothing. I couldn't find anything on the net about using (or not using) PCL as references for apps either.

Anyone has an idea? Is there any problem with referencing a PCL from a SQL Server database project in Visual Studio? Why is it treated differently than SCL?

I can't do much test because right now I do not have a DB yet. I'm just planning ahead.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Crono
  • 10,211
  • 6
  • 43
  • 75
  • Can't you publish to a local instance of SQL Server Express that gets installed along with Visual Studio? Even if that is just SQL Server 2012, it should be the same in terms of what you are testing for. For many issues you really don't know until you run the CREATE ASSEMBLY within SQL Server as several potential issues are checked at that point and are unknown to be issues at compile time. – Solomon Rutzky Aug 14 '14 at 17:31
  • @srutzky Good suggestion, but does Sql Server 2012 even supports .NET 4.5.1? Couldn't find anything about that either. – Crono Aug 14 '14 at 17:43
  • SQL Server 2012 is linked to the 4.0 series. I have not tried it myself, but would expect anything that started in 4.0 to work, even if the target framework is 4.5.1. However, if you are using functionality that started in 4.5.1 then that might not work, at least not without loading the 4.5.1 BCL as UNSAFE. In either case, you need to test it but that should be easy enough by just using what came with Visual Studio or downloading SQL Server Express (the free version). – Solomon Rutzky Aug 14 '14 at 18:01
  • I just checked and both SQL Server 2012 and 2014 are linked to .Net 4.0.30319. – Solomon Rutzky Aug 14 '14 at 19:02
  • @srutzky I see... thanks for your help, I'll try running tests then. – Crono Aug 19 '14 at 17:10

1 Answers1

2

For others who find this question and wonder at the icon (as I did), this yellow symbol appears when the type library is built against a different .NET framework version:

enter image description here

This is usually the case with database projects using newer class library builds as Visual Studio 2013 creates .NET 4.0 projects by default*.

To remove the symbol, ensure your database project and class library use the same .NET Framework version, (e.g. 4.0, 4.5.1, etc.).

enter image description here

You can set the target framework of your database project via Properties->SQLCLR->Target Framework:

enter image description here

As far as I can tell it is just a warning flag, as code compiles, links and runs as expected.

kad81's response


* - .NET 4.5 when using 'New Project' from the database context menu of the SQL Server Object Explorer. Using SQL Express 2014 SP1
Community
  • 1
  • 1