hide additional files when creating setup projects - installation

I'm using VS19 setup project and I would like to hide an additional file that is needed for runtime but I don't like users to see it.
the file is added to the project as an embedded resource
is there any way to hide the file?

Related

Is it possible to use custom icon for Xcode file template?

In our project we generate multiple swift files when using the file xctemplate configuration. However, with this configuration, there is no icon displayed in Xcode when generating the files (see attached image). We did try to add two images to the template folder: TemplateIcon-png and TemplateIcon#96.png which yielded no success. Is it possible to use a custom icon for file templates in Xcode?
Not sure if you're still looking for an answer to this, but you should be able to create an .icns icon package named TemplateIcon.icns. This should contain your template image(s) to be displayed in the new project picker.
I suspect your issue was trying to use the PNG assets directly.
See the Base Acceptance Testing Bundle for an example. It is part of the OCSlimProjectXcodeTemplates repository.

Events are disabled in codenameone

I have problem when I want to access events. I already copied the resource files (nativej2me.res) under src directory but still the events are disabled within my project.
Can anyone help me how to arrange the resources so it enables the vents..?
Thanks
Don't move that resource file. Its not the place for it.
I'm guessing you created a handcoded application where GUI builder events aren't supported. You need to create a GUI builder project when creating a new project.
That's a GUI builder project (notice the visual not manual in the brackets)
Just for the googlers out there:
Have a look in the file codenameone_settings.properties - in there you'll find the property userClassAbs=something/StateMachine.java
Its an absolute path and it was showing the wrong directory. After fixing this I was able to add Events in the Designer again.

ASP.NET MVC3 project does not always publish all views/content

This is crazy, but I can't seem to get all my views/content/scripts published when I publish the site. This seems to happen, I believe, when the view or content is not directly referenced by my project, but used by another assembly in my project. So I might have:
ExternalAssembly.dll referenced (it gets published)
I'll need ExternalLogin.cshtml in my main project, under my views folder
ExternalLogin.cshtml doesn't get published
Right now I have a script that copies everything in the Views folder and dumps it to where I want it deployed, but VS should do this for me. What am I doing wrong?
When you click on one if these files what is the build action for it on the properties? Content....or? Set to content.
So your views files are in another project or folder outside your current project? Normally the files have to exist in the web site project, in it's views folder, not externally, and the build action should be set to Content and not to copy to the output folder. But there are some workarounds:
Duplicate them in to your site views folder and make sure they are marked content (as stated in another answer). One thing to note though is that you can add them as "Linked Files" in visual studio which actually allows them to exist in two places in the hierarchy without having to exist in two places on disk: http://support.microsoft.com/kb/306234
If you have control over the external library, you can compile them in as embedded resources or use Razor Generator or something similar and use a custom view engine to return them: How can I make ASP.NET MVC 3 use views (aspx, ascx) files from an external assembly in my website?
Manually put the copies in the .csproj build XML using the Copy task: http://msdn.microsoft.com/en-us/library/3e54c37h.aspx (Note that this will make it work in visual studio doing essentially what you are doing now, as it will then be part of the Visual Studio build if you add it to the AfterBuild target or something)

Best way to deploy and reference an XSLT file

In a visual studio project I have three layers, Data Layer, Business Layer and Presentation Layer.
In the Data Layer I have a few XSLT's that transform some objects into an email, all works fine but I have discovered that the XSLTs do not get built/copied when building.
I have currently, created a folder in the deploy location and placed the XSLT's there but I am concerned about relying on a manual process to update these.
Has anyone encountered a similar issue and if so how did they get around it.
It smacks of changing the MSBuild script to copy the build artifacts to the required location, does anyone have examples of this?
Thaks
If you are using Visual Studio 2005/2008, the easiest way to do this is by including your XSLT files as project resources.
Open the Properties for your project.
Select the Resources tab. You will probably see a link that says "This project does not contain a default resources file. Click here to create one." Go ahead and click on that.
Click the Add Resource drop-down near the top and select Add Existing File.
Browse to your XSLT files and select them.
After you have done this, you can easily access the resources in the following manner:
// To get the contents of the resource as a string:
string xslt = global::MyNamespace.Properties.Resources.MyXsltFile;
// To get a Stream containing the resource:
Stream xsltStream = global::MyNamespace.Properties.Resources.ResourceManager.GetStream("MyXsltFile");
If you are using Visual Studio 2003, your best bet is to include those XSLT files as embedded resources for the DLL. In Visual Studio, select the file(s) in Solution Explorer, open the Properties pane, and change the Build Type to "Embedded Resource". You can then use the GetManifestResourceStream method to get a Stream containing the XSLT(s). The name to pass will be based on the default namespace of your assembly, the folder containing the file, and the name of the file.
For example, say your data layer assembly has a default namespace of My.DataLayer. Within your data layer project you have a folder named Templates which contains a file called Transform.xslt. The code to get your XSLT would look like this:
// There are numerous ways to get a reference to the Assembly ... this way works
// when called from a class that is in your data layer. Have a look also at the
// static methods available on the Assembly class.
System.Reflection.Assembly assembly = (GetType()).Assembly;
System.IO.Stream xsltStream = assembly.GetManifestResourceStream("My.DataLayer.Templates.Transform.xslt");
For more information check out this article on CodeProject.
Obvious question maybe, but still has to be asked, did you include the folder containing the XSLT's in the project itself? Is this a web or forms app?
In VS, it is easy to set the properties of the XSLT files in the project to copy on build, by default they do not.
I may have explained myself poorly.
THe Data layer is a class library that a the presentation layer references.
On building the DataLayer I can get the XSLTs to output to the Bin directory of the DataLayer. However when I build and publish the presentation layer, it correctly grabs the DLL but not the XSLTs

Visual Studio: How to store an image resource as an Embedded Resource?

By default when you add an image (icon, bitmap, etc.) as a resource to your project, the image's Build Action is set to None. This is done because the image is magically stored inside a .resources file.
I want the resource to be stored as an embedded resource (my reasons are irrelevant, but let's just pretend it's so that I can see them inside RedGate's Reflector).
So I changed each image's Build Action to Embedded Resource, and the resource then appears inside Lutz's Reflector - exactly as I want.
Unfortunately, Microsoft says specifically not to do this:
Note that when the resource editor
adds an image, it sets Build Action to
None, because the .resx file
references the image file. At build
time, the image is pulled into the
.resources file created out of the
.resx file. The image can then easily
be accessed via the strongly-typed
class auto-generated for the .resx
file.
Therefore, you should not change
this setting to Embedded Resource,
because doing so would include the
image twice in the assembly.
So what is the proper way to include an image as an embedded resource?
Note: This answer is not the recommended way of handling image resources. It just addresses the particular problem as described by the question (i.e. to include an image as an embedded resourse).
Don't add the image as a resource. I would rather do the following:
Create the image/icon and save it to a file
Choose Project -> Add Existing Item and add the file
Set the Build Action to Embedded Resource
You can then access this resource using
Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceUri)
This way the image is not magically added to the projects resource file and you will only have one copy of the image stored in the assembly's resources.
In the project view, open the Properties subtree; double-click the Resources.resx item.
(If you don't have one, right-click the Properties item and choose Open, then click on the Resources tab on the left, and click the link in the middle of the page to create a default resources file.)
click the first droplist at the top of the resources.resx page. It probably says something unhelpful like "Strings", and select Images. Alternately you can press Ctrl + 2. This changes to the Image resources view. Now click the Add Resource droplist and choose 'existing file'. Select your image file and click Open. Rename the resource if you like.
Click the Save icon.
You can now access your embedded resource programmatically as:
[namespace].Properties.Resources.[yourResourceName]
In VS 2005:
Right click on your project and
choose add new item.
Add a resource file. Call is
myImages.resx
Place this file in the root folder of the project.
Right click on myImages.resx
and choose View Designer
Select Add Resource, Add Existing
file.
Browse for the image e.g. stop.bmp
This image does not have to be included in the project at this stage. The resource file will automatically do this.
To reference the image in code use something like:
btnStop.Image = myImages.Stop;
This depends on how you want to use the image.
If you want to localize and access specific images for a specific culture, then using the ResourceManager is a good way to go because it provides some nice functionality for satellite assemblies, searching, fallbacks, etc.
If you just want to embed a resource in an assembly and aren't worried about localization (using Assembly.GetManifestResourceStream) then just adding a image and setting the build action to Embedded Resource is fine.
The documentation warns you about not setting the build action to Embedded Resource because the resource is already compiled into the assembly by the resource compiler via the .resx file.

Resources