I'm trying to publish my project which has references to other projects in my solution.
Whenever I build the solution regularly it builds just fine without any errors.
However, whenever I attempt to publish the project I get the message "Build failed".
When I check the output log I see the following 3 errors:
C:\Users\MyUsername\Dropbox\Projects\SEO\QualityLinkBuilder\Web\RealestateJobsMigrations\RealestateJobsConfiguration.cs(10,101,10,124):
error CS0234: The type or namespace name 'RealestateJobsDbContext'
does not exist in the namespace 'RealestateScraper' (are you missing
an assembly reference?)
C:\Users\MyUsername\Dropbox\Projects\SEO\QualityLinkBuilder\Web\RealestateJobsMigrations\RealestateJobsConfiguration.cs(18,56,18,79):
error CS0234: The type or namespace name 'RealestateJobsDbContext'
does not exist in the namespace 'RealestateScraper' (are you missing
an assembly reference?)
C:\Users\MyUsername\Dropbox\Projects\SEO\QualityLinkBuilder\Web\ViewModels\JobsVm.cs(364,51,364,69):
error CS0246: The type or namespace name 'ClosedRealestateId' could
not be found (are you missing a using directive or an assembly
reference?)
However, I have referenced the project "RealestateScraper" and the class RealestateJobsDbContext&ClosedRealestateId exists in the "RealestateScraper" project root namespace which HAS been marked as using in the locations where the output marked the errors.
(like I previously stated, the project builds fine too when not publishing).
What could be the issue here?
I have cleaned&rebuilt but that doesn't seem to change anything.
Note: I'm not showing the code with the errors since it seems to serve no purpose as I am referencing the assemblies in the files correctly (using RealestateScraper;)
I was experiencing this as well- build only failed during publish. Turns out I was using the wrong password for the azure publish and for some reason I cannot explain it would show that the build failed and include some build errors. After correcting the password this was resolved.
Apparently in the RealestateScraper project I was referencing another project .dll at a location where it no longer existed. I updated the reference location and it fixed it.
In my case, I could not identify the error itself. I just changed the publish property "pre-compile". I UNchecked it and then I was able to publish my website
I had some compiler if-then statements in a class. These worked okay when I did a local build, but when publishing they were not interpreted and caused build errors. I refactored my code to remove the compiler directives and it now publishes.
Example:
#if SERVICE
using System.Web
#endif
Changed to:
using System.Web
unfortunately I have the same unresolved problem solution -prog a -prog b completes both the prog and the solution but when I go to publish it gives me error c0246 on using of the project b called in the project a
Help
I tried all of these solutions, and they might have contributed, but I was still getting the error.
I was tipped off by a warning. I had to make this file not read-only within the project, then it worked.
\obj\Release\netcoreapp3.0\PubTmp\Out\web.config
Related
I had perfectly well working blazor app (like in demo -- shared project, server project and client one). I needed to move entire solution and also rename the projects. As the effect I have strange errors in web client:
App.razor: warning RZ10012: Found markup element with unexpected name 'RedirectToLogin'. If this is intended to be a component, add a #using directive for its namespace.
Index.razor: warning RZ10012: Found markup element with unexpected name 'SurveyPrompt'. If this is intended to be a component, add a #using directive for its namespace.
App.razor: error CS0246: The type or namespace name 'MainLayout' could not be found (are you missing a using directive or an assembly reference?)
App.razor.g.cs: error CS1662: Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type
App.razor: error CS0246: The type or namespace name 'MainLayout' could not be found (are you missing a using directive or an assembly reference?)
Of course "MainLayout" is present, same story with "SurveyPrompt". I deleted entire "bin" directory, "obj", ".vs", restarted VS and build the solution again, same outcome.
One thing which confuses me even more is "RedirectToLogin" for example is a component. I have my own component, used on several of pages, and yet there is no warning about it, so it is seen. Why then "RedirectToLogin" is not?
The error coming from compiled razor file I guess is safe to ignore for a moment, because it can be caused by previous errors and warnings.
For the record, I have to rename the projects, so I cannot solve this by reverting all the name changes.
On every warning/error report against "MainLayout" or "RedirectToLogin", I edited given file and added entire namespace for it. Looking at their names "BlazorApp.Client.Shared.MainLayout" I realized somehow conflict with project namespaces could happen -- "BlazorApp.Client.Shared" is folder within client while "BlazorApp.Shared" is project.
On the other hand conflict could occur if there are two same entities within two distinct reachable namespaces. Namespaces are reachable, but "MainLayout" for example is only once defined.
Problem solved, pity I don't fully understand why it worked before and what was broken after renaming.
I am getting this error while trying to build a solution:
Error CS0246
The type or namespace name 'ClassName' could not be found (are you missing a using directive or an assembly reference?)
The error and the red lines disappear when I open the error list and click on it. I can see the missing dll file is recognized by that class and it is also listed in the references.
I searched many questions here but none of them worked for me. Here is a list of things I tried so far that might help to understand the problem.
I've got the project from TFS and have been never able to build so far. I think the project is not correctly checked in.
I choose 'build only' in the Error list section, after that the errors did not disappear.
All project versions are .Net 4.6, none of them is Client Profile like other in questions here.
I tried to clean, to rebuild, deleting references and adding them again, but none of them worked.
I have changed build output to Diagnostic then inspected errors.
I have found this line and changed all projects target version from 4.6 to 4.6.2 and it worked.
Dll could not be resolved because it was built against the
".NETFramework,Version=v4.6.2" framework. This is a higher version
than the currently targeted framework ".NETFramework,Version=v4.6".
I'm using MSVS2015Pro for Xamarin.
I downloaded the project: https://github.com/Clans/FloatingActionButton
But I'm getting an error on:
using Clans.Fab;
It says:
Severity Code Description Project File Line Suppression State
Error CS0246 The type or namespace name 'Clans' could not be found (are you missing a using directive or an assembly reference?) FAB.Sample D:\Xamarin\FloatingActionButton-Xamarin.Android\FAB.Sample\FloatingActionMenuBehavior.cs 5 Active
as you can see on the following image:
[EDIT]
On the following image you have more details on errors:
My question is:
how can I debug these kind of errors?, I mean, not this one specifically but when there are using errors in general?. How can I know what: Clans.Fab; specifically is needed and from where do I have to download it?
[EDIT]
Then I did:
PM> Install-Package FAB.XamarinAndroid
and the errors disappeared and now I have 255 warnings.
Any idea on how to fix these warnings?
Below you have an screenshot with them:
Any idea on how to get rid of these warnings?
Visual Studio projects you download from github should contains all external references pointing to nuget packages and you restore them on first build (unless project is not configured to restore on build).
Local references are either framework references you should have installed on your machine or other projects inside the solution.
Normally a missed class will be paired with a yellow exlamation symbol on references list indicating that a necessary assembly could not be loaded, that could be a first check to do.
Output window from build could also provide insights about any anomaly related to references.
I am using visual studio 2012 and .Net framework 4.5. I have included 'Microsoft.VisualBasic' in my project reference.
I am getting the following error while executing the project.
Compilation Error Description: An error occurred during the
compilation of a resource required to service this request. Please
review the following specific error details and modify your source
code appropriately.
Compiler Error Message: CS0234: The type or namespace name 'FileIO'
does not exist in the namespace 'Microsoft.VisualBasic' (are you
missing an assembly reference?)
Source Error:
int lineNumber = 0;
int flag = 1;
using (Microsoft.VisualBasic.FileIO.TextFieldParser parser = new Microsoft.VisualBasic.FileIO.TextFieldParser(file))
{
parser.CommentTokens = new string[] { "#" };
I had tried adding the reference again and again but it doesn't seems to be working.
I even tried the answers from following question in Stack Overflow but nothing helped
microsoft.visualbasic.fileio does not exist
Please help me
Similar to Mark Richman, it still did not give me access to the FileIO. What I did, is click on Tools->NuGet PackageManager->Manage NuGet Packages For Solution. Searched for Microsoft.VisualBasic. Clicked Install, and it gave some terms and conditions that I accepted. After Installing this way, I was able to get the FileIO option.
I got this problem solved now
I have copied Microsoft.VisualBasic.dll file to the bin folder of my project and now it seems to be working fine.
(OR)
You can change the Properties of the reference as follows
-> Right click the Microsoft.VisualBasic reference in solution explorer and change Copy Local property value as 'True' .
This will do the trick
I ran into this error while writing unit tests and thought I had added the reference to my project as described above (and in this answer). However, I was adding the reference to my unit test project rather than my main project. Just in case anyone is as foolish as I was: add your reference to the correct project, clean your project/solution, then profit.
I seem to be getting some weird errors while rebuilding the project.
I have a project in witch I have stored all my DomainService. If I right click on the solution and select clean solution then rebuild the project I get a bunch of this errors:
Error 104
The type or namespace name 'Practices' does not exist in the namespace
'Microsoft' (are you missing an assembly reference?)
D:\Projects\Backend\WebApi\DomainServices\LocalizationService.cs
I get errors for each file where I have imported this namespace:
using Microsoft.Practices.ServiceLocation;
Now I have already added a reference to the assembly.
The weirdest thing is that if I rebuild again everything works and no errors are displayed.
Does anyone have any ideea what's going on?
Possibly you have wrong build order, visual studio tries to do this in good way, but sometimes it fails
http://social.msdn.microsoft.com/Forums/windows/en-US/34fcc251-b6fe-4878-8274-fa094ae34151/how-do-i-set-the-build-order-of-projects-in-visual-studio-solution