Visual studio linked files with TFS - automated build does not work - c#

I have two Visual Studio solutions, one for WebApi and one for WP7 development, I am linking some dto files from WP7 solution to WebApi solution, this works great.
I just added the solutions to Team Foundation Service preview, and tried to get it to build. Since the linked files doesnt get added to source control, I cant build the project, because it cant find the linked files.
I tried adding the WP7 solution to the same directory in TFS, but no luck.
Edit- More information:
I get: CSC: Source file '....\TennisTracker.Client.Ui\TennisTracker.Client.Core\Models\GameDto.cs' could not be found
Then I add the client solution under "Edit build definition - Process - 1. Required - Items to build. I get this: C:\a\src\TennisTracker.Client\TennisTracker.Client.Ui\TennisTracker.Client.Ui.csproj (140): The imported project "C:\Program Files (x86)\MSBuild\Microsoft\Silverlight for Phone\v4.0\Microsoft.Silverlight.WindowsPhone71.Overrides.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
In the error console, in visual studio, it gives me this error: Error: API restriction: The assembly 'file:///C:\Users\markka\AppData\Local\Temp\VSTFSBuild\ae65cc1a-850e-4112-8c34-96674d8c79f3\2052550994\nunit.core.interfaces.dll' has already loaded from a different location. It cannot be loaded from a new location within the same appdomain.
The workspace is set to the entire directory, containing both solutions

Under the build definition you can define the workspaces which you can point / setup paths to the other project.
Best thing to do is post up the build error output and I can then hopefully let you know the exact path you need to setup

Related

Visual Studio Online Include Custom Assemblies

Here's the scenario:
In Visual Studio Online
Single Project Collection - DefaultCollection
5 Different Solutions
1 Solution has a dependency on the other 4
Trying to use build process template TfvcContinuousDeploymentTemplate.12.xaml in order to perform an automatic deployment from VSO to Azure Web Application
Needing the first 4 solutions to build so that the 5th solution will build, however, it cannot find the dependencies no matter what I try.
Here's what I've attempted thus far...
First Attempt
Added the 4 additional source control paths to the "Source Settings"
Added the 4 additional solutions (in order) to the Process -> Build - Projects
This is the ONLY way the solution will build, HOWEVER, Continuous Deployment is skipped due to multiple solutions being built.
Second Attempt
Compiled the first 4 and copied them to the Drop folder
Set the additional source control path to the Drop folder
5th Solution build fails because it cannot find references
Third Attempt
Compiled the first 4 and copied them to the Drop folder
Set the include folder on the build controller to the Drop folder
5th Solution build fails because it cannot find references
Fourth Attempt
Compiled the first 4 and copied them to the Drop folder
Downloaded the contents of the Drop folder and checked the contents into a subdirectory of the BuildProcessTemplates folder in the 5th project.
Set the include folder on the build controller to the checked-in folder
5th Solution build fails because it cannot find references
Any thoughts? I'm at a loss.
Any solution that you take a dependant on should publish it's output as a Nuget package to a local repository. Your other solutions can then take a dependency on that package.
You can then control the version of the dependency.

Referencing dll files - my AutoCAD plugin only works on my computer

I have created an AutoCAD plugin, but encounter problems when using the plugin on certain machines. It works fine on my machine.
One thing that I have noticed is that if I change the output path of the build to a different directory I get problems stating that certain namespaces cannot be found.
The following shows the build output folder with the dll files in, the build is successful.
http://imgur.com/5va3ePj
However, if i build to an empty folder (even with dll files referenced) i get the following errors and warnings...
http://imgur.com/eM86l0u
This plugin needs to be able to be used by other users, i think im not referencing dll files properly or something as the program only runs successfully on my computer (and all computers that i have opened the solution in visual studio and built to the export folder). Copying all the files shown in the folder above to the same path on another users computer doesn't work, other users get an error stating 'Could not load fil or assembly "c:/info3d/info3dreloaded.dll" or one of its dependencies. Operation not supported. Exception from HRESULT: 0x80131515)'
Thanks in advance for any help!
Chris
For AutoCAD DLLs set the Copy Local to false. AutoCAD provides those via its runtime.
"Once a AutoCAD .NET API DLL is referenced, you must set the Copy Local property of the referenced DLL to False." from http://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2015/ENU/AutoCAD-NET/files/GUID-8657D153-0120-4881-A3C8-E00ED139E0D3-htm.html
Right click on the reference and click on properties and set the "copy local" property to true

C# can't find properties file, how do I repair this?

I had a Properties file called RecentFileList within my Visual Studio 2012 project and I removed it. I believe it was a .settings file. Now when I run my setup project, it is trying to copy files that it shouldn't care about and it's bombing out as a result. I get 3 errors (-1007 -6271 and -6103), all related to the same missing file.
-6103: Could not find file "C:\Users\Charles\Documents\Visual Studio 2012\Projects\RallyCourses\RallyCourseDesigner\bin\Debug\Properties\RecentFileList.Designer.cs
What file do I need to edit to get rid of the reference to this file? I tried searching for RecentFileList.Designer.cs, but can't find it.
The offending files in my situation were trying to be installed by the installer, but I had removed them from the main project. Within the SetUp project, there is a section Specify Application Data -> Files. I found the files in the Properties section there, removed them, and things are working now...

How Do You Clear an ASP.NET app for compiling?

I have been building and rebuilding an ASP.NET program.
I made the horrible mistake, I think, of recently copying the published content back to the folder I was developing.
So now I have an unusual error when I build the code. It says That there is a duplicate definition in one file in a temporary directory with anohter file in a temporary directory.
Error 3
The type 'ChildEventHandler' exists in both
'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET
Files...\b90cc7a4\28d266b\assembly\dl3\c4cf1ea3\b6e4b808_ef7cce01\App_Code.DLL'
and 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET
Files...\b90cc7a4\28d266b\App_Code.asx5jp5d.dll' C:\inetpub\wwwroot...\Resources\usercontrols....ascx.cs 11 18 C:......\
I removed project and file names, of course, but this is basically what the error says.
Since the error is with temporary files, what should I do?
I do not see a "clear" option in visual studio to clear out the files of a compile.
This problem I faced sometimes back while compiling. Go to this folder
c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files and delete all the files and folder under it. When you build an application which is not hosted under IIS, temporary debug files and folder get created under this folder.
It may happen that you get an access denied error while deleting them. Close your Visual Studio solution and delete everything under this folder. It will resolve the compilation error.
For those using Visual Studio 2015 in Windows 8 or Windows 10, the solution is to remove all temp files from the following location:
%AppData%\Local\Temp\Temporary ASP.NET Files
and then rebuild your Solution.
In my case, the error is come from some cshtml files that are under project folder but not included in project. So if you search the error in entire solution, it couldn't be found. You can use show all files to show the not included files, and try to open them to find the possible files that cause the error.
If you haven't got the option of "Clean Solution" (maybe Express verions, or pre-2010 don't have this?) then, to fix this error, simply go to the /bin folder of your solution and delete all items, then Build again.
This will recompile all the DLL files.

How to include other files to the output directory in C# upon build?

I have some library files needed for my application to work.
My application has a setup and deployment included.
I already know that in order for a library file to be added to the output directory of the application when installing, I just have to reference those libraries inside the .NET IDE before building... the only problem is that these libraries can't be referenced... So I need to be able to copy these libraries to the installation directory of my application... At the moment, I am copying these libraries manually...
Addendum
I also did try to add these library files as an Existing Item to my project and marked each library files' Copy to Output Directory to Copy if newer on their properties but still not getting the solution I want.
Update 1
Thanks for you help guys it helped me solve my problem, I managed to make the solutions you posted work except for one... #Matthew Watson's post.. I even managed to find a solution too so I wanted to share it with you also.
Heres what I did:
I opened the setup and deployment project in my application.
Under the Application Folder Tree, on it's right side, I right clicked..
then clicked Add..
then clicked File
and then browsed for the files I wanted to add to the installation directory
and click open.
But out of curiosity...I am still trying to make what #Matthew Watson posted work...
Update 2
I forgot to update this post yesterday, I already manage to make Matthew Watson's solution worked yesterday. Thank you again for all your help guys.
You can add files to your project and select their properties: "Build Action" as "Content" and "Copy to output directory" as "Copy Always" or Copy if Newer (the latter is preferable because otherwise the project rebuilds fully every time you build it).
Then those files will be copied to your output folder.
This is better than using a post build step because Visual Studio will know that the files are part of the project. (That affects things like ClickOnce applications which need to know what files to add to the clickonce data.)
You will also be more easily able to see which files are in the project because they will be listed with the source code files rather than hidden in a post-build step. And also Source Control can be used with them more easily.
Once you have added "Content" files to your project, you will be able to add them to a Visual Studio 2010 Setup and Deployment project as follows:
Go into your Setup project and add to your "Application Folder" output the Project Output called "Content Files". If you right-click the Content Files after adding them you can select "outputs" and see what it's going to copy.
Note that Setup and Deployment projects are NOT supported in Visual Studio 2012.
You can use Visual Studio Post Build Event - Copy to Relative Directory Location. Which are basically scripts that are executed on build of specified project.
So you can use it to copy binaries you need, before actually running your application.

Categories