![](/img/trans.png)
[英]How can I link my C# scripts so that item count influences score in my Unity game?
[英](Visual Studio) How to import powershell scripts into c# project so that I can publish my .NET application together with the scripts
我在幾個腳本中有一些自定義 powershell cmdlet,其中一個我已經在 C# 中加載了一個這樣的執行
string Script2 = File.ReadAllText(@"C:\blabla\blabla\ScriptPowershell\TestCheck.ps1");
shell.Commands.Clear();
shell.AddScript(Script2, false);
shell.Invoke();
shell.Commands.Clear();
shell.AddCommand("TestCheck").AddParameter("ServerName", $"{serverId}").AddParameter("ServerPort", $"{serverPort}");
Collection<PSObject> psObjects = shell.Invoke();
這樣做的主要問題是,如果我在另一台計算機上發布並安裝此應用程序,而該計算機肯定可能沒有此腳本位於相同的確切目錄中,則 cmdlet 將不起作用。
問題:有沒有辦法發布帶有腳本的應用程序,這樣它就不需要在用戶計算機中搜索腳本? 或者至少與 .exe 位於同一目錄中
歡迎任何解決此問題的建議。
謝謝 !
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.