I tried to add CI support in my little github repository, so I configured it to use appveyor. But it was unable to build my solution and was failing with odd errors. But it had a build log, so I retyped them in my console and encountered exactly same problem, multiple odd errors like The type or namespace name 'System' could not be found
git clone -q --branch=master https://github.com/Pzixel/RemoteClient.git C:\projects\remoteclient
msbuild "C:\projects\remoteclient\RemoteClient\RemoteClient.sln" /verbosity:minimal
And same here in AppVeyor: https://ci.appveyor.com/project/Pzixel/remoteclient
However VS2017 is just fine with it:
Why does it happening and how could it be fixed?
I think you will need to restore your nuget packages before building your solution. You can download the nuget.exe here.
Than you can run:
nuget restore RemoteClient.sln
msbuild RemoteClient.sln
I did a clean checkout and run both commands.
Related
When attempting to use Docfx to document a C# project I am running into an issue that is probably down to myself being a moron. However I have read through the docfx examples and I have not seen any obvious ways of rectifying the issue.
When I run docfx init -q I get no errors. When I run docfx docfx.json --serve I also get no errors, upon completed I get a Build succeeded. 0 Warnings 0 Errors message however no html files are generated.
It also appears to be correctly reading the source files from my project as the api folder has yml files with the same names as the class files in the project.
How do I get docfx to generated the appropriate html files for the project. Full output of docfx docfx.json --serve is below:
[19-07-04 05:07:47.020]Info:[MetadataCommand.ExtractMetadata]Using msbuild C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin as inner compiler.
[19-07-04 05:07:47.302]Info:[MetadataCommand.ExtractMetadata]Loading projects...
[19-07-04 05:07:50.379]Info:[MetadataCommand.ExtractMetadata]'C:/Users/Devvy/Source/Repos/TestProj/TestProj.csproj,C:/Users/Devvy/Source/Repos/TestProj/Display_Output.cs,C:/Users/Devvy/Source/Repos/TestProjException.cs,C:/Users/Devvy/Source/Repos/TestProj_Core.cs,C:/Users/Devvy/Source/Repos/TestProj/Module_Info.cs,C:/Users/Devvy/Source/Repos/TestProj/Opcode_Assembler.cs,C:/Users/Devvy/Source/Repos/TestProj/Opcode_Disassembler.cs,C:/Users/Devvy/Source/Repos/TestProj/Pattern_Tools.cs,C:/Users/Devvy/Source/Repos/TestProj/Payloads.cs,C:/Users/Devvy/Source/Repos/TestProj/Process_Info.cs,C:/Users/Devvy/Source/Repos/TestProj/PtrRemover.cs,C:/Users/Devvy/Source/Repos/TestProj/RopChainGenerator32.cs,C:/Users/Devvy/Source/Repos/TestProj/RopChainGenerator64.cs,C:/Users/Devvy/Source/Repos/TestProj/Thread_Info.cs,C:/Users/Devvy/Source/Repos/TestProj/obj/Debug/net472.AssemblyInfo.cs,C:/Users/Devvy/Source/Repos/TestProj/obj/Debug/net472/TestProj.AssemblyInfo.cs,C:/Users/Devvy/Source/Repos/TestProj/obj/Debug/net472_Lib.AssemblyInfo.cs,C:/Users/Devvy/Source/Repos/TestProj/obj/Debug/net472/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs,C:/Users/Devvy/Source/Repos/TestProj/obj/Debug/net472/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs,C:/Users/Devvy/Source/Repos/TestProj/obj/Debug/net472/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs,C:/Users/Devvy/Source/Repos/TestProj/obj/Debug/netstandard2.0.AssemblyInfo.cs,C:/Users/Devvy/Source/Repos/TestProj/obj/Release/net472/TestProj.AssemblyInfo.cs' keep up-to-date since '7/4/2019 5:03:14 PM', cached result from 'C:/Users/Devvy/Source/Repos/TestProj/Documentation/api' is used.
[19-07-04 05:07:50.379]Info:[MetadataCommand]Completed Scope:MetadataCommand in 3384.2278 milliseconds.
[19-07-04 05:07:50.379]Info:Completed in 3389.2213 milliseconds
Build succeeded.
0 Warning(s)
0 Error(s)
Docfx provides static code documentation for us. If you want to static website of output with docfx correctly. You should follow these steps;
First you must install docfx. You have many way but I recommend install with choco
choco install docfx -y
then you must add your project docfx console package from NuGet
Install-Package docfx.console -Version 2.33.0
now open your project folder or whatever you want create a folder then run like that
docfx init
now best part of this answer you must config you'r project docfx.json file like this
after run
docfx --serve
Also I found a example project here
I think your problem about you're docfx file configuration.
We're using Jenkins to build out projects using msbuild.
I added a project reference to an existing project but forgot to add these new project to all solution files.
I committed but Jenkins told me that everything works fine.
I tried that on command line:
msbuild test.sln /t:Rebuild /p:Configuration=Debug
Having a totally cleared working directory that works fine, in Jenkins and on my developing machine. The output told me that msbuild found that project and build it.
But if I open Visual Studio 2017 and try to build that solution, it tells me that the depending project could not be found.
That's correct.
How do I force msbuild to only build projects that are specified in the solution file so that we're able to find all solutions that missed that new project?
BTW: We don't need a hint how to find all solutions that need to contain that new project. Finding that solutions is pretty easy.
How do I force msbuild to only build projects that are specified in the solution file so that we're able to find all solutions that missed that new project?
The correct way to avoid MSBuild's default behavior of rebuilding all the dependencies listed in the solution file is to set the BuildProjectReferences property to false, So the build command line should be:
MSBuild Test.sln /t:Rebuild /p:Configuration=Debug /p:BuildProjectReferences=false
After using this command line, MSBuild will get the same error with VS, so we're able to find all solutions that missed that new project
Note: BuildProjectReferences will check all the dependencies listed in the solution file, so please keep his value is true, unless used to check the missing dependencies.
Hope this helps.
I had a ASP.net 4.5 webAPI that worked well that was located in C:\users\me\source\MyProject .
I then needed to push this project to a new Git Repo in Visual studio online.
to push it there I did the following
git remote add origin https://my-cool-webAPI.visualstudio.com/DefaultCollection/_git/MYcoolProject
git push -u origin --all
Everything appeared to be fine.
So i then cloned this project from the Visual Studio Online TFS Git repo to a new source directory.
It was in C:/users/me/source/MyProject and I moved it to C:\Users\me\Desktop\Source\MyProject
Now I have 166 errors and 166 warnings complaining about assembly references.
Here is more detail on a specific error.
Any idea what I did wrong?
** it looks like my references are out of wack, Notice it doesnt know the path to find Entity-Framework.
Is this because I didnt check in the Packages folder or something else
How do I refresh them? and How does one ensure they make it to source control, ie are they managed by a certain file similar to say a Rails Gemfile?
Currently I am doing the following steps to try and run my WebAPI that had no errors before I moved it to this new repo.
Clean the solution (that succeeds)
Build the solution (166 errors and 166 warnings)
Bateloche was on the money with his comments
In order to fix this I had to do the following.
I had to delete my packages folder.
Make sure your packages folder wasnt checked in by default its in the gitignore file that visual studio by defuault generates so it shouldnt be check in.
in VS goto Tools -> NuGet Package Manager -> settings and enabable Nuget to download missing packages.
Make sure to open the package manager console and click accept to refresh the nuget packages. The gotcha was that you may have to restart visual studio for this to work
I create a new project, click compile, and get this error:
Build Failed. See the build log for details.
In the build log there is only this:
Building: FirstProgram (Debug|x86)
---------------------- Done ----------------------
Build failed.
Build: 1 error, 0 warnings
Here is what I see:
What causes this error and how do I fix it?
Lots of times dealing with this error. I just closed and reopened. It happens every time I add a solution and then delete it. I think Xamarin Ide is not a really good Ide, not in Mac at least.
In my case, i did`t Indy (or higher) License.
When i started trial period, the problem was solved.
I got the same error when trying to build. Without having noticed I had been logged out of my account, which caused the error. Curious that I wasn't prompted to relog or given information that I wasn't logged in.
Though this is an old post, maybe this could help someone.
In my case, using Xamarin Studio 6.1.4 (build 1), I unchecked
the 'Use MsBuild engine ...' check box under Project Options > Build > General and
the problem disappeared.
I searched for solution online for similar problem, but none solved my problem, then I tried this:
Tools >>> Options >>> Projects and Solutions >>> Build and Run
Then I changed MSBuild output and MSBuild log to Detailed.
Rebuild and the error message will show.
cd into the project path, and hit msbuild on it.
You will then see the error details in the console STDOUT.
I had the same problem after upgrading Xamarin, and in my case it happened even for a x86/desktop Console Application. Turned out to be because I didn't have 4.5.1, which was required by the newer version (I had only 4.5 I think).
I found this entry in the log:
Unregistered TargetFramework '.NETFramework,Version=v4.5.1' is being requested from SystemAssemblyService, returning empty TargetFramework
After googing this error I found https://stackoverflow.com/a/38102386/492336, and the solution was to download .NET 4.5.1 and it worked after that!
I just ran into the same problem using Visual Studio Community for Mac. The system was out of disk space. Freeing up some disk allowed a build to complete successfully.
Try the following options from Build menu:
Clean All
Rebuild All
Then build it again.
If won't help, check your log files for details by going to Help menu and Open Log Directory.
For example by dragging & dropping the log folder into newly opened Terminal window, and run:
tail -f *.log
then run the build again and check the reported logs. Hit Control-C on Terminal when finished.
For better visibility, run:
tail -f *.log | grep -C5 -i error
You can also try to clear cache folder of VisualStudio, e.g.:
$ lsof -p $(pgrep VisualStudio)
$ rm -fr ~/Library/Caches/com.microsoft.visual-studio
I downloaded and installed the packages shown below in the order listed:
JDK 1.6: http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u31-download-1501634.html Please choose the jdk-6u31-windows-i586.exe installer from the list above.
Android SDK: http://dl.google.com/android/installer_r20-windows.exe After the main installer is done, please open the SDK Manager and install the following platform APIs: 7,8,10,12,14
Mono for Android SDK: http://download.xamarin.com/MonoforAndroid/Windows/mono-android-4.4.55.104956787.msi
Reboot Xamarin.
Try building your project from the Powershell command line.
dotnet build
Then, build errors will appear in the command line output.
I encountered this issue today in Visual Studio for Mac 2022 with a Xamarin Forms 5 project. In my case, going to the Solution properties, under Build → General, and unchecking "Build with MSBuild on Mono" worked.
(This might be similar in spirit as #JackGriffin's answer, but it seems to be a solution property rather than a project property.)
While trying to get a nuget build workflow working on Linux/mono, I've noticed an odd thing.
Being on Linux, I cannot use the nuget Visual Studio plugin or the Powershell console, but I have the nuget.exe command-line utility. This utility has an "install" command which properly fetches packages and places them in my packages directory.
However, nuget.exe's install (as opposed to the Visual Studio install) doesn't appear to update packages.config with the packages it added, nor does it add project references to my .csproj. The latter is less important (I can do it manually), since the packages.config needs to contain recursive dependencies as well I can't do it manually...
Has anyone else tried to install new packages solely using nuget.exe or has any insight into this? Am I barking up the wrong tree entirely?
As it currently (Nuget 2.8.1) stands, this is still not possible and a major shortcoming of the nuget command line client, as I see it.
Nuget.exe must be able to install a package and add it to the packages.config with all dependencies to be usable for anything more than the most simple cases.
I have created an issue, see https://nuget.codeplex.com/workitem/4258
Workaround
For the time being, the following approach can be used. Note that it is far from optimal, but at least enables you to use nuget and resolve dependent packages correctly.
Resort to managing the packages.config manually. Add the packages you need, but omit their dependencies. Note that this is different from "ordinary" packages.config files, which do list the dependencies as well.
Use a script to walk the packages.config and issue a nuget install <package-id> -Version <version> for each package. This will install the package and its dependencies.
I think a better workaround is to use the technique described here to generate a PCM command that will install multiple packages in one go.
Here's a small proof of concept that copies the final command to the clipboard:
param([string[]]$dependencies)
$command = "";
foreach($dependency in $dependencies)
{
$name = $item.Name
if($dependency)
{
$command += ('"{0}", ' -f $dependency)
}
}
$command = $command.Substring(0, $command.Length - 2) + " | foreach {Install-Package `$_}"
$command | Set-Clipboard