Disabling incremental linking from msbuild - visual-studio-2010

I'm building protobufers for windows, using VS2010 using msbuild e.g. only console, no gui interaction. However I'm running into issues when generating the executables. I get the following errors:
(Link target) ->
LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
The problem is with incremental linking (/INCREMENTAL). My question is how can I disable that when running msbuild and not by editing the .sln/vcproj file. I tried msbuild /p:incremental=no to no avail.

The property that controls it is called LinkIncremental. E.g.:
msbuild MyProject.vcxproj /p:LinkIncremental=false

Related

Building Xamarin.Forms iOS project from command line with msbuild

I'm trying to build a Xamarin.Forms iOS project via command line for CI/CD purposes directly on macOS:
msbuild C4S_MobileApp.iOS/C4S_MobileApp.iOS.csproj /restore /p:Platform=iPhone /p:ArchiveOnBuild=true /p:Configuration="Release" /p:BuildProjectReferences="false"
The problem is the shared app project which I avoid rebuilding with /p:BuildProjectReferences="false" and whose .dll can't be found:
CSC : error CS0006: Metadata file '/Users/c4s/Projects/c4s_refactored/c4s-refactored-mobile-app/C4S_MobileApp/bin/iPhone/Release/netstandard2.1/C4S.MobileApp.dll' could not be found [/Users/c4s/Projects/c4s_refactored/c4s-refactored-mobile-app/C4S_MobileApp.iOS/C4S_MobileApp.iOS.csproj]
MSBuild assumes the .dll in C4S_MobileApp/bin/iPhone/Release/netstandard2.1/ but it's in C4S_MobileApp/bin/Release/netstandard2.1. An ugly solution would be to copy the C4S.MobileApp.dll to that location. Building without /p:BuildProjectReferences="false" works because msbuild then creates C4S_MobileApp/bin/iPhone/Release/netstandard2.1/C4S.MobileApp.dll
I added the parameter /p:AssemblySearchPaths="C4S_MobileApp/bin/Release/netstandard2.1" to msbuild command and also added <AssemblySearchPaths>C4S_MobileApp/bin/Release/netstandard2.1;$(AssemblySearchPaths)</AssemblySearchPaths> to the C4S_MobileApp.iOS.csproj file under Release|iPhone configuration but it seems to be ignored by msbuild.
Folder structure:
c4s-refactored-mobile-app/
-> C4S_MobileApp/
-> C4S_MobileApp.iOS/
Thanks for your help and suggestions.
Unfortunately it's a bug in Xamarin.iOS: https://github.com/xamarin/xamarin-macios/issues/10308

Xamarin Forms c# - java exited with code 1 in VS Studio for Windows

I am trying to compile an android app with XF. I am getting the infamous java.exe exited with code 1 error message. I have enabled proguard.
I have gotten the error just from enabling proguard.
The error only seems to happen in VS for Windows. I got a different error in VSMac, but don't have that right here in front of me.
Updating proguard from it's home on sourceforge doesn't seem to do anything for me.
I have put a new proguard.cfg file in my project and have set the build property to be a proguard configuration file.
I don't know what to do here. I'm looking for any suggestions.
TIA.
Update 1:
I didn't add the build output because I couldn't find a good exception in it. I just have the following that I can find in the build output.
I wish I could find the error easily. I had turned on the build output. the only exception i can find is listed below. I checked the targets file and the line reference is for the Proguard section.
1> at proguard.Initializer.execute(Initializer.java:485)
1> at proguard.ProGuard.initialize(ProGuard.java:271)
1> at proguard.ProGuard.execute(ProGuard.java:113)
1> at proguard.ProGuard.main(ProGuard.java:572)
1> Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2550,3):
Link to build output: https://www.dropbox.com/s/jl1o2hf7aeji243/BuildOutput.zip?dl=0

SonarQube Scanner for MSBuild on macOS using mono

I'm trying to use SonarQube Scanner for MSBuild on a Xamarin project on macOS using mono. As MSBuild 15.0 is now shipped with Xamarin, I figured this could actually work.
I can successfully run the scanner's "begin" using mono like so:
mono sonar-scanner-msbuild-2/SonarQube.Scanner.MSBuild.exe begin /k:"KEY"
The command creates the following files:
.sonarqube/conf/SonarQubeAnalysisConfig.xml
.sonarqube/conf/SonarQubeRoslyn-cs.ruleset
.sonarqube/conf/cs/SonarLint.xml
Before running MSBuild, I've added the following import to the csproj files of my solution:
<Import Project="/Users/someuser/.local/share/Microsoft/MSBuild/14.0/Microsoft.Common.targets/ImportBefore/SonarQube.Integration.ImportBefore.targets" />
I'm running MSBuild using:
msbuild /t:Rebuild
Now the build starts correctly but eventually terminates with two errors:
"/Users/someuser/Project/Project.sln" (Rebuild target) (1) ->
"/Users/someuser/Project/Project.UI.iOS/Project.UI.iOS.csproj" (Rebuild target) (2) ->
"/Users/someuser/Project/Project.Core/Project.Core.csproj" (default target) (3:3) ->
(CoreCompile target) ->
CSC : error CS2001: Source file `/additionalfile:/Users/someuser/Project/.sonarqube/conf/cs/SonarLint.xml' could not be found [/Users/someuser/Project/Project.Core/Project.Core.csproj]
CSC : error CS2001: Source file `/additionalfile:/Users/someuser/Project/.sonarqube/conf/Project.Core_AnyCPU_Debug_1267/ProjectOutFolderPath.txt' could not be found [/Users/someuser/Project/Project.Core/Project.Core.csproj]
Both files do exist in the filesystem, the first file was created in the scanner's begin invocation and the second file was created during the MSBuild execution.
Why would MSBuild not be able to find / access these two files? Is there anything that can be done about it?
After checking with the folks taking care of MSBuild, the solution has been provided in this Github issue thread:
To quote radical's comment from the Github issue:
You could try building with csc by passing /p:CscToolExe=csc.exe /p:CscToolPath=/Library/Frameworks/Mono.framework/Versions/4.8.0/lib/mono/msbuild/15.0/bin/Roslyn/ to msbuild
Unfortunately, even though MSBuild works with the above adjustments, SonarQube fails afterwards. I will follow up with the SonarQube people to see whether this can be worked around.

Build SSIS project with Visual Studio 2013

I have to automate the way we build and deploy our SSIS projects.
We use VS2013, SQLSERVER2014 and TFS2015. I'm already aware of two solutions:
1) MSBuild: I followed this blog https://speaksql.wordpress.com/2013/06/07/a-journey-to-db-deployment-automaton-ssis-build-using-msbuild/ and it works fine for VS2010 but unfortunately not for VS2013.
The error I'm getting is:
Project "SSISTest\SSISTest\SSIS.MSBuild.proj" on node 1 (SSISBuild target(s)).
SSISBuild:**************Building SSIS project: ..\SSISTest\SSISTest.dtproj for onfiguration: Development**************
------
Loading project file '..\SSISTest\SSISTest.dtproj'
Setting output directory to '..\SSISTest\bin\Development'
Setting project ProtectionLevel to 'DontSaveSensitive'
Loading package '..\SSISTest\Package.dtsx'
error : Error while loading package '..\SSISTest\Package.dtsx': The package failed to load due to error 0xC0011008 "Error loading from XML. No further detailed error information can be specified for this problem because no Events object was passed where detailed error information can be stored.". This occurs when CPackage::LoadFromXML fails.\r
error :
error : The package failed to load due to error 0xC0011008 "Error loading from XML. No further detailed error information can be specified for this problem because no Events object was passed where detailed error information can be stored.". This occurs when CPackage::LoadFromXML fails.\r
error : \r
error : at Microsoft.SqlServer.Dts.Runtime.Package.LoadFromXML(String packageXml, IDTSEvents events)\r
error : at Microsoft.SqlServer.IntegrationServices.Build.DeploymentFileCompilerTask.LoadPackage(String path)\r
error : at Microsoft.SqlServer.IntegrationServices.Build.DeploymentFileCompilerTask.Execute()
Done Building Project "SSISTest\SSISTest\SSIS.MSBuild.proj" (SSISBuild target(s)) -- FAILED.
2) devenv: works fine but our projects are all protected with a password, and everytime you try to build it prompts the dialog to insert the password.
Is there any other way I can automate this in VS2013?
I'll answer myself. After adding the proper dll references (expecially the Microsoft.SqlServer.ManageDTS one) for VS2013 to the http://sqlsrvintegrationsrv.codeplex.com/SourceControl/latest project, generating the .dll allowing MSBuild to build SSIS project as suggested by https://speaksql.wordpress.com/2013/06/07/a-journey-to-db-deployment-automaton-ssis-build-using-msbuild/, worked just fine. I'm now able to automatically build SSIS projects with MSBuild and deploy them to a SQL Server 2014 instance.

c++ -- Visual Studio 2010 Linker Error LNK1104: 'cannot open file Debug\AssemblyInfo.obj' [.obj files are not created at compile time]

After a great deal of searching and head banging, i'm asking this question.
I started a new Windows Forms Application in Visual Studio 2010. Gave it a name and stored it in a location. Nothing added or edited in the same. No changes in the project properties either.
Here is a copy of the Solutions Explorer.
I'm building the empty form and I get the following error.
1>------ Build started: Project: TestProject, Configuration: Debug Win32 ------
1>Build started 27/11/2013 1:35:27 PM.
1>InitializeBuildStatus:
1> Touching "Debug\TestProject.unsuccessfulbuild".
1>GenerateTargetFrameworkMonikerAttribute:
1>Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
1>CoreResGen:
1> Processing resource file "Form1.resX" into "Debug\TestProject.Form1.resources".
1>LINK : fatal error LNK1104: cannot open file 'Debug\AssemblyInfo.obj'
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:01.41
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Now I have checked every damn page relevant to the error (6 hrs. of googling!!)
Here is a list of the possible errors as suggested by MSDN. Now I'm new to MSVS 10, so I figure out that the .obj file is not present in the Debug Window, but AssemblyInfo.cpp is present. What should I do in the project settings so that the .obj gets compiled and the error goes away.
Update: Still no answers!! I'm amazed how NOBODY is getting this issue. Here is what I have tried soo far and the following happens:
Opened new Visual C++ Windows Forms Application (no modifications!)
Write ABSOLUTELY NO CODE.
Build Project
And the error occurs.
Next
Opened an old solution, where the .obj files were present.
Made a rebuild of the solution.
Same Error.
I look up the solution in the windows explorer. All .obj files are gone(which should happen as a rebuild would clean the .obj files). But what remains are onlt the .log files.
Thus, I have isolated the error that the compilation is not occuring as the linker files are not being created. As a result, the linker error LNK1104 or LNK1181 happen.
Can somebody tell me why is this problem. Has anyone seen this before. Can anyone provide a solution, if possible??
The compiler says there are not modification in any of the files "Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files." So it'll skip the compilation phase (which generates the .obj files).
But the linker needs these files and for some reason they don't exist (at least that's what you claim is happening).
So you can try to force the compilation by doing a clean and than rebuild.
EDIT:
This particular issue can also be caused by specifying a dependency to a lib file that has spaces in its path. The path needs to be surrounded by quotes for the project to compile correctly.
On the Configuration Properties -> Linker -> Input tab of the project’s properties, there is an Additional Dependencies property.
C:\Program Files\<lib> -> "C:\Program Files\<lib>"
This problem got solved long ago.
1>LINK : fatal error LNK1104: cannot open file 'Debug\AssemblyInfo.obj'
1>
1>Build FAILED.
This was happening because the file Debug\AssemblyInfo.objwas simply not being created. This was due an error in the VS registries.
I did a clean, fresh install of windows and VS. This fixed the registry issues, and the file was being created perfectly.
I hope this helps people. Cheers!
I had a similar problem recently and it turned out to be due to the fact that I'd forgotten to unset /P in my compiler settings. Even though it seems like your problem is distinct, we both got the same error message.
When you preprocess to a file, cl stops producing .obj files.

Resources