Portable Class Library - target Silverlight 5 - c#

The "change target framework" dialog in the portable class library properties has a link pointing to this page:
http://msdn.microsoft.com/en-us/hh487282.aspx
Said page indicates that there is a silverlight 5 'targeting pack' included in 'Silverlight 5 RC Tools Visual Studio 2010 SP1'.
My assumption is that the RC tools are replaced by the release Silverlight 5 tools - and I definitely don't have the option to choose silverlight 5 despite having these tools.
Thinking they may have left the targeting pack out of the release tools, I tried uninstalling them and installing the RC tools to see if the option to target silverlight 5 would show up - however that didn't seem to work either.
How can I target Silverlight 5 with my portable class library?
Also I should add, I know that silverlight 4 assemblies are compatible with silverlight 5, however referencing silverlight 4 libraries from within a silverlight 5 application has other side affects (such as code analysis / metrics not working) which I'm trying to resolve ("could not unify the platforms") So a fix to that would be equally appreciated :)

Portable Class Libraries supports Silverlight 5 out-of-the-box, choosing Silverlight 4 will enable you to run on Silverlight 5. The Visual Studio 11 Beta out next week adds full support for Silverlight 5 (if you install it on a box with Visual Studio 2010, it will also add Siverlight 5 support to it)
The Code Analysis issue is a known issue (the same problem occurs if you reference RIA Services and attempt to run Code Analysis), unfortunately, there's no known workaround. Sadly, we could not get the fix into time to make it into the Visual Studio 11 Beta. It will, however, be fixed by the time we ship.
David Kean (BCL Team)

Related

Visual Studio 2022 Community: Stuck with C# language version 7.3?

Trying to use sample code from the book "Learn C# programming..." by Bancila and Sharma.
When I try to build the project, I get error messages saying that certain features are not available in C# 7.3, and that I should upgrade to C# 9.0 resp. 10.0.
However, there is no way to change the language version. When I go to Project Properties/Build/Advanced, the language version shows frozen. Also, adding the line "<LangVersion>10.0</LangVersion>" in the .csprog file seems to have no effect.
Can somebody help or at least explain?
Thanks!
I added the line "<LangVersion>10.0</LangVersion>" in the .csprog file. But the problem remains.
The C# version depends on the .NET / .NET Framework version you are using.
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/configure-language-version
You'll need to download the relevant SDk to have access to newer versions of C#.
For C# 9, you need the .NET 5 SDK.
You can find it here:
https://dotnet.microsoft.com/en-us/download/dotnet
The book is targeted for C# 8 i.e. net core 3, so I would recommend just creating a project for .Net 6 or 7. These should be fully backward compatible with .net Core 3. In the visual studio installer you can select what specific .Net versions you want to include support for. I would expect .Net 6 to be installed by default, but it is easy to check.

Using WinUI 2.3 in an Uno shared project

I've been excited about Uno but at the end of the day, I'm a diehard Windows 10 M supporter and would like to publish an app for the platform before it's completely buried and impossible to target.
To get fun new controls in Windows 10 15063, I need WinUI 2.3, but I'd like to use Uno.UI alongside it.
If I use the guide for WinUI installation, my Windows build works just fine. The issue TwoPaneView with Uno Platform seemed promising but the only answer falsely asserts that not using a namespace with TwoPaneView will build on Windows 10 -- maybe with 1903 minimum but not with 15063 minimum in release mode.
How do I properly juggle the namespaces? I'm okay with splitting out a few per-project files if I have to but I would rather not.
Ahem... In point of fact, I didn't "falsely assert" anything!
WinUI and Uno.UI will build just find in a UWP head project targetting the Windows 10 Creators Update (Build 15063) however you can't use the ".NET Native tool chain" with such an old SDK.
You can check this by changing the min targetting version of my "TwoPainView" project (from here) and compiling (in debug or release without "Compile with .NET Native tool chain") which will result in no errors but a couple of (entirely sensible) warnings along the lines of:
Type 'Windows.UI.Xaml.Controls.TwoPaneView' is defined under contract 'Windows.Foundation.UniversalApiContract' version '8.0.0.0', but the contract version for the targeted min version is '4.0.0.0'!
And this is correct. It is unlikely you will be able to use the TwoPaneView on such an old SDK.

Visual Studio 2013/15 doesn't load portable Silverlight projects after VS2017 install

After installing Visual Studio 2017 on my workplace, I can't build legacy solutions with a common, portable library anymore. The library was supposed to work both under regular .NET and Silverlight. The .proj file hasn't been changed for a very long time and worked perfectly, until installing VS2017. I think it's not possible with VS2017, but VS2013 and VS2015 also can't load it anymore.
Is it possible that VS2017 installation removed the Silverlight support, even from the old Visual Studios?
Edit: I could compile it, after using VS 2015, to remove the targets Windows 8 and Windows Phone Silverlight 8, leaving only .NET Framework 4 and Silverlight 5. VS 2013 could also load it after the change. The project was supposed to only work with Webbrowser Silverlight, not anything Windows 8 or phone, probably targeted by default.
VS 2015 error:
There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
(note: the project properties under Build have only "AnyCPU", I can't switch to x86 anymore, not even when setting the solution to x86)
VS 2013 error:
VS2013 doesn't load the project at all. Upon clicking "Reload Project" in context menu, I get the message:
"Visual Studio update required
One or more projects require a framework SDK (.NETPortable, Version=v4.0, Profile=Profile136) that is either not installed or is included as part of a future update to Visual Studio"
The download link only takes me to the Microsoft landing page, nothing related.
Installing Visual Studio 2017 doesn't affect Visual Studio 2015's support for Silverlight.
An answer to a similar question can be found here:
https://stackoverflow.com/a/21725379/90287
Try installing Microsoft .NET Portable Library Reference Assemblies
4.6

Missing ASP.NET Core templates in VS Enterprise 15 Preview 5

I just installed Preview 5. I've mainly been doing front-end work for the past year, but I figured I'd start checking out .NET core finally, now that it seems more stable.
I've got an MSDN subscription, so I grabbed the Enterprise Preview 5 download and installed it.
Here are my options for framework version when I go to start a new project.
Here are my options for new web project. If I reopen the installer to Manage my installation,
here are the .NET components I have installed.
Here are my compilers and build activities. As far as I can tell, I've got everything I need to have installed in order to use DNC, but it's just not showing up.
Any ideas?
I've got a .NET Core tab under Visual C# after I've followed the instructions here although I'm not sure if it's the same for VS 15, I've been using VS 2015 with Update 3.
However it appears that some templates have been published here and maybe this is what you're looking for.
I'm not sure about "it seems more stable" especially that they still didn't move from project.json to .csproj (scheduled for the end of the year) but good luck and have fun. Be patient, it will get there :).

How to generate installation requirements for my program?

I have a program in C# that was developed on a PC that has several of installed .NET frameworks, Service Packs, etc. How can I understand what are the minimal installation requirements in order to distribute the program to users? Should I start with a clean PC and test one-by-one .NET frameworks or is there a better approach?
Start by looking at the .NET version that your application is targeting.
If for example, you are targeting .NET 3.5 you will need to also include .NET 2.0
.NET 4.0 and 4.5 are self contained, so including earlier versions is not necessary for them.
You can check the version that you are targeting by going to the properties of your project (right click, properties in the solution explorer), clicking on the Build tab and looking for Target Framework
Microsoft recommends that you look for features that your application requires in the operating systems rather than look for which version of Windows you are targeting. So its better to list those out and tackle them one by one. I find this to be a bit overkill sometimes, but it does help once you get to logo certification.
check Target Framework in your Project Properties
Note :- Step for open project Solution
(Open Your Project in Visual Studio and then open solution explorer and Right click on Properties)
Some link to more Help you
1 : Retrieve Target Framework Version and Target Framework Profile from a .Net Assembly
2 : How to find the .NET framework version of a Visual Studio project?

Categories