LoginSignup
2
3

More than 5 years have passed since last update.

UiPathのカスタムアクティビティのnupkgの作り方(元記事の訂正)

Last updated at Posted at 2018-10-18

UiPath Studioで使用するカスタムアクティビティの作成方法 で、nupkgを作成する際の nuspecファイルを下記の通りにするという記事を書きました。

<?xml version="1.0"?>
<package >
  <metadata>
    <id>$id$</id>
    <version>$version$</version>
    <title>$title$</title>
    <authors>m-kino</authors>
    <owners>m-kino</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>$description$</description>
    <releaseNotes>Summary of changes made in this release of the package.</releaseNotes>
    <copyright>Copyright 2018</copyright>
  </metadata>
  <files>
    <file src="bin\Release\*.dll" target="lib" />
  </files>
</package>

この

<files>
  <file src="bin\Release\*.dll" target="lib" />
</files>

は、

DLLファイルをlibディレクトリ直下に配置せよっていう指示ですが、コレを書かないとUiPath Studioでは参照されない箇所(lib¥net461 っていうディレクトリ配下)にDLLが置かれるっぽく、その対応のためのおまじないです。

って話だったのですが、どうも解決法が見つかったぽいので追記。

イケてない構成

改善前は上記の通り

<files>
  <file src="bin\Release\*.dll" target="lib" />
</files>

を書いてるので、このようにlib 直下にもDLLが配置されるようになっています。
image.png

ところで、NuGetサイトにあがっているnupkgをつらつらとみていたところ、、、、
image.png

net45、、、?これはDLLがlib直下にないのに、UiPath Studioで動くわけですよね、、。

コレってどうも複数のターゲット フレームワークのサポート に説明されている、呼び出す側の.NETのバージョンに応じてDLLを切り替える(?)仕組みっぽいです。

この値を制御するには、Visual Studio上で、ターゲットフレームワークを変更すればよさそうです。

ターゲットフレームワークの変更

Visual Studioのプロジェクトを開いて、ソリューションエクスプローラを右クリック >> プロパティ >> アプリケーション を選択して、アセンブリ名などを表示する画面を開きます

そこでターゲットフレームワークを 4.6.1 → 4.5 へ変更します。
image.png

ホントにイイ?って聞かれますが、はいを選択
image.png

変更されました。。

で nuspec上の

<files>
  <file src="bin\Release\*.dll" target="lib" />
</files>

これは削除しちゃいましょう。

たぶん、コレでOKな構成

さて、おなじみの nuget pack コマンドでnupkgを作成してみたところ、、、

Z:\git\Path\Utils> nuget pack Utils.csproj -Prop Configuration=Release

image.png

それっぽい構成になりました!UiPath Studioで読み込ませてみたところ、問題なさそうです。

おつかれさまでした。

関連リンク

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3