Stop Duplicating Images for every Project in a Solution [closed] - c#

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
We have a standard company library for our WPF/C# applications. It has a large set of images. The library is a separate project in a large solution that has several projects.
When you use an image in these other projects is there a way so they are not duplicated in the projects they are used? I want them to always go back and reference the image in the library. I have tried doing the path several ways but cannot seem to get it to work.

Yes. You can add the images as a link.
In the target project
Click Add | Existing item... from the context menu of the root of the project, or a folder in the project.
Navigate to the images in your library (select any number of them).
Click on the arrow button next to Add and select Add As Link:
This will produce a chunk of XML in your target .csproj file. You can then change how you want to use the images as usual (e.g. as content, embedded, etc.) Here's an example
<ItemGroup>
<Content Include="..\ClassLibrary1\someicon.ico">
<Link>someicon.ico</Link>
</Content>
<Resource Include="..\ClassLibrary1\someimage.png">
<Link>someimage.png</Link>
</Resource>
</ItemGroup>

Related

Missing .csproj file [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
In Visual Studio 2019 all files like .aspx, .aspx.cs, .js, images are showing. I am missing .csproj and .sln files. to open and try to complie. What might have happened? any sort of idea appreciated.
Create a new project and copy the files from the old project to the new project.
Cheers
Pick one:
You deleted them by accident.
Some other software (or add-on) you were messing with deleted them.
Whatever you actually did is something that normally will not lead to the creation of .csproj/.sln files, such as opening the .aspx, .aspx.cs, .js, images, etc. manually in VS without opening or creating an actual project or solution.
The .csproj/.sln files are not missing. Whatever you experienced led you to the false belief the .csproj and .sln files would be missing. But in reality, whatever you saw and witnessed is an expression of another problem, not of the .csproj/.sln files missing.

VB.NET set the assembly-version in one file for all projects in solution (VS2013)? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I want to store the assembly-version in one file for all projects in my solution.
This way it's easier to maintain the configuration.
In C# i can add links to the AssemblyInfo.cs in the project and Drag & Drop the file-link to the Properties.
This way the version is displayed correctly in Properties => Application => Assembly Information.
In VB.Net this is not possible. I can't Drop files into My Project. But this is the place where the AssemblyInfo.vb has to be placed. If it is stored in an other position, Visual Studio doesn't show it in My Project => Application => Assembly Information.
Create the link(file) in the project itself by right click Add existing item... and cut & paste the new link into the MyProject-Folder.

Reading assembly attribute from other file [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I have a project in which
[assembly: AssemblyProduct("Meteor Viewer")]
[assembly: AssemblyVersion("2.1.0.0")]
[assembly: AssemblyFileVersion("2.1.0.0")]
exist not in assembly.info, but in xyz.cs file. how can I get assembly attribute from xyz.cs at any other page of product?
The attributes you mentioned are valid at any code file as long as it is part of your project and is compiled. If you have multiple projects in a solution that should share e.g. the version information for all assemblies you can even use one file and link it in all projects instead of copying the infos.
Right click on the project --> Add Existing Item --> Select your File --> Add as Link
When you included the file in your project(s) you can see this answer for how to get the values out of it:
https://stackoverflow.com/a/909583/254797

What is the difference between File and Project [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
In New File I can choose empty class but it does not close the project I am working on. As in the title, what is the difference between a file and a project?
One ore more files create a project and one ore more projects create a solution.
You are probably adding a new file to you're existing project.
Projects are "buildable" things (they have output) and are composed of files. Thus, adding a new file has no reason to "close" the project (whatever that means).
When you get far enough, Solutions are "groups" of projects. Adding a new project to a solution doesn't close anything either.
In any IDE, project is a logical collection of different types of files, such as programs, resources, configuration files etc. There are so many different formats for storing the project information on disk such as .xproj, .csproj etc.
A "solution" is a logical collection of projects. A solution can have just one project in that as well. Solution is stored on disk typically by .sln extension by visual studio. In a solution, programmer can specify the build order of the projects, build configurations etc.

How to add reference in Visual Studio [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I need to use all the classes in one project in another. I tried adding the references, clicked on the project tab but I can't see the .cs or .sln files or any other files, just the exe in the debug folder and the .vshost file and the manifest file.
What file do I need to reference in the project?
File > Open > Project/Solution > Add to Solution (A little checkbox in the file dialog) then click the .sln you want
Right mouse click on the project that needs a reference to another project --> Add Reference --> Click the checkbox(es) next to each project you wish to refer.
Once you have added your reference you will need to include the namespace "using NamespaceOfSecondProject" in the class that will use the referred project.
You need to elaborate you question - Well why would you want to have redundant classes in two projects better build a class library and reference the dll in both the projects. If at all you need to include the classes from one project to another you simply need to copy the .cs file to other project and then select project and select add existing item then select the .cs file which you wanted to add. Hope this will help.

Categories