Answered by:
Azure web role - No project associated

Question
-
Environment = VS 2010 with Azure SDK 1.7
When trying to associate an existing WebRole in my solution it starts off saying it is associated. However, as soon as it is built it returns a message
------ Build started: Project: AzureWCFHost (Server\Azure\AzureWCFHost\AzureWCFHost), Configuration: Debug Any CPU ------
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Windows Azure Tools\1.7\Microsoft.WindowsAzure.targets(2692,5): error : WAT001 : At least one web, worker or virtual machine role is required but none could be found
Done building project "AzureWCFHost.ccproj" -- FAILED.Build FAILED.
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========Now the Azure project shows under Roles "No project associated".
I've reworked my solution directory structure to be more organized. This "no project associated" was not a problem when the Azure project and webrole were added to the old solution (with old directory structure). It almost looks like the Azure project can't handle a role association if that role is anywhere other than at the root of the solution.
I removed the azure project from the solution and added a blank azure project to the solution, then right clicked on Roles and associated the existing webrole project. It initially shows under Roles but as soon as a build is performed the error above occurs and it is back to saying "no project associated".
Does anyone know if Azure projects are hosed unless the default webrole directory relative to the azure project is used?
May we all make money in the sequel.
Wednesday, October 31, 2012 3:53 PM
Answers
-
I have worked around the issue, yes. There is still something regarding the use of namespaces in the Azure service project that obviously I don't understand. Removing all Roles in the Azure project and then adding a Role from the solution should just work, but it doesn't. The work around is to remove the Azure project and webrole project and make them from scratch again.
May we all make money in the sequel.
- Marked as answer by Johnson - MSFT Tuesday, November 6, 2012 10:04 AM
Friday, November 2, 2012 12:02 PM
All replies
-
A little bit more info. The "no project associated" is triggered when editing the ServiceDefinition.csdef. I changed the default vmsize from Small to ExtraSmall and as soon as it is saved, the role changed to "no project associated".
Also noticed that the role shown in the solution explorer went from "WCFServiceWebRole (Server\Azure\WCFServiceWebRole\WCFServiceWebRole)" to "No project associated (WCFServiceWebRole)".
May we all make money in the sequel.
- Edited by Dave Williamson2 Wednesday, October 31, 2012 5:09 PM added additional "also noticed"
Wednesday, October 31, 2012 5:06 PM -
This is just ODD. I removed the Azure project from the solution. I then right clicked on the WCFServiceWebRole project in solution explorer and selected "Add Windows Azure Cloud Service Project". It added a project in the root of the solution. This Azure project could successfully package.
So next I renamed the newly created Azure project to the same name that I had for the Azure project that was not working. It continued to successfully package.
So next I dropped the newly created Azure project from the solution, renamed the directory it was within to also reflect the new name of the project, then moved the directory into the desired place on disk. I then went into the project file for the newly created Azure project (via notepad) and changed the relative path to the WCFServiceWebRole to be correct for the new location. I then added the newly created Azure project to the solution in the proper solution directory. The newly created Azure project built and packaged successfully.
Perplexed at this point I did a diff on the newly created Azure project directory and the prior one that was not working and they were identical with one exception. The namespace on the newly created Azure project was "WCFServiceWebRole.Azure" versus the old one was "AzureWCFHost".
Obviously there is something to learn here.
May we all make money in the sequel.
- Edited by Dave Williamson2 Wednesday, October 31, 2012 5:36 PM typo correction
Wednesday, October 31, 2012 5:34 PM -
Hi Dave, seems you have resolved your issue yourself, haven't you?
Please feel free to let me know if you have any question.
Best Regards
Friday, November 2, 2012 6:36 AM -
I have worked around the issue, yes. There is still something regarding the use of namespaces in the Azure service project that obviously I don't understand. Removing all Roles in the Azure project and then adding a Role from the solution should just work, but it doesn't. The work around is to remove the Azure project and webrole project and make them from scratch again.
May we all make money in the sequel.
- Marked as answer by Johnson - MSFT Tuesday, November 6, 2012 10:04 AM
Friday, November 2, 2012 12:02 PM -
What seems to be problem, regard to this issue, when your solution folder has the same name as your project name and the project belongs to this folder.
ImportSolution <- Solution
-- Import <- Solution folder
----Import <- Project
Wednesday, April 17, 2013 11:47 AM -
This typically means you need to edit your ccproj because it lost the ProjectReference node. This happens when you manually edit your Service Definition.
<ItemGroup> <ProjectReference Include="..\MyMVCApp\MyMVCApp.csproj"> <Name>MyMVCApp</Name> <Project>{bd5363d7-e43b-43f5-b0ec-abac1a5eb8ba}</Project> <Private>True</Private> <RoleType>Web</RoleType> <RoleName>MyMVCApp</RoleName> <UpdateDiagnosticsConnectionStringOnPublish>True</UpdateDiagnosticsConnectionStringOnPublish> </ProjectReference> </ItemGroup>
- Proposed as answer by KindReality Wednesday, April 22, 2015 6:45 PM
Thursday, February 26, 2015 9:23 PM -
Bravo Silver Ninjas! This worked great! Remember to use the correct project name, GUID, and path.
Michael Saft
Wednesday, April 22, 2015 6:45 PM