Uploading a file with VS2010 "Publish" to custom directory - asp.net

I have a file I need to have published with my ASP.NET site to the server. I put it in the project root and set 'Copy to Output Directory' to 'Copy if newer'. When I publish, it copies the file to a 'bin' sub-directory. No good! I need it at the root of the site. Other files (such as my *.aspx files) that are right next to it in my project get copied to the root. How do I set it so this file also get copied to the root?

Change the "Copy to Output Directory" to "Do Not Copy", then Set the Build Action to "Content". Copy to output directory copies the file to the bin folder. You would use that feature to copy a license file needed for the assemblies for example. Setting the build action to Content causes the file to be sent to the server in its relative place.

Related

Can linter-flake8 ignore files by using a project-wide .flake8rc?

I'm using Atom and linter-flake8 for my project. I have a set of huge generated Python files and I want them ignored by linter-flake8. These files are placed in a folder called generated/, inside the project root folder. At the same level with the generated/ folder, I placed a .flake8rc with the following content:
[flake8]
exclude=generated/
and configured linter-flake8 to use this file (via Preferences in Atom). However, it still parses those files. What am I doing wrong?
PS: If I run flake8 --exclude=generated/ . in bash, in the project root folder, it works fine and ignores my files.

Publishing project with files with very long names

I am trying to publish a project in Visual Studio 2013 that has some files with very long names, including the path location. I moved the project to a location closer to my root C:\ drive, which allows it to compile, but when publishing, it tries to copy files to the %appdata% folder which results in a name over the limit.
Here is the error I get:
Error 10 Copying file node_modules\grunt-bower\node_modules\bower\node_modules\bower-registry-client\node_modules\bower-config\node_modules\optimist\node_modules\minimist\.travis.yml to C:\Users\jake\AppData\Local\Temp\WebSitePublish\WebProject--1320288221\obj\Debug\Package\PackageTmp\node_modules\grunt-bower\node_modules\bower\node_modules\bower-registry-client\node_modules\bower-config\node_modules\optimist\node_modules\minimist\.travis.yml failed. 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. 0 0 WebProject
Is there a way to either adjust this project's name or where it copies to temporarily so that I am able to publish from Visual Studio?
Citing #Britton from Temp path too long when publishing a web site project:
Add this to your publish profile to modify the temporary directory for
package/publish:
<AspnetCompileMergeIntermediateOutputPath>c:\shortPath\</AspnetCompileMergeIntermediateOutputPath>
Or according to Website publish failing due to file path being too long (citing #Jason Beck and #VeeKayBee):
Add the following line in default PropertyGroup of web project file:
<IntermediateOutputPath>..\Temp</IntermediateOutputPath>
In addition to Amnon Shochot's answer, above, I also had to apply Roland's answer from another thread.
My publish paths (in .pubxml) now look like this:
<publishUrl>c:\publish\proj\</publishUrl>
<IntermediateOutputPath>c:\publish\inter\</IntermediateOutputPath>
<_PackageTempDir>c:\publish\package</_PackageTempDir>
You have to be careful with this:
Important: If this option is set, be sure not to nest your temporary files inside the publishUrl directory, because it will wipe out the _PackageTempDir files, causing a failed publish, even if it appears successful.

Compress a folder with all subfolders into a .jar file

I have a directory of files with sub-folders and I want to compress it all in a jar file.
Later on , I need to use it in my project and add this jar file into my library section at eclipse.
Right click on a blank area in explorer window, go to New > Compressed (zipped) Folder. Drop whatever you want into it, and then rename the extension to *.jar.
source

Qt and DESTDIR being ignored?

My app folder is "app"
It contains both .pro and source files
It has a "bin" folder.
the "DESTDIR = bin\" in my .pro file
however, when building from Qt-Creator, a sibling folder is being created, called "app-build-desktop" and the binaries are stored there under a new "bin" folder.
why is this happening? why is another sibling folder being created and hosts a new bin folder instead of just creating the binary file in my existing "bin" folder.
In the "Projects" area (on the left pane of Qt Creator) there is a "Shadow build" option in the Build Settings. You can uncheck this to disable it.
That being said, it is a useful feature, for example for keeping your actual source directory clean of temporary files that you have to ignore in source control.

asp.net access config file in a test environment

I'm writing unit tests for an asp.net mvc project. I have a config file that I use in my tests, but for some reason, the config file has to be in in the bin folder in order to be found. Is there another way to do this as I don't feel it is best practice in having config files in the bin folder.
During compilation, your app.config file is copied automatically from the root directory to the bin folder. You shouldn't have to manually place an app.config file in the bin folder.
Assuming your project name is
MyTestProject
then after a build your bin should contain the following:
MyTestProject.dll
MyTestProject.dll.config
Plus any other referenced assemblies.
One interesting thing about this is that if, in Solution Explorer, you right click your app.config and go to properties (F4) you should see that the "Copy to Output Directory" option is set to "Do not copy". This is correct. The compiler should handle the copying and renaming. If you had the setting set to "Copy always", your bin would contain a file called app.config, which the runtime would ignore.
EDIT: If you are referencing other config files from within your app.config (or web.config for that matter) then these files will need to be deployed to the appropriate directory. An example of this might be a Spring.config file, referenced in the app.config:
<spring>
<context type="Spring.Context.Support.WebApplicationContext, Spring.Web">
<resource uri="~/Spring.config"/>
</context>
</spring>

Resources