Dot-Net

在 Visual Studio 2017 中使用 Windows Silverlight 進行開發的解決方案?

  • March 21, 2019

我們公司正在嘗試一起刪除 Visual Studio 2015,但我們仍然有一些 Silverlight 程式碼。

是否有一種解決方法可以在 VS 2017 中使用 Silverlight,即使它不受支持,或者是更輕量級的解決方案**,而不是必須保留兩個 IDE 或只使用 2015?**

因為 2017 不支持它,所以我只使用兩個 IDE。該解決方案使用 2017,但如果我必須編輯 SL 程式碼,我必須回到以前的 IDE 版本。

引用Visual Studio 2017 平台定位和兼容性

與以前版本的兼容性

安裝

您可以安裝和使用 Visual Studio 2017 以及以前版本的 Visual Studio,包括 Visual Studio 2015、Visual Studio 2013 和 Visual Studio 2012。

銀光

此版本的 Visual Studio 不支持 Silverlight 項目。要維護 Silverlight 應用程序,請繼續使用 Visual Studio 2015。

雖然 Visual Studio 2017 確實不支持 Silverlight5 項目,但我發現,如果您安裝了Silverlight5 SDK ,Visual Studio 2017 附帶的 MSBuild 能夠建構它們。

我知道這不是一個理想的解決方案,但如果我只需要重建 SL5 程式碼,至少我不需要安裝舊的 Visual Studio。

例如,我正在使用以下build.bat文件使用 VS2017 建構 SL5 項目:

@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

引用自:https://stackoverflow.com/questions/43294628