Solution for developing in Windows Silverlight in

2020-02-10 14:56发布

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?

3条回答
萌系小妹纸
2楼-- · 2020-02-10 15:28

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
查看更多
我想做一个坏孩纸
3楼-- · 2020-02-10 15:35

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.

查看更多
何必那么认真
4楼-- · 2020-02-10 15:36

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.

查看更多
登录 后发表回答