Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Solution for developing in Windows Silverlight in Visual Studio 2017?

Our company is trying to remove Visual Studio 2015 all together but we still have some Silverlight code.

Is there a workaround for being able to work with Silverlight in VS 2017 even though it's not supported, or a more light-weight solution rather than having to keep either both IDE's or just use 2015?

like image 539
obizues Avatar asked Apr 08 '17 13:04

obizues


People also ask

Does Visual Studio 2019 support Silverlight?

Silverlight. Silverlight projects are not supported in this version of Visual Studio.

How do I run a Silverlight project?

Click the File menu, point to New and then click Project. Step 2 − A New Project dialog box will open. Under Templates, select Visual C# and then click Silverlight. In the right pane, choose Silverlight Application.


3 Answers

While it is true that Visual Studio 2017 does not support Silverlight5 projects I have found out that MSBuild shipped with Visual Studio 2017 is able to build them if you have Silverlight5 SDK installed.

I know that it is not an ideal solution but at least I don't need to keep older Visual Studio installed if I just need to rebuild the SL5 code.

For example I am using following build.bat file to build SL5 project with VS2017:

@setlocal

@rem Initialize build environment of Visual Studio 2017
call "c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsMSBuildCmd.bat"
@echo on

@rem Delete output directory
rmdir /S /Q sl5

@rem Clean project
msbuild ..\src\Pkcs11Interop\Pkcs11Interop\Pkcs11Interop.csproj /p:Configuration=Release /p:Platform=AnyCPU /target:Clean || goto :error

@rem Build project
msbuild ..\src\Pkcs11Interop\Pkcs11Interop\Pkcs11Interop.csproj /p:Configuration=Release /p:Platform=AnyCPU /target:Build || goto :error

@rem Copy result to output directory
mkdir sl5 || goto :error
copy ..\src\Pkcs11Interop\Pkcs11Interop\bin\Release\Pkcs11Interop.dll sl5 || goto :error
copy ..\src\Pkcs11Interop\Pkcs11Interop\bin\Release\Pkcs11Interop.xml sl5 || goto :error

@echo *** BUILD SL5 SUCCESSFUL ***
@endlocal
@exit /b 0

:error
@echo *** BUILD SL5 FAILED ***
@endlocal
@exit /b 1
like image 163
jariq Avatar answered Oct 14 '22 01:10

jariq


I'm left using both IDEs as 2017 does not support it. The solution uses 2017 but if I have to edit SL code I have to go back to the previous IDE version.

To quote Visual Studio 2017 Platform Targeting and Compatibility

Compatibility with Previous Releases

Installation

You can install and use Visual Studio 2017 alongside previous versions of Visual Studio, including Visual Studio 2015, Visual Studio 2013, and Visual Studio 2012.

Silverlight

Silverlight projects are not supported in this version of Visual Studio. To maintain Silverlight applications, continue to use Visual Studio 2015.

like image 32
Nkosi Avatar answered Oct 14 '22 00:10

Nkosi


The Silverlight for Visual Studio extension on the Visual Studio Marketplace unofficially supports Silverlight projects in Visual Studio 2017 and Visual Studio 2019.

It's FREE.

Disclosure:
I published the Visual Studio extension.

like image 7
Rami A. Avatar answered Oct 14 '22 01:10

Rami A.