I have a C# console app project which I am trying to turn into a Nuget package so that multiple projects within my team can call the executable from this project in an AfterResolveReferences step within the .csproj file.
I've created the Nuget package just fine with a .nuspec file that looks something like this:
<package ...>
<metadata>
...
</metadata>
<files>
<file src="bin\Release\*.*" target="tools" />
</files>
</package>
This works and creates a Nuget package which contains my executable in the "tools" directory. The problem is the the containing folder includes the version number of the Nuget package which will change frequently. I'm trying to reference it like this in the .csproj file:
<Target Name="AfterResolveReferences">
<Exec Command="$(SolutionDir)packages\PackageName.1.2.3\tools\AssemblyName.exe" />
</Target>
When I include PackageName.1.2.3 in the path, it works as expected but this is obviously a very brittle solution. When I just use "AssemblyName.exe" I get "The command AssemblyName.exe exited with code 9009".
There's obviously a simple standard for doing this kind of thing which I'm not familiar with - MSBuild and Nuget aren't my strongest suits, so I'd be very grateful for any advice.
What I'm actually trying to achieve here is to create a TypeScript file containing interfaces derived from C# classes defined in my model project using the TypeLite.Lib package. The TypeScript file must be created before the web project is built, as TypeScript code in the web project depends on the interfaces contained in this output. I'm open to suggestions of more elegant ways to solve this problem but I would still like to know how to solve the referencing problem anyway.