Packaging fonts in visual studio deployment package and the zip folder structure - visual-studio-2010

I'm using MSBuild to create a deployment package as part of my build process. I am calling MSBuild with /t:package as part of the command.
This is working great except for two things.
I am using web fonts and it seems that these are not being included as part of the package (they are included in the project). How do I include these fonts?
The folder structure within the zip file is ludicrous - it includes the full path from the drive letter down. I anticipate this could cause problems with the length of path names at some point. Does anyone know how to prevent this? (I know it's a duplicate of this: Visual Studio Deployment Package - change the file structure the .zip creates?)

The reason your fonts (or any other non-standard file) are not being deployed is the "build action" is set to "none". To fix this, select the file in solution explorer and modify the build action to "content". Package your project and it will be included.
I never understood the folder structure either. By using msdeploy to publish the site it uses that folder structure to deploy multiple sites at once. It's annoying when looking at the package itself but it does "work". Also... the max file length is something like 32k characters. See: Maximum filename length in NTFS (Windows XP and Windows Vista)?

There is a way to change the internal path used within the zip:
/p:_PackageTempDir="C:\websites\myNewSite"
The switch can be used on the command line with msbuild to change the path it creates inside the zip. It is also possible to change this within VS but can't remember how off the top of my head.

Related

What to exclude from a Visual Studio release folder

I have just finished my C# Windows form program and would like to make a zip file of the binary so others can download it. I checked the bin/release folder, and while I can recognize many files which I know will be necessary, but some other files I am not sure if it is safe to exclude them.
The following files are the ones I am not so sure:
program.pdb
program.exe.manifest
program.exe.config
program.application
ExternalDLL.xml (related to
ExternalDLL.dll which I need to keep,
but is the xml important?)
P.S. I am using VS Express so I have to manually deploy my project.
The short answer is: You don't need any of those, with the possible exception of the .config file. If you didn't store any of the app's configuration in its .config file, then you don't need it either. I recommend excluding all of them and trying your app on a different machine. I expect it'll work fine.
The longer answer is: There's probably individual SO questions about each. For example, here's a manifest/application question: C# - do I need manifest files?

Why is my Visual Studio Cloud Project recursively nesting its package in my Web role build output?

I have a pretty simple Could Project (named Uploader.Cloud) with one Web Role (UploaderWebRole) and I'm trying to build them using visual studio. I've modified the project files of both of these projects to change their output path to a different place than the default spot. What I'm finding is that I'm getting a MSB3021 build error when I build Uploader.Cloud:
Unable to copy file "D:\Enlistments\FB1\Dev\Izer\Build\Release\Cloud\Uploader.Cloud.csx\roles\LogUploaderWebRole\approot\bin\Uploader.Cloud.csx\roles\LogUploaderWebRole\approot\bin\_PublishedWebsites\UploaderWebRole\bin\Microsoft.WindowsAzure.Diagnostics.dll"
to "D:\Enlistments\FB1\Dev\Izer\Logging\Uploader.Cloud\obj\Release\LogUploaderWebRole\bin\Uploader.Cloud.csx\roles\LogUploaderWebRole\approot\bin\Uploader.Cloud.csx\roles\LogUploaderWebRole\approot\bin\_PublishedWebsites\UploaderWebRole\bin\Microsoft.WindowsAzure.Diagnostics.dll".
The specified path, file name, or both are too long.
The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
Upon further inspection, I find it odd that the bin folder of my web role (LogUploaderWebRole\approot\bin) has a cloud package in it (Uploader.Cloud.csx). I don't think that should be the case and am curious if this is a bug in my configuration or if there's a bug in how Visual Studio's Azure tools are building my project.
Any help would be appreciated!
I found the issue. I modified the OutputPaths of the Uploader.Cloud and LogUploaderWebRole projects to build to a different spot. On top of that, Uploader.Cloud was using a web role named LogUploaderWebRole, but the project was named UploaderWebRole. Replacing all instances of LogUploaderWebRole with UploaderWebRole in both projects fixed the issue. For some reason, having the different names caused the build process to nest Uploader.Cloud.csx in multiple levels of the build directory hierarchy.

Where to put content, in Installer project (WiX) or in code project

So I see two solutions to my current problem, but I was wondering what the pros and cons are, or if there is a defacto best practices approach.
So my current project has a number of configuration files, help files, and other external content. I need this content local to run and debug the application. Currently we duplicate this content in a standard windows installer project. This clearly is a bad idea. We are moving to a new setup that uses the WiX installer, and I'm currently setting the project up next to the code project and trying to figure the best way to share resources. I see two solutions.
One is that I can put all the resources in the WiX project and then add them as links in the code project. This way I know what I'm debugging is installer.
The other option would be to leave the content in the code project and path into it in the installer using the reference variables.
Right now it seems 6 one way, half dozen the other. Any persuasive arguments for either method?
Assuming that these configuration and help files are going to be installed in the same directory as the executables then definitely put them in the code project, mark them as Content, and add a reference to the code project to the installer project. If you're using WiX 3.5 the files will be automatically included in the installer along with the executables, which makes writing simple installers much easier.
For earlier versions of WiX or more complex deployment scenarios (where the content files could be going into different directories) you would still put them in the code project but then you'd use File elements with a relative path or reference variable in the Source attribute to include the the content files from the code project directory.
I don't believe that putting the content files in the WiX installer project directory instead of the code project directory will do anything to ensure that the version you use to debug will be the same as the version installed. That can only be ensured by thinking through the process of how your application finds these content files and making sure the right versions are found.
So going back to the simple case where the content is in the code project and marked as Content, and it will be installed and loaded from the same directory as the executables, then it is only a matter of setting "Copy to Output Directory" to "Copy always" or "Copy if newer" and then you can be sure the versions used in debugging and the version installed will match.

Utility that extracts necessary files from a VS2010 solution folder?

I'm looking for a utility that copies all files from a VS2010 solution folder, which are necessary to build the solution, but ignores all other files (.obj files etc). My intended use is for emailing solutions or making them available on a blog etc.
I'd prefer a utility that's portable (runs without having to be installed), but if there is none, I'll settle for whatever's available.
You may want to consider something as simple as a script (via .bat or powershell) that simply runs the solution's build with a /clean and then zips up the entire folder structure into an archive.
No need to be fancy, especially when project can need any number of impossible-to-know files to build. (What happens when a new language is released like F#? If you'd written your tool 3 years ago, you'd have to modify it for that. What happens if someone needs a .txt file or a .mak file to build?)
In the past I've created a new configuration within VS.NET (e.g. Deploy) which builds the code in release mode. I also set the output path for the main application project to build into a separate folder in the root of the project.
If it's a web application, this is a little more problematic as it won't copy the support files. To get over this I use a nant script to copy all of the appropriate files, that are needed but aren't included in the build, into the aforementioned build folder.

Build problems with Visual C++ project after checking in and checking out from CVS

I am building a cross platform product and one of the requirements is across windows(win32,AMD64 and IA61). The product as is relatively simple CLI but we have a separate build team who checks out the code from CVS and build in separate build environments. I am able to build succesfully(using Visual C++ 2005) in one platform(AMD machine). But once I check in the code, check out the build fails.
The cause of the build failure is because the include library paths are wrongly specified in the property sheets. Specifically the output file folder under the Linker in property pages are specified wrongly. So these libraries get built in a different folder from where the other projects are expecting them.
However along with the source I check in the .sln files (and later .vcproj files) also everytime. Morover if I open the .sln file in the folder where the build is not succeeding, there is no difference between the one where I could succesfully build(pre check in). In fact using windiff I could not see any difference between the two build folders (except some .ncb and cvs log files).
So any idea what is going on? Where does VC++ 2005 take the include directories take the output folder path from if not from .sln? Is CVS somehow interfering with the process? Anything else I could try out.
Thanks in advance.
Just to update the problem was resolved. The root cause is the .vcproj files were not getting checked in CVS!! This is where the individual project settings were stored(I was under the impression that this is done in .sln files).
I think the problem can be that after you have changed the settings in one build configuration (for example x86-Release) but forgotten to change them for another configuration (for example ia64-Debug), and when configuration changes, you have this problem.
Another thing that I would check on your place is project dependencies. If those are set in the right way VS will look for project output exactly where it is outputted, even when you change the output folder.
Do you have any binary files checked in as ASCII?
The round trip to and from CVS can corrupt binary files that are incorrectly marked as ASCII because CVS performs character processing on ASCII files (e.g. to give you the correct end of line codes for your OS). Corruption can occur even in an all Windows environment.
See the Binary section in the CVS FAQ for more information.

Resources