---
# System prepended metadata

title: 轉換專案為SDK
tags: [Visual Studio]

---

###### tags: `Visual Studio`
# 轉換專案為SDK

## 如何移轉

- 安裝工具
```shell=
dotnet tool install --global Project2015To2017.Migrate2019.Tool
```
- 執行轉換
```shell=
dotnet migrate-2019 migrate "{csproj file path}"
```

## 問題
 ### WinForm 專案(專案裡有Form)於專案檔加入
```xml=
<UseWindowsForms>true</UseWindowsForms>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
<EmbeddedResourceUseDependentUponConvention>true</EmbeddedResourceUseDependentUponConvention>
```
### 原參考路徑已不再可用
```xml=
<PropertyGroup>
    <AssemblySearchPaths >
        {CandidateAssemblyFiles};
        $(ReferencePath);
        {HintPathFromItem};
        {TargetFrameworkDirectory};
        {Registry:$(FrameworkRegistryBase),$(TargetFrameworkVersion),$(AssemblyFoldersSuffix)$(AssemblyFoldersExConditions)};
	{AssemblyFolders};
	{GAC};
	{RawFileName};
	$(OutputPath);
	c:/pch;
    </AssemblySearchPaths>
</PropertyGroup>
```
說明
```xml=
<!--
The SearchPaths property is set to find assemblies in the following order:
 
    (1) Files from current project - indicated by {CandidateAssemblyFiles}
    (2) $(ReferencePath) - the reference path property, which comes from the .USER file.
    (3) The hintpath from the referenced item itself, indicated by {HintPathFromItem}.
    (4) The directory of MSBuild's "target" runtime from GetFrameworkPath.
        The "target" runtime folder is the folder of the runtime that MSBuild is a part of.
    (5) Registered assembly folders, indicated by {Registry:*,*,*}
    (6) Legacy registered assembly folders, indicated by {AssemblyFolders}
    (7) Look in the application's output folder (like bin\debug)
    (8) Resolve to the GAC.
    (9) Treat the reference's Include as if it were a real file name.
-->
```
### 明明沒有設定命令列參數，依然殘留轉換前設定的參數
移除 *.user 檔案後，重新載入專案