For a school project we developed 2 different projects (2 solutions). Now we need to merge them together to form 1 Windows 8 Store App.
I added Project2 to the solution of Project1. But I ran into some issues.
Each project has an .appxmanifest-file. If I keep both files, VS 2013 will complain because the logos are set in both projects. The error message is:
Payload contains two or more files with the same destination path
'Assets\Logo.scale-100.png'...
I tried deleting 1 .appxmanifest-file but then VS complains about missing the file.
Deleting the logos out of 1 manifest also gives error messages.
How can I merge these 2 projects without these issues?
Basically you can't.
This type of project is designed to work as standalone application so you can use them both in one solution.
What you should is to decide which one you want to leave as main project, then add "class library project" to this solution and import all needed files from the other solution
Related
I have a solution with 8 related projects (which are all C# Windows Desktop Applications--- a utilities suite). All 8 projects use a pair of class files which are in each project as linked files.
I can set breakpoints in the linked code, and step thru it, but I cannot edit. When I try, I get the error "Changes are not allowed if the project wasn't built when debugging started." I've made sure to perform a clean and build before running, but that doesn't help.
Is it not possible to edit linked class files?
In my application I have 3 WinRT projects which I want to deploy. I want to deploy 1 of them; M.Survey.Windows which is dependent on the other 2.
I can build the projects OK, but when I try to build and deploy I run into difficulties.
I click on store -> Create App Packages, select No to upload to the Windows Store, click next and then Create. This does a build which fails, see below. How do I fix this?
The error messages say;
Error 1 The text associated with this error code could not be found.
Cannot find a Resource with the Name/Key BlackSmallHeaderStyle ...\M.Survey.Windows\UserControls\DimUserControl.xaml 137 25
Error 2 Unable to remove directory "obj\x86\Release\PackageLayout\". The process cannot access the file 'Microsoft.Xaml.Interactions.dll' because it is being used by another process.
Killing XDesProc.exe also worked for me.
XDesProc.exe is the Visual Studio XAML Designer tool.
I have 1 large solution (about 100 c# projects and 20 c++ projects) in VS2010 + Resharper.
Well known steps for c# project renaming :
Rename project via project explorer.
Open project properties (right click) -> rename "Assembly name" and "Default namespace"
Open Assembly Info file -> rename neseccary properties in this file
Remove renamed projects from solution
Rename projects directiories on file system
Load renamed projects
After performing these steps for some C# projects (for example I renamed 10 projects), Visual Studio 2010 hangs. Work with the solution becomes fully impossible. It occurs on any machine when I try to open this solution.
The goal is to rename all projects. For example, every project's name pattern is : XXX.YYY.ZZZ and I want to rename them all according to a new pattern : YYY.ZZZ.
With more than 100 projects in two different languages it is very normal for VS2010 to freeze.I have about only 45 projects , Changing a class name freezes VS for a noticeable amount of time.
Then even though tedious i switched to Find and Replace,Basic but doesn't freeze VS..There is no other go. You have to deal with it.
Btw VS also needs a Huge database for maintaining c++ references and parsing information.
I'm currently working on a solution with two different project. One project is a windows form (main project) and the other one is a console application. Currently I am running the console application from the main project with:
System.Diagnostics.Process.Start(Environment.CurrentDirectory + "\\console.exe");
When I debug, everything works fine as a wish. However, C sharp creates two different executables, one with the console and another with the main project. My question: is there a simple way to merge those two to only one executable? Note: I am a beginner, and I tried really hard to get this working :(
Thank you!
To merge multiple assemblys into one you can use Fody/Costura. It allows you to merge multiple assemblys(exe's) into 1 project(exe). In your main project you add it (can be done via nuget). Then just in weavers.xml (file that will be automaticly generated add these text:
<Costura>
<IncludeAssemblies>
MyProject.MyConsoleApp
</IncludeAssemblies>
</Costura>
(it should be the same name as the reference, so add the console app to your windows form as reference,and remember don't add the .exe suffix)
PS: read the tutorial on the link I gave you.
I've read about this technique: Shared assembly info in VS projects - JJameson's blog
Basically it means to create a SharedAssemblyInfo.cs with versioning information about the assembly, and adding this file as Link to all projects of the solution, so the actual file resides only in 1 location on disk.
My question deals with 2 scenarios:
Existing solution that doesn't use this mechanism: Is there a way to easily add the ShareAssemblyInfo to all projects? (lets say i have a solution with 50 projects).
When creating a new project, by default a new AssemblyInfo.cs is created. However i'd like to link automatically to the SharedAssemblyInfo as well.
Is there any solution for this? what is the common practice?
It is possible to link to a shared assembly info file in VS 2010. Ashish Jain has a good blog post about it: Sharing assembly version across projects in a solution.
After creating the shared assembly info file at the solution level, his instructions for linking to it from a project are:
Right click on the project, in which you wish to add the Shared
assembly file, and select Add -> Existing Item...
Select the file “SharedAssemblyInfo.cs” from the solution folder.
Instead of Add, click on the the arrow next to Add and click “Add as
Link”
Drag down the added linked file alongside AssemblyInfo.cs in the
same folder.
Repeat steps 1 – 4 for all projects for which you wish to add shared
assembly file.
I've tried this and it works.
First point could be solved with simple text editor that could handle several files at once and find/replace. Just open all of your csproj in it and replace string <Compile Include="Properties\AssemblyInfo.cs" /> with
<Compile Include="..\SharedAssemblyInfo.cs">
<Link>Properties\SharedAssemblyInfo.cs</Link>
</Compile>
Alternatively you could write a utility like that:
var files = Directory.GetFiles(yourSolutionDir, "*.csproj", SearchOption.AllDirectories);
foreach (var f in files) {
string contents = File.ReadAllText(f);
string result = contents.Replace("<Compile Include=\"Properties\\AssemblyInfo.cs\" />", putSecondStringHere_ItIsJustTooLong); // :)
File.WriteAllText(f, contents);
}
As for the second question... You could take a look at Visual Studio custom project templates , but I'm not sure it worth the efforts. You should IMO write test that will check this instead. It will be much simpler and outcome is actually almost the same.
UPD: About writing tests for checking solution/project files against some custom rules. Basically, sln/csproj format is simple enough to be parseable without much efforts. So if you want to have SharedAssemblyInfo.cs linked into every project - just parse csproj's and check that. Then put that checker in your build server and run it on each build. We have such system working currently and it costs something about two days to write but saved us many more (we have there more sophisticated rules and multi-solution project, so it was worth the efforts).
I won't write about this checking in detail here right now (it is not that short), but I'm going to write blog post about it soon - most probably till the end of this week. So, if you're interested - just check my blog soon :)
UPD: Here it is.
I have created an application to increment the file version automatically.
Download Applicaiton
add the following line to pre-build event command line
C:\temp\IncrementFileVersion.exe $(SolutionDir)\Properties\AssemblyInfo.cs
Build the project
To keep it simple the app only throws messages if there is an error, to confirm it worked fine you will need to check the file version in 'Assembly Information'
Note : You will have to reload the solution in Visual studio for 'Assembly Information' button to populate the fields, however your output file will have the updated version.
For suggestions and requests please email me at telson_alva#yahoo.com
This does not work for solution that has both C# and F# projects. c# project cannot reference shared f# file and vice versa.
The only option in this case is to make a separate project and refer to it from other projects