I have a c# solution (open source, available here: https://github.com/tzachshabtay/MonoAGS) which I can compile fine from Visual Studio 2017 (Dot net framework) and from VS for Mac (Mono). I can also compile it with msbuild on Travis CI successfully on both linux and mac (https://github.com/tzachshabtay/MonoAGS/blob/master/.travis.yml).
What I can't do, is compile it on command-line from Windows 10 on my local machine. I'd like to be able to compile it both for DotNet Framework and Mono.
So I tried using MSBuild from both the mono installation and from the Build Tools for Visual Studio 2017 (note: I want to be able to install on windows even if vs2017 is not installed, though on the local machine vs2017 is installed, don't know if it matters).
Both installations are for the latest versions as of today.
This is the error I get from msbuild on mono (PATH was set to %programfiles(x86)%\Mono\bin):
Project "C:\Github\MonoAGS\MonoAGS.sln" (1) is building "C:\Github\MonoAGS\Source\Tests\Tests.csproj" (2) on node 1 (default targets).
Project "C:\Github\MonoAGS\Source\Tests\Tests.csproj" (2) is building "C:\Github\MonoAGS\Source\AGS.API\AGS.API.csproj"
(3) on node 1 (GetTargetFrameworks target(s)).
C:\Program Files\dotnet\sdk\2.1.4\Sdks\Microsoft.NET.Sdk\Sdk\Sdk.props(29,11): error MSB4226: The imported project "C:\
Program Files (x86)\MSBuild\15.0\Microsoft.Common.props" was not found. Also, tried to find "15.0\Microsoft.Common.prop
s" in the fallback search path(s) for $(MSBuildExtensionsPath) - "C:\Program Files (x86)\MSBuild" . These search paths
are defined in "C:\Program Files\Mono\lib\mono\msbuild\15.0\bin\MSBuild.dll.config". Confirm that the path in the declaration is correct, and that the file exists on disk in one of the search paths. [C:\Github\MonoAGS\Source\AGS.
API\AGS.API.csproj]
And here's the error I get from msbuild from build tools (PATH was set to %programfiles(x86)%\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin):
Project "C:\Github\MonoAGS\Source\Tests\Tests.csproj" (2) is building "C:\Github\MonoAGS\Source\AGS.API\AGS.API.csproj" (3) on node 1 (GetTargetFrameworks target(s)).
C:\Github\MonoAGS\Source\AGS.API\AGS.API.csproj : error MSB4247: Could not load SDK Resolver. A manifest file exists, but the path to the SDK Resolver DLL file could not be found. Manifest file path 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\SdkResolvers\Microsoft.Build.NuGet
SdkResolver\Microsoft.Build.NuGetSdkResolver.xml'. SDK resolver path: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\CommonExtens
ions\Microsoft\NuGet\Microsoft.Build.NuGetSdkResolver.dll
As for the mono error, the MSBuild\15.0 folder exists but Microsoft.Common.props is not there (and I couldn't find it anywhere else on that machine).
As for the build tools error, the CommonExtensions folder exists but there is no Microsoft folder in it.
The command I'm trying is:
msbuild /p:Configuration=DEBUG /p:Platform="Any CPU" MonoAGS.sln
Why doesn't it work? What am I missing?
Thanks.
How to compile my c# solution with msbuild from command line
For the build tools error, you should install the component NuGet package manager by Visual Studio Installer:
When we use the Visual Studio build tool to build our project, we also need to install some of the necessary components for our project.
For the mono error, since I do not have mono ENV, I could not specify the directly reason for that error, if possible, you can try to install Mono framework. If it not helps, you can open a new thread with mono and msbuild tags.
Update:
How do I install it with command-line, btw (for setting up a script)?
Yes, you can use vs_buildtools.exe to install that component ID Microsoft.VisualStudio.Component.NuGet:
vs_buildtools.exe --add Microsoft.VisualStudio.Component.NuGet --quiet
Note: You should rename vs_buildtools__2048890300.15156xxxx.exe to vs_buildtools.exe, then use vs_buildtools.exe to install it.
Check the Visual Studio Build Tools 2017 component directory and Use command-line parameters to install Visual Studio 2017 for some more details.
Hope this helps.
Related
Hi I am trying to run dotnet build <Sln file> to build the project but I am getting this error MSB4025: The project file could not be loaded. Data at the root level is invalid. Line 1, position 1.
Build Failed
Folder Structure: C:\Users\USERNAME\PROJECTNAME\Folder0\File0.vdproj(1,1)
Dotnet Version: 6.0.301
I think that this information is useful.
vdproj is a MSI creation project for Visual Studio. Its been deprecated and most people have moved on to either WIX or NSIS or a professional grade installer creation tools such as Install Shield. If you do not require an installer for your product just exclude the vdproj project from the solution and continue with your life. For fun if you want to try to transition right away to wix, try this powershell script https://github.com/chrisoldwood/vdproj2wix
Visual Studio - vdproj is incompatible
MSI setup (.vdproj) This project can't be opened in Visual Studio 2013 because it doesn't support that project type. We recommend that you use InstallShield Limited Edition for Visual Studio (ISLE), a free deployment solution that directly supports most Windows platforms and application runtimes. You can also use ISLE to import data and settings from Visual Studio Installer projects.
Port, migrate, and upgrade Visual Studio projects
We have a large project. We recently upgraded to Visual Studio 2017, .Net 4.65.
Unit tests execute fine inside Visual Studio, but were failing on our Jenkins build. Tried executing from the command prompt and got error message.
This is my command line:
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" "C:\Projects\GitHub\cap-combinedworkflow\CCSSWorkflow.Tests\obj\Debug\CCSSWorkflow.Tests.dll" /settings:C:\Projects\GitHub\cap-combinedworkflow\ExternalFiles.testsettings /tests:CAHBrandAgreementsWorkItemSaveTest
This was the output:
Warning: No test is available in C:\Projects\GitHub\cap-combinedworkflow\CCSSWorkflow.Tests\obj\Debug\CCSSWorkflow.Tests.dll. Make sure that installed test discoverers & executors, platform & framework version settings are appropriate and try again. Additionally, you can try specifying '/UseVsixExtensions' command if the test discoverer & executor is installed on the machine as vsix extensions and your installation supports vsix extensions. Example: vstest.console.exe myTests.dll /UseVsixExtensions:true
I then added the suggested parameter:
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" "C:\Projects\GitHub\cap-combinedworkflow\CCSSWorkflow.Tests\obj\Debug\CCSSWorkflow.Tests.dll" /settings:C:\Projects\GitHub\cap-combinedworkflow\ExternalFiles.testsettings /tests:CAHBrandAgreementsWorkItemSaveTest
And got a slightly different error:
Warning: No test is available in C:\Projects\GitHub\cap-combinedworkflow\CCSSWorkflow.Tests\obj\Debug\CCSSWorkflow.Tests.dll. Make sure that installed test discoverers & executors, platform & framework version settings are appropriate and try again.
Thanks,
SamR
If you look at how you run the tests in command line you are referencing an intermediate empty dll in obj. Change the path to:
C:\Projects\GitHub\cap-combinedworkflow\CCSSWorkflow.Tests\bin\Debug\CCSSWorkflow.Tests.dll (note bin in the middle there)
I found many topics regarding this issue but it looks like it none of them can help me. I'm trying to install DotNetCore.1.0.1-VS2015Tools.Preview2.0.3.exe without Visual Studio installed - basically it's our build machine. When I run executable I get: "This product requires Visual Studio 2015 ..." . I've already tried to use SKIP_VSU_CHECK=1 and it didn't help.
Context:
We have TeamCity server build agents hosted on different machine and we don't want to install Visual Studio there. One of our project is *.xproj project and it cannot be built due to the following error: " error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
What I found so far is that I should install Vs2015Tools in order to build it. I have already installed .NET core SDK.
I am in the process to setup our new Win7 build machine for our C# project. We don't want to install Visual Studio on that machine. So I am following the instruction "Running mstest without Visual Studio" to setup our machine.
On step 3:
Put Microsoft.VisualStudio.QualityTools.Resource.dll and
Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll in the GAC on the CIServer,
because that is where they are on the DevMachine.
On my develoopment machine (installed Visual Studio 2008 professional version) I found both of them in my GAC (C:\windows\assembly) but I searched my entire development machine and couldn't find the Microsoft.VisualStudio.QualityTools.Resource.dll
My questions are:
where to get the Microsoft.VisualStudio.QualityTools.Resource.dll?
can I copy above file from GAC? (I tried gacutil.exe, there is no such copy option. I tried Control Panel->Administrative Tools, but my XP machine only has Microsoft .Net Framework 1.1 Configuration on which above two assembly didn't show up.)?
thanks,
You can copy files from the GAC via cmd.exe. E.g.:
copy C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.Resource\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Resource.dll C:\Temp
Adjust the version appropriately.
Windows Explorer just replaces the subfolders in C:\Windows\assembly with the aggregated view you might know.
my Version Of this Dll currently sites at the following location C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0 due to using vs2010 so change the path accordingly to get it from your machine
if you need to run this in isolation create a tools folder in your folder structure thats checked into source control and then reference the dll from that tools folder and NOT from the GAC. this means that when it builds on the build machine it wont need Visual Studio installed
Maybe you have a 64 bit machine. In that case, it's here.
C:\Program Files (x86)\Microsoft Visual Studio
10.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
Run the command below if you use VS2008
copy C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.Resource\9.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Resource.dll c:\temp
I've created the installer for my project without a problem, In project's properties, I included Visual C++ 2017 Runtime Libraries (x64) 2010 and 2017.
But during the installation in the client host, I've got a 'The following package files could not be found:' without specifying much more information.
Is when I checked the temp directory that I've discovered that 'vc2017redist_x64' haven't copied.
With the 2010 version, it seems to work rightly.
Anyone have experienced the same problem?
I'm using Visual Studio 2017 15.9.17.
Finally I came up with the solution.
The path of the VC++2017 installer in the default bootstraper package was wrong and installation failed.
So I had to edit the manifest file in
C:\Program Files (x86)\Microsoft SDKs\ClickOnce Bootstrapper\ and set the right path.
Once modified, it worked!
Please notice that you can also find the bootstrapper folder location from the Path value in the following registry key:
HKLM\Software\Microsoft\GenericBootstrapper
On 64-bit systems, use the following registry key:
HKLM\Software\Wow6432Node\Microsoft\GenericBootstrapper