Is it possible to change the references build folder? I want my dlls when i compile to be in a /bin/Debug/Data and not in /bin/Debug.
Thank you
Update 1: Is it possible when i build the references dlls are posted in another folder?
You can use Post-build Event in project properties.
Using this event you can copy dll file any other place or directory after build
but dll project must be added in this project.
Go to Projct properties. Tab "Build". Change Output path
If I am not wrong I believe you can using Element . You can do this in app.config file The following example shows how to specify application base subdirectories the runtime should search for assemblies.
Personally I have not tested this. I found this in here: https://msdn.microsoft.com/en-us/library/823z9h8w.aspx
This article demonstrating Setting a Custom Reference Path
Add the following line before the main Form is initialized
AppDomain.CurrentDomain.AppendPrivatePath(#"bin\Data");
Related
I have multiple projects in a solution and I'd like them all to share one pool of graphics resources. I've tried this:
1 - Created project1, made its resource file public, added some graphics to it.
2 - Created project2, Alt+dragged Resources.resx from project1\Properties to project2 (not in the Properties folder)
3 - Add reference in project2 to project1
So, now all the images from project1 are available in project2. So far, so good. I can use them at design time just fine.
But, when I want to access them at runtime, I try this (in project2)...
Image img = project1.Properties.Resources.image14;
And that crashes with a MissingManifestResourceException.
What am I doing wrong here? Is there a better way I could approach this? All I'm trying to do is maintain all my graphics in one place, so if I add a resource, it becomes available to all projects in the solution.
Just built an example following these steps:
Create a class library do hold the resources (Project 1)
Create the consumer project (Project 2)
Add a resource file (GlobalResources.resx) in the Project 1 and add a resource item Information
Change the BuildAction of the resource file to Embedded Resource
Change the Do not copy of the resource file to False
Check if the Custom Tool of the resource file is set to PublicResXFileCodeGenerator
Add a reference to the class library (Project 1) to the consumer project (Project2).
Add the resource namespace reference wherever you want to use it.
Finally it is working: GlobalResources.Information
It should be simple.
Edit:
You are concerned about using an external resource file inside the design time property editor. Sorry to inform that there is no standard support for this :(
However, if you think that the benefits are greater than the effort:
Issue with shared WinForms resources across projects in Visual Studio
How do I get the Windows Forms Designer to use resources from external assembly?
Hope it helps.
Choose the referenced file in your solution explorer, then properties, then see what the "copy to output" property looks like. I suspect it's not set to "Copy Always" or "Copy if Newer" of which either should be fine.
Once it's being copied, let's also check to see where it's being copied. Is the output path for that particular item the same as where the program ultimately expects? Is it being copied to the bin\Debug of the correct project?
Make sure it's being copied to the path where the MissingManifestResourceException says it's failed to find the resource.
Finally, given additional information in our comments, I would also suggest you verify the following:
culture the resources are targeting. Check spelling and capitalization.
any culture settings of your build xml or publish xml.
culture setting(s?) of your host system that's running this code.
I'm new about code developing with Visual Studio 2010 and I would like to ask you a simple question about something after build a project.
I have a C# project and when I build It in Release mode some file are created and some of them copied from another in to \output\bin\Release\ folder. My question is that How can I manage that which created dll or created file will be in \output\bin\Release\ folder.
I tried to take a look at build properties of project but I could not find any option about it.
Thank you.
Actually I do not need this dll in my project output folder because I
add this dlls as a reference to my project
And this is exactly why this file appear in output folder.
There are several ways to "put" file in output folder. For normal files in the project you can set property Copy to Output Directory.
If we talking about dll's, (as mentioned Hans), there is Copy Local property for each assembly in References.
By default VS set this according to our GAC, so if you are using 3rd part assembly or from another project VS will set this property to True and file will be copied to output folder.
If you don't want to put this file in output folder, just set this property to False. But remember, at run time this assembly should exist.
For more information: How to: Set the Copy Local Property of a Reference
Another explanation: you just messed up with Output path in the project properties and two project has the same output folder. :)
I suggest that you ignore the extra files that are created. One way to do this is to configure the destination of these to a different location.
I use this:
property pages->General
- Output Directory = $(SolutionDir)..\link\
- Intermediate Directory = c:\temp\vc10\$(SolutionName)\$(Configuration)\
Use the same settings for debug and release.
I have a c# .net app.
I'm using a WebKitBrowser.
The problem is that the app does not work if i don't put all the webkit DLLs into the debug/release folder.
What i'm trying to do, is to put all these files into a folder like debug/WebkitFiles and all the files to be token from there.
Any help? thanks
This should help:
<probing> and <privatePath>
Read up on the <assemblyBinding> tag in MSDN as well:
Note the changes go into your app.config file.
You can xcopy the files in your post-build event, under the project properties
Additionally, how did you first referenced the WebKitBrowser DLLs?
If you expect .NET do bind to an assembly but it is failing, do the following:
1. Open the Visual Studio Command Prompt
2. Type 'fuslogvw'
-- every load of an .NET assembly will be registered in the console
Put your DLLs where you want then add a reference to them and set "copy local" to true. If you want to keep dependencies in a sub-folder you have to modify your assembly manifest file.
I have a solution which contains a website and various class libraries. The exists on the file system like so:
C:\Projects \MyWebsite\dev\MyWebsite.sln
C:\Projects\Core\MyClassLibrary1.csproj
C:\Projects\Core\MyClassLibrary2.csproj
I want to move the App.config file from MyClassLibrary1 project to the bin of the MyClassLibrary2. I want to do this on post build in VS or MSBuild using relative paths if possible. This way anybody checking out the projects will not have to modify any paths if they choose to locate the project in a different location.
I have already tried the following approaches but to no avail.
copy /Y "$(ProjectDir)App.config"
$(ProjectDir)\..\ MyClassLibrary2\$(OutDir)\ MyClassLibrary2.dll.config"
Any ideas?
Thanks
Consider adding the App.config file in your second class library using Visual Studio Add As Link.
Add -> Existing Item -> Add As Link
The Add As Link command is shown if you click the dropdown next to regular Add button in Visual Studio. This way you can reuse the file in multiple projects.
Try some other common MSBuild properties, although João has a better suggestion I think.
Where can I find the application.exe.config file in my C# project?
I'm attempting to enable the JIT debugger but cannot find the config file.
thanks!
It's usually in the root of your project. If its not there you might not have one. You can add it by right clicking on your project and add new item.
It's called App.Config at this point. Once you compile it is then renamed to AppName.exe.Config, and placed with your build output.
I had to learn that each project in the solution can have a settings file. But the one in the startup project is the one that becomes application.exe.config in your output folder.
It should be in \bin\Debug or \bin\Release, right next to your compiled assembly.
It will be app.config . App.exe.config will be created in case of windows app,test project or asp project or any other projec which shows output