creating nuget package adds project folder name to payload file path - visual-studio-2013

I'm attempting to create a nuget package using Nuget Package Explorer. The project is just a collection of dlls and files I need copied to the output (bin) directory of the project in which it is used, which unless I'm mistaken is pretty much the way nuget packages work.
However, after creating the package the path to the files I want copied appears to be incorrect, even though I specified no such path in my package.
I created the package, added the libs added the two platforms I want to support (Win8.1 and WP8.1 RT) and added the files for each platform in their respective libs container.
When I install the package into my project it creates the package folder with the exact same structure. Everything looks good.
However, when I then build the project, instead of trying to add the contents of for example:
packages/MyPackage/libs/wpa81/MyProject.WindowsPhone.Data.xml
it's instead attempting to find this:
packages/MyPackage/libs/wpa81/MyProject.WindowsPhone/MyProject.WindowsPhone.Data.xml
and so I get an error like:
C:\Program Files
(x86)\MSBuild\Microsoft\VisualStudio\v12.0\AppxPackage\Microsoft.AppXPackage.Targets(1496,9):
error APPX0702: Payload file 'C:\Users\Me\Visual
Studio\AnotherProject\packages\MyPackage\lib\wpa81\MyProject.WindowsPhone\MyProject.WindowsPhone.Data.xml'
does not exist.
now, MyProject.WindowsPhone IS the name of the original project I used to create the content I want to include in the package, but I make no reference to this folder anywhere in the nuget package or manifest.
If I manually create that folder and move everything inside it works, but none of the other packages I use require me to do this. I want to simply reference the files that are there, where is it getting this folder name from?
does anyone have any idea what I'm doing wrong? please let me know what information I can add to help identify the problem...

Related

Could not load file or assembly 'Accord.Video.FFMPEG.dll' or one of its dependencies on Click Once Install

My application that has 'Accord.Video.FFMPEG.dll' and supporting DLL's works properly in the development environment. When I publish and try to Click Once install I receive the following message:
Could not load file or assembly 'Accord.Video.FFMPEG.dll' or one of its dependencies. The specified module could not be found.
File name: 'Accord.Video.FFMPEG.dll'
As suggested in other posts, I copied the following DLL's into my Resources folder in my Visual Studio Project and specified to 'always copy to installation folder'. I see them in the Install Folder inside the folder C:\JPGManagerPublish\Application f
Files\JPGManager_3_0_0_179\Resources
avcodec-57.dll
avdevice-57.dll
avfilter-6.dll
avformat-6.dll
avformat-57.dll
avutil-55.dll
postproc-54.dll
swresample-2.dll
swscale-4.dll
These show up in the application install folder as
avcodec.57.dll.deploy, etc.
I install the application with Setup and I when I execute the function that utilizes Accord.Video.FFMPEG.dll I get the error message :
'Accord.Video.FFMPEG.dll' or one of its dependencies. The specified module could not be found.
File name: 'Accord.Video.FFMPEG.dll'
You can try to solve it with the following steps:
Use the latest package currently available in NuGet.
Make sure your application is running in 64-bit mode (check Environment.Is64BitProcess and Environment.Is64BitOperatingSystem), if so, download and install Accord.Video.FFMPEG.x64 from NuGet only (do not install Accord.Video. FFMPEG).
If you still face the problem, please check the value of Directory.GetCurrentDirectory() and make sure the dll of FFmpeg is contained in this folder.
Try adjusting your PATH variable to include the directory where these .dlls are located (usually in the Bin folder).
string oldPath = Environment.GetEnvironmentVariable("Path");
Environment.SetEnvironmentVariable("Path", pathToFFmpegDlls + ";" + oldPath);

web deployment package (.zip file) not created in Visual Studio 2013

I am trying to create a deployment package in Visual Studio 2013. I have specified that the package should be placed at C:\Deployment\bin\WebSite.zip - the absolutely simplest location. All the project files build but the publish fails with this error:
Transformed Web.config using C:\Services\IdentityServer\Thinktecture.IdentityServer.v2\src\OnPremise\WebSite\Web.Siloed.config into obj\Siloed\TransformWebConfig\transformed\Web.config.
Auto ConnectionString Transformed Areas\Admin\Views\Web.config into obj\Siloed\CSAutoParameterize\transformed\Areas\Admin\Views\Web.config.
Auto ConnectionString Transformed Views\Web.config into obj\Siloed\CSAutoParameterize\transformed\Views\Web.config.
Auto ConnectionString Transformed obj\Siloed\TransformWebConfig\transformed\Web.config into obj\Siloed\CSAutoParameterize\transformed\Web.config.
Copying all files to temporary location below for package/publish:
obj\Siloed\Package\PackageTmp.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets(2584,5): Error : Copying file ..\..\..\Deployment\bin\um.zip to obj\Siloed\Package\PackageTmp\.ebextensions\um.zip failed. Could not find a part of the path '..\..\..\Deployment\bin\um.zip'.
I have no idea where this path '......\Deployment\bin\um.zip' is coming from. I specified that the deployment package should be created at C:\Deployment\bin\WebSite.zip, not um.zip.
So, I checked out C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets(2584,5) and the code looks like this:
<!--Force Copy Of all file to the $(WPPAllFilesInSingleFolder) if needed-->
<CopyPipelineFiles PipelineItems="#(FilesForPackagingFromProject)"
SourceDirectory="$(WebPublishPipelineProjectDirectory)"
TargetDirectory="$(WPPAllFilesInSingleFolder)"
SkipMetadataExcludeTrueItems="True"
UpdateItemSpec="True"
DeleteItemsMarkAsExcludeTrue ="True"
Condition="'#(FilesForPackagingFromProject)' != ''">
<Output TaskParameter="ResultPipelineItems" ItemName="_FilesForPackagingFromProjectTempory"/>
</CopyPipelineFile>
I have tried editing the "PipelineItems" and "SourceDirectory" and have even hardcoded them. But the same message, "Could not find part of the path....", is being displayed every time I run the Publishing. The "Could not find part of the path...." points to the new paths I specified in "PipelineItems" and "SourceDirectory. The .zip file never seems to get created anywhere. I have seached my entire computer for um.zip and WebSite.zip with not luck.
Any help would be greatly appreciated as I am completely out of ideas.
Turns out this um.zip is somehow part of build but it is not getting created. Anyway, I was lucky enough to find a previous deployment package that was generated and I just manually built the new deployment package based off the old one. Deployed fine so I guess that is how I will proceed.

NuGet package installed on the solution level instead of project level

I'm trying to customize an existing NuGet package to add some new behavior, specifically into a package called StyleCop.MsBuild
Downloaded the source of the package from bitbucket repo (https://bitbucket.org/adamralph/stylecop-msbuild/wiki/Home)
Changed id of package in *.nuspec file from StyleCop.MSBuild to MyCustomPackage
Created *.nupkg file using NuGet Package Explorer
Uploaded *.nupkg file to my local NuGet server
So the only change was the id of the original package.
But now when I try to install MyCustomPackage into a project, it is installed on the solution level and not on the project level. Visual Studio creates a folder called '.nuget' in the root of the solution and places the packages.config file in there.
Not sure what causes this change since all I did was to change the package id.
Any help appreciated.
The StyleCop.MsBuild package has an msbuild target in the build folder and the convention is that the name should match the package id. So by changing the package id, the msbuild target file was not referenced anymore and the package became a solution level one.
https://docs.nuget.org/create/creating-and-publishing-a-package#import-msbuild-targets-and-props-files-into-project

How do I set Visual Studio to build a NuGet package?

How can I get Visual Studio to build a NuGet package for my library component on build?
I’m using a Portable Class Library as the example project.
Ensure the NuGet.exe file in .nuget folder is latest.
Default values come from AssemblyInfo.cs, so clean that up.
Add a NuGet package reference if you do not reference any, preferably something simple like JSON.NET. Often, PCL projects have no external dependencies, in which case no NuGet refs and without any NuGet refs, the required MSBuild config won't get set properly, so we need to add a 'dummy'.
Enable NuGet Package Restore.
Edit the NuGet.targets file and ensure BuildPackage is true.
<!-- Property that enables building a package from a project -->
<BuildPackage Condition=" '$(BuildPackage)' == '' ">true</BuildPackage>
Edit your .csproj file and add this to the first, default PropertyGroup
<BuildPackage>true</BuildPackage>
Rebuild your project and then search in the Output for nupkg and confirm creation and location of the package file.
Remove the dummy NuGet package reference and build again and check the Output.
To further customize the package creation, you can stick a MyProjectName.nuspec file next to your .csproj file.
See http://docs.nuget.org/docs/reference/nuspec-reference for more on the NuSpec format. You can also pull one from an existing package (its just a zip file) and have a nose around, see how it was done.
Add a post-build event like this:
$(SolutionDir)\.nuget\nuget.exe pack "$(MSBuildProjectFullPath)" -p Configuration=Release -o "$(MSBuildProjectDirectory)\bin\Release" -symbols"
And download and place nuget.exe in the .nuget folder alongside your solution file.
You can use nuget update -self to keep the .exe fresh.
Note
nuget.exe pack has a bug currently where it'll see a packages.config file and try to look for the packages it mentions in your solution but it fails to find them if the packages folder is in a strange place, e.g. if your solution file isn't a level up from the project.
To workaround this, add another post build event to copy the packages folder into the project folder.
The repositorypath config setting seems to do nothing for me.
See GitHub reports:
https://github.com/NuGet/Home/issues/5316
So funny. I was having problems with my usual way of auto-building a package on build when I arrived at this new way. So I looked for a suitable SO question to answer with my new post-build method when I came across my own question here!

Unable to copy file exception in TFS build

I am getting following error
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets (178): Unable to copy file "bin\AjaxControlToolkit.pdb" to "C:\Builds\2\testbox\test\Binaries\_PublishedWebsites\test\bin\AjaxControlToolkit.pdb". Could not find a part of the path 'bin\AjaxControlToolkit.pdb'.
Just checked file is available on path.
same working fine on local as well as while building from team city. Don't know whats going wrong.
Edited
Just cant understand why it is trying to copy from obj directory..Please see the following log
Copying file from "obj\Debug\Manager.dll" to "C:\Builds\2\box\Two\Binaries\Manager.dll".
Manager -> C:\Builds\2\box\Two\Binaries\Manager.dll
Copying file from "obj\Debug\Manager.pdb" to "C:\Builds\2\box\Two\Binaries\Manager.pdb".
Copying file from "obj\Debug\Manager.xml" to "C:\Builds\2\box\Two\Binaries\Manager.xml".
Done Building Project "C:\Builds\2\box\Two\Sources\Manager\Manager.vbproj" (default targets)
Where as I have set the output to bin.
Possible reasons:
This reference is dynamic, meaning its path gets cleared and created on each build. Third party reference files should be checked in the source control to a common shared folder (e.g. \lib).
Your project have a file reference to AjaxControlToolkit to a path
which does not exist on build the server. Open the project's .csproj
file,and check the HintPath of AjaxControlToolkit.
Avoid referencing third party assemblies from the GAC (where the first bullet is applicable).

Resources