dotnet 指令
mkdir project cd project dotnet new sln
dotnet new classlib -o [classlib name] dotnet new classlib -o Utils
dotnet new console -o [app name] dotnet new console -o testApp
dotnet sln add Utils/Utils.csproj dotnet sln add testApp/testApp.csproj
dotnet add testApp/testApp.csproj reference Utils/Utils.csproj
nuget 相關
dotnet new nugetconfig
dotnet nuget locals all --list
global-packages: C:\Users\ivan\.nuget\packages\
<config> <add key="globalPackagesFolder" value="./packages" /> <add key="repositoryPath" value="./packages" /> </config> <packageRestore> <add key="enabled" value="false" /> <add key="automatic" value="false" /> </packageRestore>
如何使用單一檔案部署
<PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>net6.0</TargetFramework> <ImplicitUsings>enable</ImplicitUsings> <Nullable>enable</Nullable> <PublishSingleFile>true</PublishSingleFile> <SelfContained>true</SelfContained> <RuntimeIdentifier>win-x64</RuntimeIdentifier> <PublishReadyToRun>true</PublishReadyToRun> </PropertyGroup>
dotnet publish -r linux-x64
參考網頁 微軟教學網頁 .net 6 console template 變動 單一檔案部屬
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up