Build fails in vs2015 with no errors - visual-studio

I have an ASP.NET core 1.0 project I created in Visual Studio 2015 (update 3). If I try to build the project within VS I get the following in my output window and there are no errors in the Error List:
1>------ Build started: Project: QuickStartIdentiyServer4, Configuration: Debug Any CPU ------
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
However, if I build the project using the dotnet CLI command (dotnet build) it builds and runs just fine.
UPDATE:
Apparently, .net core does not work properly when running Visual Studio as Admin. You would think everything should work as Admin, I guess not... go figure.

There are simply too many reasons why this type of thing might happen. The easiest way to diagnose the problem is to change the build output verbosity under options to verbose. This might help put you on the trail:
With regards to this type of thing happening with .Net Core and ASP Core. I have noticed that the project.json dependencies json fragment is a bit buggy especially if you start renaming projects and changing their file system location.
If you see in the diagnostic below you know there is some dangling reference issue:
Done building target "_GetDependencyFragmentFiles" in project "<<?YOUR_CORE_PROJECT?>>.xproj" -- FAILED

May be you are not seeing build errors. Go to Error List window and change 'Show Issues generated' box from 'Build + Intellisense' to 'Build Only' and try to build again.
See if this helps.

Related

Non-CrossTargeting GetTargetFrameworks target error with VS 2019

I've just updated my VS to ver. 16.8.3 and now suddenly I am getting this error:
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1720,5): error :
Internal MSBuild error: Non-CrossTargeting GetTargetFrameworks target should not be used in cross targeting (outer) build
Not sure at all what to do about this.
We have been working on this project for years and never had such an issue.
Any thoughts?
Seems that the problem is with projects that use multiple .net frameworks AND they referenence ANOTHER project that uses multiple .net frameworks
I have a MINIMAL sample solution at: my public drive
The solution contains two minimal/empty projects that are technically the same except that the one named Microdesk.DbApp referencing the one name Microdesk.Infrastructure.
The Infrastructure project compiles fine while the DbApp project throws the above error.
This solution was working fine for us for multiple years and broke with the latest VS release 16.8.3
Okay, partially my bad.
I did re-compile the EMPTY sample project and found that despite the compiler error, the solution does build.
1>------ Rebuild All started: Project: Microdesk.BIMrxCommon.Infrastructure, Configuration: Debug2020 Any CPU ------
1> Microdesk.BIMrxCommon.Infrastructure -> C:\Work\Microdesk.BIMrx\bin\Debug2020\Microdesk.BIMrxCommon.Infrastructure.dll
2>------ Rebuild All started: Project: Microdesk.BIMrxCommon.DbApp, Configuration: Debug2020 Any CPU ------
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1720,5): error : Internal MSBuild error: Non-CrossTargeting GetTargetFrameworks target should not be used in cross targeting (outer) build
2> Microdesk.BIMrxCommon.DbApp -> C:\Work\Microdesk.BIMrx\bin\Debug2020\Microdesk.BIMrxCommon.DbApp.dll
========== Rebuild All: 2 succeeded, 0 failed, 0 skipped ==========
BUT if you try to USE anything from the Infrastructure project in the referencing DbApp project then the Solution will NOT compile
Rebuild started...
1>------ Rebuild All started: Project: Microdesk.BIMrxCommon.Infrastructure, Configuration: Debug2020 Any CPU ------
2>------ Rebuild All started: Project: Microdesk.BIMrxCommon.DbApp, Configuration: Debug2020 Any CPU ------
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1720,5): error : Internal MSBuild error: Non-CrossTargeting GetTargetFrameworks target should not be used in cross targeting (outer) build
2>C:\Work\Microdesk.BIMrx\BIMrxCommon\Microdesk.BIMrxCommon.DbApp\DerivedClass.cs(1,29,1,4
): error CS0234: The type or namespace name 'Infrastructure' does not exist in the namespace 'Microdesk.BIMrxCommon' (are you missing an assembly reference?)
2>C:\Work\Microdesk.BIMrx\BIMrxCommon\Microdesk.BIMrxCommon.DbApp\DerivedClass.cs(5,33,5,42): error CS0246: The type or namespace name 'BaseClass' could not be found (are you missing a using directive or an assembly reference?)
========== Rebuild All: 1 succeeded, 1 failed, 0 skipped ==========
I did upload a second sample project named "Microdesk.BIMrx (2).zip" to the previous OneDrive directory
When I test your issue in your side, I did not face the same behaviors as you described. So I guess that there is some issues on your current vs environment due to the update. And maybe the update broke some tools of VS.
So please try the following steps to troubleshoot it:
Suggestions
1) disable any third party installed extensions under Extensions-->Manage Extensions-->Installed
2) close VS, delete .vs hidden folder, every bin and obj folder of your project.
and also delete all cache files under C:\Users\xxx(current user)\AppData\Local\Microsoft\VisualStudio\16.0_xxx\ComponentModelCache
Then, restart VS to test again.
3) or create a new project and then migrate the content from the old into the new one to test whether the issue is related to your VS or the special project itself.
4) If this does not work, do an initialization operation on your VS.
Close VS, delete the whole user folder under C:\Users\xxx(current user)\AppData\Local\Microsoft\VisualStudio\16.0_xxx and then restart VS to test again.
5) repair vs from the vs_installer

error MSB6006: "lc.exe" exited with code -1

I can't build my application anymore,
every time I try to compile the following error arises.
error MSB6006: "lc.exe" exited with code -1
I've never changed anything within the Microsoft.Common.CurrentVersion.targets file (or any other file which is related to MSBuild).
Full path to the file:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets
Rows where the error seems to be/arise:
<LC
Sources="#(_LicxFile)"
LicenseTarget="$(TargetFileName)"
OutputDirectory="$(IntermediateOutputPath)"
OutputLicense="$(IntermediateOutputPath)$(TargetFileName).licenses"
ReferencedAssemblies="#(ReferencePathWithRefAssemblies);#(ReferenceDependencyPaths)"
NoLogo="$(NoLogo)"
ToolPath="$(LCToolPath)"
SdkToolsPath="$(TargetFrameworkSDKToolsDirectory)"
EnvironmentVariables="$(LCEnvironment)"
MSBuildArchitecture="$(LCMSBuildArchitecture)"
TargetFrameworkVersion="$(TargetFrameworkVersion)"
>
The main problem here is that I can compile every other application, but not my most important one which is written in C# WPF with the .NET Framework 4.7.2.
Does anyone have a clue why I might can't compile the solution?
error MSB6006: “lc.exe” exited with code -1
This error means that your project has something wrong rather than Microsoft.Common.CurrentVersion.targets file
In fact, to see the specific error, you should set your Build Output log to Diagnostic/Detailed by Tools-->Options-->Projects and Solutions-->Build and Run-->set MSBuild project build output verbosity to Diagnostic/Detailed. Then when you build again, you can see the detailed info about it.
And you can try to follow these syggestions:
Please check whether you have any warnings on your nuget packages. If so, please reinstall them or just use update-Package -reinstall under Package Manage Console.
If you have any post(pre)-build event(Right-click on your project-->Properties-->Build Event), please check whether the command has some errors.
If you have licenses.licx files, you should exclude them from your project.
you can try to create a new WPF project and then add the same as the previous project to test if it is the issue of your project.
do a repair in VS Installer in case there are something with your VS Environment or update your VS to the latest version.
In addition, if possible, please share the xxxxx.csproj file of your WPF project with us to troubleshoot your issue quickly. Also, there is a similar issue about this error.

Visual Studio target Deploy does not exist

I'm getting this error when running a built project in Visual Studio 2017:
------ Deploy started: Project: myProj, Configuration: Debug Win32 ------
C:\...\myProj.vcxproj : error MSB4057: The target "Deploy" does not exist in the project.
Done building project "myProj.vcxproj" -- FAILED.
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
I found something online saying uncheck Deploy from Build, Configuration Manager... but it is already unchecked.
If I try to run it again, it will load and run. But I'd like to be able to release code that works the first time. What else might I try? TIA.
Odds are you have a post build event in your project. When you first build it the post build event fires and attempts the deploy. The second time you go to build the project is already 'up to date' so it is not built and the post build event does not fire.
You can view your post build events by right clicking your project and choosing properties, expanding build events and then expanding post build.
You can also check if anything is defined under custom build steps.
Solved the problem by opening the .sln file of the problematic solution with a text editor. I've found there the following lines for different configurations:
{GUID}.Release|x86.Deploy.0 = Release|Win32
After deleting all these lines for different configurations, I didn't get the error anymore.
This worked for me :
GOTO "Project Property Page"
click "Project Dependencies"
Select your main project in "Project:"
Add the dependency on the project that gives you the deploy error.
Save ALL
Recompile

Visual Studio online build failing with 0 warnings and 0 errors

I am just setting up a basic build with a very bare bones WebApi App, and I am getting a failed build, but without any errors or warnings... how can i figure out what is going wrong?
Project "d:\a\1\s\My.Project.Api.sln" (1) is building "d:\a\1\s\My.Project.Api\My.Project.Api.csproj" (2) on node 1 (default targets).
_CleanRecordFileWrites:
Creating directory "obj\Release\".
Done Building Project "d:\a\1\s\My.Project.Api\My.Project.Api.csproj" (default targets) -- FAILED.
Done Building Project "d:\a\1\s\My.Project.Api.sln" (default targets) -- FAILED.
Build FAILED.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:00.15
##[error]Process 'msbuild.exe' exited with code '1'.
Even any way I can get a useful log or error message would be great!
Edit:
I added /v:diag for the build arguments for verbose logging, but it really isn't seeming to help.
Before Visual Studio build task, you should use nuget restore to download packages your project is referring.
So please add a Nuget task before Visual Studio build task. Detail setting for NuGet task as below:
Command: restore
Path to solution, packages.config, or project.json: **/*.sln or select relative path for My.Project.Api.sln
Feeds to use: Feeds in my NuGet.config
In your build definition, there is a variable called system.debug which is set to false. Change this to true at the template or at the time of triggering and you will get the debug lines written by the build tasks. Inspect the debug lines and you might find the issue.

Why does Visual Studio (2010) run two builds for a BizTalk Server Project?

I'm using Visual Studio 2010 and BizTalk 2010.
When I add a new Empty BizTalk Server Project and build it, I get the following output:
------ Build started: Project: ThrowAway1, Configuration: Debug Any CPU ------
ThrowAway1 -> c:\...\Projects\ThrowAway1\ThrowAway1\bin\Debug\ThrowAway1.dll
ThrowAway1 -> c:\...\Projects\ThrowAway1\ThrowAway1\bin\Debug\ThrowAway1.dll
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
I already tried deactivating the release build. But I still get two build events - which also affects the post build event.
With a default console application I get only one build event.
My goal is to run my own deployment PowerShell script in the post build event. The script is coming along nicely but it is called two times by this behavior.
This appears to be the expected behavior of a BizTalk Project.
I'm only speculating that it's because many BizTalk artifacts are compiled in a two step process. Orchestrations to C# then C# to the output Assembly for example.
The only thing I can recommend is to either make the script deterministic or maybe a side project that runs the post build for the entire Solution.
You can also investigate the BizTalk Deployment Framework: http://biztalkdeployment.codeplex.com/
As a pragmatic solution:
Checking the .btproj MSBuild file and its imports
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\BizTalk\BizTalkC.targets" />
where BizTalkC.targets imports
<Import Project="$(MSBuildExtensionsPath)\Microsoft\BizTalk\BizTalkCommon.targets" />
shows the usage of $(SecondBuild) in BizTalkCommon.targets.
This can be used in the post build event:
if "$(SecondBuild)"=="true" (
rem Run script.
)
For the first build $(SecondBuild) will be empty/undefined.

Resources