Where does the VS2012 Publishing Wizard get its file references? - asp.net-mvc

I am having an issue where when I select to publish my MVC project to the file system so I may upload it later via FTP to my Web Host, it fails complaining of missing files.
Believing that it may think these files are required to compile the project, I copy them to the locations that it expects and it resolves the error but produces yet another error about another missing file.
These files incidentally are not required to run my Web Application but were simply files used during the initial test phase of my project. More specifically, picture files.
The next step I took to resolve the issue was to Clean and rebuild the Solution and Project Entirely with all those files it was referencing in the errors removed. The Project builds successfully and runs as expected.
I then attempt to publish to the file system and again it complains of those files as if its getting that information from somewhere other than obvious places within my Project.
I have deleted the object directory content, cleaned and rebuilt; again it references these files that don't exist anywhere within my Solution.
So my question is, Where exactly does the Web Publishing Wizard get the information it uses to copy the required files to the Target Location? I've checked the .pubxml file but there's nothing in there that would provide the information.
For instance, if I'd initially built my site using reference to a .png file then later use a .jpg file. The Wizard seems to be getting the metadata for the initial build somewhere and insists on inclusion of the .png file when it is no longer needed.
I believe I have Upgraded to the latest build and patches for VS2012. I am Currently running version 11.0.50727.1 and using .NET 4.5
I cannot find any relevant information on this problem so it may be a quirk in my Environment so I'm searching for some feedback.
If no answer can be provided, if I could simply know what folders and files are required to deploy an MVC site; I'll perform the deploy manually and trash the Wizard concept. I just thought it would be the most appropriate way to deploy but if its going to be a pain; I don't need it.
This is the Error:
Error : Copying file <relative path>\image.png to obj\Release\Package\PackageTmp\<relative path>\image.png failed.
Could not find file '<relative path>\image.png'.
The new file that replaced the old file is actually image.jpg and its in there. I could alleviate this error by copying the old file back to its initial location, but why should I if its no longer required?

Related

Website builds but publish to Azure fails after deleting files

Using Visual Studio 2019 to build a .Net Core website and publish to Azure was working fine up until I just deleted a DataContext file and an Entity class through Visual Studio. I can build and bring the site up locally without any issue but when I try to publish the site to Azure I get an error that the two files I deleted could not be found. I've checked in my code along with the solution file. The message is correct, those files are no longer available but I'm not understanding why it's looking for them since I deleted them through VS and the solution/project file should have been updated. I've done some searching but can't find anything that specifically address this. I guess I could roll back to right before I deleted the files but then I'l have to update some code. Anyone know if I can look somewhere that is referencing these files for publishing so I can delete the reference? I've searched the whole solution for the name of the files hoping I could find a reference but it isn't finding anything.

Visual Studio for Mac - AppResource.Designer.cs Not Getting Regenerated

Visual Studio for Mac Community 7.7.4 (build 1)
I went info one of my .NETStandard 2.0 projects and added a string MyLabelTitle to its AppResources.resx file.
I reference this string in my code like so:
AppResource.MyLabelTitle
This will build successfully and that is great.
However, lots of online forums, documentations, Xamarin forums, StackOverflow questions that I have seen state that AppResource.Designer.cs file will regenerate itself when you rebuild your project. Some suggest ignoring it in git as well.
To test that, I reverted back my changes (I am using git) from AppResource.Designer.cs so the end result is that:
AppResource.Designer.cs does not have my changes while
AppResource.resx file has my change in it.
Based on my understanding, rebuilding the project will pick up my change from AppResource.resx file and add it to AppResource.Designer.cs file.
However, building my iOS or Android project will now fail to build because it is referencing one of strings I added in AppResource.resx file.
This string is still present in AppResource.resx file but it wasn't regenerated inside AppResource.Designer.cs and as a result my project is unable to reference that string.
UNSUCCESSFUL ATTEMPT TO SOLVE
I thought that if I comment out the line of code referencing AppResource.MyLabelTitle, I should be able to build successfully and it did build successfully, but the string MyLabelTitle still was not picked from AppResource.resx file and re-generated inside AppResource.Designer.cs file. As a result, I cannot reference that string anymore in my code.
How to resolve this issue?
I suspect you also posted this problem on the Visual Studio for Mac community forum but will answer it here in case anybody looks here instead.
Visual Studio for Mac does not re-generate the associated .cs files for .resx files when building. It will re-generate the .cs file when the .resx file is saved in the text editor.
One problem here is that the .resx file needs to have unsaved changes otherwise the .cs file will not be re-generated.
Android projects will re-generate their Resources.designer.cs file on building. This .cs file is generated based on the contents of the various .axml files in the project not any .resx files.
There is an addin you can install which might help here. It provides a way to run all custom tools for the solution or project manually or when a build is run.
https://github.com/mrward/monodevelop-run-custom-tool
https://addins.monodevelop.com/Project/Index/380

Adding references search folder for MSBuild from Visual Studio Build definition UI

I am working on configuring a XAML build definition for a .net solution (of another company) stored in TFS2015.
The solution uses Dll references from a software X, installed on the developers computers, but not present in the Build server. (FTS and Build servers are shared among many clients).
I have option to add the required Dlls in a folder along with the source code, but I do not have option to modify the .csproj files.
In the Build definition, I tried to add the following in the MSBuild arguments field :
/p:AdditionalLibPaths=$/[long tfs path here]/CommonDlls
/p:AdditionalLibPaths=$(SourceDir)/CommonDlls
but it is not working.
Ideally, I would like to specify a relative folder from the root of the source code.
(a static path might work but only for one build server and agent, which is not the objective of shared build).
Any ideas on how I can define this parameter ?
There is also option to add a prebuild script path. I can store a script file along with source code. Any pointers for how to write such script file ?
You do not really need a script.
There are two things to make this work.
The first step is making sure that the DLLs are downloaded to the Agent working folder, the simplest way is have the $/[long tfs path here]/CommonDlls mapped in the Build Workspace; this is specified in the Source Settings tab of the Build Definition. Be careful to use the $(SourceDir) token in the mapping (see here).
The second point is to use a proper reference to the downloaded folder: use the TF_BUILD_SOURCESDIRECTORY variable (see here for full list).
So, if you added a mapping like
$/[long tfs path here]/CommonDlls -> $(SourceDir)\CommonDlls
use $(TF_BUILD_SOURCESDIRECTORY)\CommonDlls.
It took me almost 20 trials to get the right one, it all started with how long it took that warning to consider all other directories, I could've ignored it but here's the warning first
C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): Warning MSB3245: Could not resolve this reference. Could not locate the assembly "nameOfDllFile". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
and this is the argument that got it working
/p:ReferencePath="$(build.sourcesdirectory)\Binaries"
where Binaries is the equivalent to CommonDlls from the question, and it is all because of the vague documentation and differences between versions of MSBuild, mine is 14.0 (VS2015).

Remote Debugging in Delphi XE8 and Delphi 10 Seattle - How can I use a fixed remote directory?

To debug remotely with Delphi, now that the PAServer is normally used, one usually follows the following preliminary steps, as outlined on the online docwiki:
Create a remote profile inside your ide, in my case I'm calling it win7vm, this contains the IP address of the remote system, and a few options, and the PAServer connection password, but as far as I can see, it doesn't contain any context information like "I want to use the following remote folders".
The remote folders that are usually used to contain my target executable are usually a subdirectory underneath the scratch directory. If I configure the main scratch directory to be c:\scratch, and my remote profile was named win7vm and my project is name project1, then the IDE and PA Server are going to compile and deliver my executable to c:\scratch\win7vm\project1 and run it from there.
What I actually want is to have my executable be delivered to and run right in #c:\scratch#. I have a gigabyte of supporting files that all need to be in the same directory as my main executable and I don't want to have 8 copies of these supporting files. So, can this be done? Can I make PA Server NOT create a sub-folder with the name of my project and another for the name of my session? If so, is this done inside the paserver.config file, or on my client side, or somewhere else?
Update: I tried to change the Remote Path in the Project -> Deployment, but it does not work to use a relative path here. For example, change it to ..\..\ and the working directory in Project Options to ..\..\, but it still only delivers my executable to the folder c:\scratch\win7vm\project1 instead of directly into c:\scratch\
Update 2: It appears you can't do what I want, which is have the scratch directory be the main folder, and NOT create any sub-folders per-profile and per-project, and that if you don't like working in a scratch sub-folder, you should just set Absolute Remote Paths in Deployment and Absolute working folder in your project's Run options, and you should turn off restricted mode, however this means that the entire VM or machine you are remotely debugging can be manipulated by the PAServer, which is also hardly ideal. I believe that having a fixed root scratch folder would be a safer and more flexible way of working, so I'm leaving this question open, hoping to find an effective way to achieve a safe but flexible remote debugging technique.

Wix in TFSBuild: SourceCodeControlRoot

I am following the recommendations to integrate Wix with TFS (http://wixtoolset.org/documentation/manual/v3/msbuild/daily_builds.html) (without having to install it on the Build server)
In my WixProj file, I have the line:
$(SourceCodeControlRoot)\wix\3.9\
This has been checked in with all of the prerequisite files - and I can successfully build on my Dev box.
But when I run my build, TFS complains that it can't find my Wix.targets file.
The error states:
*C:\Builds\8\AppName\DailyBuild\Sources\Setup\Case Tracking Setup\Wix Case Tracking.wixproj (73): The imported project "C:\wix\3.9\Wix.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
So I'm obviously using the wrong Reference but I couldn't find any other examples and the only place with SourceCodeControlRoot appears is related to Wix.
Any ideas?
Thanks
The article intends that you define or replace $(SourceCodeControlRoot) such that $(SourceCodeControlRoot) is the folder TFS exports to during the build. In your case, I'm guessing "C:\Builds\8\AppName\DailyBuild\". Of course, you probably don't want to hardcode it. You could pass a property setting to msbuild: /property:SourceCodeControlRoot="$(TF_BUILD_BUILDDIRECTORY)"
It doesn't really matter where you have your binaries (wix\3.9) folder. The end goal is to have $(WixToolPath) point to it. You could define it relative the project file if that's more convenient in your project structure:
<WixToolPath>$(MSBuildProjectDirectory)/../wix/3.9/</WixToolPath>

Resources